All of lore.kernel.org
 help / color / mirror / Atom feed
From: Edward Srouji <edwards@nvidia.com>
To: sashiko-reviews@lists.linux.dev
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 18:24:30 +0200	[thread overview]
Message-ID: <bd632d18-41ca-4dd4-8694-e31e91df53fb@nvidia.com> (raw)
In-Reply-To: <sashiko-outbox-239770@kernel.org>



On 11/29/2026 5:45 PM, sashiko-bot@kernel.org wrote:
> External email: Use caution opening links or attachments
> 
> 
> 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).
> 

Already addressed in v1: 
https://lore.kernel.org/linux-rdma/sashiko-outbox-238738@kernel.org/T/#mf3002ed7cdefdc2b7f21dd9511debb84ff6bc0e7

> --
> 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 16:24 UTC|newest]

Thread overview: 8+ 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
2026-11-29 16:24     ` Edward Srouji [this message]
2026-11-29 15:45 ` [PATCH rdma-next v2 0/3] RDMA/mlx5: Support pinned revocable dma-buf import sashiko-bot
2026-12-01 19:22 ` Leon Romanovsky

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=bd632d18-41ca-4dd4-8694-e31e91df53fb@nvidia.com \
    --to=edwards@nvidia.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 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.