From: Stanislav Fomichev <sdf.kernel@gmail.com>
To: Erfan Sharafzadeh <erfansh@meta.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
almasrymina@google.com, kaiyuanz@google.com, willemb@google.com,
asml.silence@gmail.com, sdf@fomichev.me, bobbyeshleman@meta.com
Subject: Re: [PATCH net-next v2] net: devmem: allow peer-to-peer dma-buf attach for bindings
Date: Wed, 14 Oct 2026 11:19:14 -0700 [thread overview]
Message-ID: <as_HT7Dfp8MIkTfa@devvm7509.cco0.facebook.com> (raw)
In-Reply-To: <20261013210954.2170175-1-erfansh@meta.com>
On 10/13, Erfan Sharafzadeh wrote:
> net_devmem_bind_dmabuf() uses dma_buf_attach(), a static attachment
> with peer2peer false. Exporters must then keep the buffer reachable
> without P2P; amdgpu does so by placing it in GTT (system memory), so a
> device memory binding silently ends up in host memory.
>
> Use dma_buf_dynamic_attach() with allow_peer2peer set, so an exporter
> that can do P2P to the device keeps the buffer in device memory.
> Dynamic attachments are not pinned on map, and devmem cannot handle the
> buffer moving, so:
>
> - pin it with dma_buf_pin() before mapping, which keeps it in place for
> the lifetime of the binding, as before;
> - wait for the exporter's kernel fences after mapping, interruptibly,
> as the core does for static attachments.
>
> This follows the pinned RDMA umem path, including its limits: the
> binding cannot be revoked by the exporter, and once a P2P binding has
> pinned a buffer in device memory, a later attachment to the same buffer
> that cannot do P2P may fail to pin it. Exporters that cannot do P2P to
> the device place the buffer as before. RX and TX bindings both go
> through this function.
>
> Signed-off-by: Erfan Sharafzadeh <erfansh@meta.com>
> ---
> v2:
> - Target net-next and drop the Fixes: tag. This adds P2P placement
> rather than fixing incorrect behaviour, and it relies on recent
> dma-buf core changes, so it should not go to stable.
> - Wait for the exporter's fences interruptibly, as the core does.
> - Describe the revocation and mixed-attachment limits in the commit
> message.
>
> v1: https://lore.kernel.org/netdev/20261012170754.669462-1-erfansh@meta.com/
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
We never with proper in-tree exporters (rather than "mock" udmabuf) so
here we are :-(
prev parent reply other threads:[~2026-10-14 18:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 21:09 [PATCH net-next v2] net: devmem: allow peer-to-peer dma-buf attach for bindings Erfan Sharafzadeh
2026-10-14 18:19 ` Stanislav Fomichev [this message]
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=as_HT7Dfp8MIkTfa@devvm7509.cco0.facebook.com \
--to=sdf.kernel@gmail.com \
--cc=almasrymina@google.com \
--cc=asml.silence@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=erfansh@meta.com \
--cc=horms@kernel.org \
--cc=kaiyuanz@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=willemb@google.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 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.