From: Leon Romanovsky <leon@kernel.org>
To: Junxian Huang <huangjunxian6@hisilicon.com>
Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org, linuxarm@huawei.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH for-next 4/6] RDMA/hns: Support flexible pagesize
Date: Tue, 26 Dec 2023 11:42:18 +0200 [thread overview]
Message-ID: <20231226094218.GA17182@unreal> (raw)
In-Reply-To: <fbd65691-b0a2-0963-96fc-7e09a66cd203@hisilicon.com>
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
next prev parent reply other threads:[~2023-12-26 9:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-25 7:53 [PATCH for-next 0/6] RDMA/hns: Improvement for multi-level addressing Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 1/6] RDMA/hns: Refactor mtr find Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 2/6] RDMA/hns: Refactor mtr_init_buf_cfg() Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 3/6] RDMA/hns: Alloc MTR memory before alloc_mtt() Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 4/6] RDMA/hns: Support flexible pagesize Junxian Huang
2023-12-26 8:52 ` Leon Romanovsky
2023-12-26 9:16 ` Junxian Huang
2023-12-26 9:42 ` Leon Romanovsky [this message]
2024-01-04 20:29 ` Jason Gunthorpe
2024-01-05 5:55 ` Junxian Huang
2024-01-05 14:18 ` Jason Gunthorpe
2024-01-09 1:47 ` Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 5/6] RDMA/hns: Support adaptive PBL hopnum Junxian Huang
2023-12-25 7:53 ` [PATCH for-next 6/6] RDMA/hns: Simplify 'struct hns_roce_hem' allocation Junxian Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231226094218.GA17182@unreal \
--to=leon@kernel.org \
--cc=huangjunxian6@hisilicon.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox