From: Leon Romanovsky <leon@kernel.org>
To: Honggang LI <honggangli@163.com>
Cc: haris.iqbal@ionos.com, jinpu.wang@ionos.com, jgg@ziepe.ca,
danil.kipnis@cloud.ionos.com, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] RDMA/rtrs: client: Fix clt_path::max_pages_per_mr calculation
Date: Thu, 25 Dec 2025 14:33:32 +0200 [thread overview]
Message-ID: <20251225123332.GI11869@unreal> (raw)
In-Reply-To: <20251224095030.156465-1-honggangli@163.com>
On Wed, Dec 24, 2025 at 05:50:30PM +0800, Honggang LI wrote:
> If device max_mr_size bits in the range [mr_page_shift+31:mr_page_shift]
> are zero, the `min3` function will set clt_path::max_pages_per_mr to
> zero.
>
> `alloc_path_reqs` will pass zero, which is invalid, as the third parameter
> to `ib_alloc_mr`.
>
> v1 -> v2:
> Correct the commit message and set max_pages_per_mr to U32_MAX
> as Michael Gur suggested.
Please put changelog under --- marker, below Signed-off-by tags.
> Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
> Signed-off-by: Honggang LI <honggangli@163.com>
> ---
> drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> index 71387811b281..e477d2c0ff35 100644
> --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
> @@ -1464,6 +1464,8 @@ static void query_fast_reg_mode(struct rtrs_clt_path *clt_path)
> mr_page_shift = max(12, ffs(ib_dev->attrs.page_size_cap) - 1);
> max_pages_per_mr = ib_dev->attrs.max_mr_size;
> do_div(max_pages_per_mr, (1ull << mr_page_shift));
> + if ((u32)max_pages_per_mr == 0)
> + max_pages_per_mr = U32_MAX;
It is "max_pages_per_mr = min_not_zero((u32)max_pages_per_mr, U32_MAX)"
Thanks
> clt_path->max_pages_per_mr =
> min3(clt_path->max_pages_per_mr, (u32)max_pages_per_mr,
> ib_dev->attrs.max_fast_reg_page_list_len);
> --
> 2.52.0
>
next prev parent reply other threads:[~2025-12-25 12:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-24 9:50 [PATCH v2] RDMA/rtrs: client: Fix clt_path::max_pages_per_mr calculation Honggang LI
2025-12-24 11:36 ` Michael Gur
2025-12-25 12:33 ` Leon Romanovsky [this message]
2025-12-29 2:49 ` Honggang LI
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=20251225123332.GI11869@unreal \
--to=leon@kernel.org \
--cc=danil.kipnis@cloud.ionos.com \
--cc=haris.iqbal@ionos.com \
--cc=honggangli@163.com \
--cc=jgg@ziepe.ca \
--cc=jinpu.wang@ionos.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.