On Wed, May 29, 2019 at 10:35:58PM +0300, Gal Pressman wrote: > On 29/05/2019 20:20, Saleem, Shiraz wrote: > >> Subject: Re: [PATCH for-rc 4/6] RDMA/efa: Use API to get contiguous memory > >> blocks aligned to device supported page size > >> > >> On Tue, May 28, 2019 at 03:46:16PM +0300, Gal Pressman wrote: > >>> @@ -1500,13 +1443,17 @@ struct ib_mr *efa_reg_mr(struct ib_pd *ibpd, u64 > >> start, u64 length, > >>> params.iova = virt_addr; > >>> params.mr_length_in_bytes = length; > >>> params.permissions = access_flags & 0x1; > >>> - max_page_shift = fls64(dev->dev_attr.page_size_cap); > >>> > >>> - efa_cont_pages(mr->umem, start, max_page_shift, &npages, > >>> - ¶ms.page_shift, ¶ms.page_num); > >>> + pg_sz = ib_umem_find_best_pgsz(mr->umem, > >>> + dev->dev_attr.page_size_cap, > >>> + virt_addr); > >> > >> I think this needs to check pg_sz is not zero.. > >> > > > > What is the smallest page size this driver supports? > > The page size capability is queried from the device, the smallest page size is > currently 4k. > > Isn't PAGE_SIZE always supported? No, PAGE_SIZE is only supported if the device supports PAGE_SIZE or smaller blocks. > What did drivers do before ib_umem_find_best_pgsz() existed in case > they didn't support PAGE_SIZE? Most malfunctioned. > I doubt there is/will be a real use-case where it matters for EFA, > but I can add the check to be on the safe side. Please, I want the reference implementations of this API to be correct for reference by others. Jason