lkml.org 
[lkml]   [2023]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH for-next 4/6] RDMA/hns: Support flexible pagesize
On Tue, Dec 26, 2023 at 05:16:33PM +0800, Junxian Huang wrote:
>
>
> On 2023/12/26 16:52, Leon Romanovsky wrote:
> > On Mon, Dec 25, 2023 at 03:53:28PM +0800, Junxian Huang wrote:
> >> From: Chengchang Tang <tangchengchang@huawei.com>
> >>
> >> In the current implementation, a fixed page size is used to
> >> configure the PBL, which is not flexible enough and is not
> >> conducive to the performance of the HW.
> >>
> >> Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
> >> Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
> >> ---
> >> drivers/infiniband/hw/hns/hns_roce_alloc.c | 6 -
> >> drivers/infiniband/hw/hns/hns_roce_device.h | 9 ++
> >> drivers/infiniband/hw/hns/hns_roce_mr.c | 168 +++++++++++++++-----
> >> 3 files changed, 139 insertions(+), 44 deletions(-)
> >
> > I'm wonder if the ib_umem_find_best_pgsz() API should be used instead.
> > What is missing there?
> >
> > Thanks
>
> Actually this API is used for umem.
> For kmem, we add hns_roce_find_buf_best_pgsz() to do a similar job.

Thanks, let's give a chance to Jason to provide his feedback. I have a
strong feeling that this code duplicates something in the kernel.

Thanks

>
> +static int get_best_page_shift(struct hns_roce_dev *hr_dev,
> + struct hns_roce_mtr *mtr,
> + struct hns_roce_buf_attr *buf_attr)
> +{
> + unsigned int page_sz;
> +
> + if (!buf_attr->adaptive || buf_attr->type != MTR_PBL)
> + return 0;
> +
> + if (mtr->umem)
> + page_sz = ib_umem_find_best_pgsz(mtr->umem,
> + hr_dev->caps.page_size_cap,
> + buf_attr->iova);
> + else
> + page_sz = hns_roce_find_buf_best_pgsz(hr_dev, mtr->kmem);
> +
> + if (!page_sz)
> + return -EINVAL;
> +
> + buf_attr->page_shift = order_base_2(page_sz);
> + return 0;
> +}
>
> Thanks,
> Junxian

\
 
 \ /
  Last update: 2023-12-26 10:43    [W:0.071 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site