Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Edward Srouji" <edwards@nvidia.com>
Cc: linux-rdma@vger.kernel.org, dri-devel@lists.freedesktop.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH rdma-next v2 3/3] RDMA/mlx5: Try pinned revocable dmabuf import by default
Date: Sun, 29 Nov 2026 15:45:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-239770@kernel.org> (raw)
In-Reply-To: <20261129-mlx5-pinned-revocable-dmabuf-v2-3-830a412a3369@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] RDMA/mlx5: user-triggerable WARN_ON(!page_size) in
  alloc_cacheable_mr()
--

commit 3a4c35010e9f8b10e62196ece5aade6e6065212c
Author: Yishai Hadas <yishaih@nvidia.com>

RDMA/mlx5: Try pinned revocable dmabuf import by default

This commit attempts a pinned, revocable dma-buf attachment by default
when registering a dma-buf MR so that the mkey can be sized exactly,
falling back to a movable ODP import only when the exporter does not
grant it.

> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index 3c59cfbbbd19f..0ba82356963dd 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -443,7 +443,7 @@ static struct mlx5_ib_mr *alloc_cacheable_mr(struct ib_pd *pd,
>  	struct mlx5_ib_mr *mr;
>  	unsigned long page_size;
>  
> -	if (umem->is_dmabuf)
> +	if (umem->is_dmabuf && !to_ib_umem_dmabuf(umem)->pinned)
>  		page_size = mlx5_umem_dmabuf_default_pgsz(umem, iova);
>  	else
>  		page_size = mlx5_umem_mkc_find_best_pgsz(pd_to_mdev(pd), umem,

[Severity: Medium]
Can userspace trigger WARN_ON(!page_size) right below this when
registering a pinned dma-buf MR?

Previously all dma-buf MRs took the mlx5_umem_dmabuf_default_pgsz()
branch here and checked mlx5_umem_dmabuf_find_best_pgsz() later in
mlx5_ib_dmabuf_mr_update_pas(), which returns -EINVAL without a warning
when page_size is 0.  Now pinned dma-buf MRs call
mlx5_umem_mkc_find_best_pgsz() -> ib_umem_find_best_pgsz() in
alloc_cacheable_mr().  Because UVERBS_METHOD_REG_DMABUF_MR only checks
that offset and iova share the same sub-page alignment, a user-supplied
iova where iova + umem->length - 1 overflows u64 causes
ib_umem_find_best_pgsz() to return 0 and hit WARN_ON(!page_size).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261129-mlx5-pinned-revocable-dmabuf-v2-0-830a412a3369@nvidia.com?part=3

  reply	other threads:[~2026-11-29 15:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 15:25 [PATCH rdma-next v2 0/3] RDMA/mlx5: Support pinned revocable dma-buf import Edward Srouji
2026-11-29 15:25 ` [PATCH rdma-next v2 1/3] RDMA/uverbs: Permit dma-buf export to work with pinned importers Edward Srouji
2026-11-29 15:25 ` [PATCH rdma-next v2 2/3] RDMA/mlx5: Move dma-buf MR init out of ODP-only compilation Edward Srouji
2026-11-29 15:25 ` [PATCH rdma-next v2 3/3] RDMA/mlx5: Try pinned revocable dmabuf import by default Edward Srouji
2026-11-29 15:45   ` sashiko-bot [this message]
2026-11-29 15:45 ` [PATCH rdma-next v2 0/3] RDMA/mlx5: Support pinned revocable dma-buf import sashiko-bot

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=sashiko-outbox-239770@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edwards@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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