> Subject: Re: [PATCH 02/14] RDMA/umem: Prevent small pages from being > returned by ib_umem_find_best_pgsz() > > On Thu, Sep 03, 2020 at 02:11:37PM +0000, Saleem, Shiraz wrote: > > > Subject: [PATCH 02/14] RDMA/umem: Prevent small pages from being > > > returned by > > > ib_umem_find_best_pgsz() > > > > > > rdma_for_each_block() makes assumptions about how the SGL is > > > constructed that don't work if the block size is below the page size used to to > build the SGL. > > > > > > The rules for umem SGL construction require that the SG's all be > > > PAGE_SIZE aligned and we don't encode the actual byte offset of the > > > VA range inside the SGL using offset and length. So > > > rdma_for_each_block() has no idea where the actual starting/ending > > > point is to compute the first/last block boundary if the starting address should > be within a SGL. > > > > Not sure if we were exposed today. i.e. rdma drivers working with > > block sizes smaller than system page size? > > Yes, it could happen, here are some examples: > > drivers/infiniband/hw/i40iw/i40iw_verbs.c: > iwmr->page_size = ib_umem_find_best_pgsz(region, SZ_4K | SZ_2M, > > drivers/infiniband/hw/bnxt_re/ib_verbs.c: > page_shift = __ffs(ib_umem_find_best_pgsz(umem, > BNXT_RE_PAGE_SIZE_4K | BNXT_RE_PAGE_SIZE_2M, > virt_addr)); > > Eg that breaks on a ARM with 16k or 64k page sizes. > Yes. Make sense. Thanks for the patch!