On Mon, Mar 8, 2021 at 1:22 AM Leon Romanovsky <leon@xxxxxxxxxx> wrote: > > On Sun, Mar 07, 2021 at 10:28:33PM +0800, Zhu Yanjun wrote: > > From: Zhu Yanjun <zyjzyj2000@xxxxxxxxx> > > > > After the commit ("RDMA/umem: Move to allocate SG table from pages"), > > the sg list from ib_ume_get is like the following: > > " > > sg_dma_address(sg):0x4b3c1ce000 > > sg_dma_address(sg):0x4c3c1cd000 > > sg_dma_address(sg):0x4d3c1cc000 > > sg_dma_address(sg):0x4e3c1cb000 > > " > > > > But sometimes, we need sg list like the following: > > " > > sg_dma_address(sg):0x203b400000 > > sg_dma_address(sg):0x213b200000 > > sg_dma_address(sg):0x223b000000 > > sg_dma_address(sg):0x233ae00000 > > sg_dma_address(sg):0x243ac00000 > > " > > The function ib_umem_add_sg_table can provide the sg list like the > > second. And this function is removed in the commit ("RDMA/umem: Move > > to allocate SG table from pages"). Now I add it back. > > > > The new function is ib_umem_get to ib_umem_hugepage_get that calls > > ib_umem_add_sg_table. > > > > This function ib_umem_huagepage_get can get 4K, 2M sg list dma address. > > > > Fixes: 0c16d9635e3a ("RDMA/umem: Move to allocate SG table from pages") > > Signed-off-by: Zhu Yanjun <zyjzyj2000@xxxxxxxxx> > > --- > > drivers/infiniband/core/umem.c | 197 +++++++++++++++++++++++++++++++++ > > include/rdma/ib_umem.h | 3 + > > 2 files changed, 200 insertions(+) > > You didn't use newly introduced function and didn't really explain why Thanks Leon and Jason. Now I set ib_dma_max_seg_size to SZ_2M. Then this problem is fixed. This problem is caused by the capacity parameter of our device. Originally the ib_dma_max_seg_size is set to UINT_MAX. Then the sg dma address is different from the ones before the commit ("RDMA/umem: Move to allocate SG table from pages"). And I delved into the source code of __sg_alloc_table_from_pages. I found that this function is related with ib_dma_max_seg_size. So when ib_dma_max_seg_size is set to UINT_MAX, the sg dma address is 4K (one page). When ib_dma_max_seg_size is set to SZ_2M, the sg dma address is 2M now. The function ib_umem_add_sg_table is not related with ib_dma_max_seg_size. So the value of ib_dma_max_seg_size does not affect sg dma address. Anyway, this problem is not caused by the function __sg_alloc_table_from_pages. Please ignore this commit. Zhu Yanjun > it is needed. > > Thanks