From: Dragos Tatulea <dtatulea@nvidia.com>
To: Mina Almasry <almasrymina@google.com>,
Jakub Kicinski <kuba@kernel.org>, David Wei <dw@davidwei.uk>,
Pavel Begunkov <asml.silence@gmail.com>,
Taehee Yoo <ap420073@gmail.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Paolo Abeni <pabeni@redhat.com>,
Kaiyuan Zhang <kaiyuanz@google.com>,
Bobby Eshleman <bobbyeshleman@meta.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Simon Horman" <horms@kernel.org>,
"Shuah Khan" <shuah@kernel.org>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Nikolay Aleksandrov" <razor@blackwall.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Tariq Toukan" <tariqt@nvidia.com>,
"Kaifeng Wang" <kaifengw@google.com>
Subject: Re: [PATCH net v2 0/4] net: devmem: fix RX and TX binding teardown on device unregistration
Date: Wed, 14 Oct 2026 14:33:28 +0200 [thread overview]
Message-ID: <ff7cd77d-a7c6-42ec-a1bc-3790aee8b727@nvidia.com> (raw)
In-Reply-To: <20261012174300.2338784-1-almasrymina@google.com>
On 12.10.26 19:42, Mina Almasry wrote:
> Fix two device-unregistration lifecycle bugs in devmem TCP bindings and
> add netdevsim support plus selftests covering both RX and TX device
> unregistration:
>
> 1. net: devmem: unmap dma_buf synchronously on queue uninstall
> Synchronously unmap and detach binding->attachment under binding->lock
> when the last RX queue is uninstalled in mp_dmabuf_devmem_uninstall(),
> and unmap RX bindings that were already unbound on NETDEV_UNREGISTER,
> preventing slab-use-after-free in dma_unmap_sg_attrs() when the binding
> is freed after dma_dev.
>
> 2. net: devmem: detach TX bindings on NETDEV_UNREGISTER
> Extend net_devmem_dev_unregister() to fully detach and unmap TX
> bindings when binding->dev unregisters, or clear binding->vdev alone
> when only a virtual device unregisters while binding->dev lives.
>
> 3. netdevsim: support devmem RX and TX bindings
> Enable PP_FLAG_DMA_MAP | PP_FLAG_ALLOW_UNREADABLE_NETMEM, 64-bit DMA mask
> on nsim_bus_dev, and NETMEM_TX_DMA on netdevsim so devmem RX/TX bindings
> can be exercised in software selftests.
>
> 4. selftests: net: add devmem RX and TX netdev unregister tests
> Add devmem_bind_rx_unregister_check and devmem_bind_tx_unregister_check
> to tools/testing/selftests/net/nl_netdev.py.
>
> Cc: Tariq Toukan <tariqt@nvidia.com>
> Cc: Kaifeng Wang <kaifengw@google.com>
>
> ---
> v2:
> - 1/4: Don't unmap when a leased queue is unleased. Keep bindings in
> net_devmem_dmabuf_bindings until freed, hidden from TX lookups by an
> xarray mark, and unmap unbound RX bindings on NETDEV_UNREGISTER. Update
> the binding->lock and binding->ref comments. (Sashiko)
> - 2/4: Detach TX bindings from the same net_devmem_lock-protected walk,
> which now also covers unbound TX bindings, and clear the LIVE mark
> instead of erasing the ID. The walk no longer uses RCU or takes
> binding references (Stanislav).
> - Link to v1: https://lore.kernel.org/netdev/20261010025532.839559-1-almasrymina@google.com/
>
> Mina Almasry (4):
> net: devmem: unmap dma_buf synchronously on queue uninstall
> net: devmem: detach TX bindings on NETDEV_UNREGISTER
> netdevsim: support devmem RX and TX bindings
> selftests: net: add devmem RX and TX netdev unregister tests
>
> drivers/net/netdevsim/bus.c | 1 +
> drivers/net/netdevsim/netdev.c | 21 ++--
> net/core/devmem.c | 121 ++++++++++++++++++++---
> net/core/devmem.h | 10 +-
> net/core/netdev-genl.c | 1 +
> tools/testing/selftests/net/nl_netdev.py | 108 +++++++++++++++++++-
> 6 files changed, 236 insertions(+), 26 deletions(-)
>
>
> base-commit: 4f6ac74fa594a918d41255c941256e1d51592d3b
Went through the series and it looks good to my feeble human brain:
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
I am biased though because I need Mina's code to add support for
unbinding the dma device for data-direct.
Thanks,
Dragos
prev parent reply other threads:[~2026-10-14 12:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 17:42 [PATCH net v2 0/4] net: devmem: fix RX and TX binding teardown on device unregistration Mina Almasry
2026-10-12 17:42 ` [PATCH net v2 1/4] net: devmem: unmap dma_buf synchronously on queue uninstall Mina Almasry
2026-10-13 18:14 ` netdev-bot+sashiko
2026-10-14 6:49 ` Mina Almasry
2026-10-14 16:33 ` Stanislav Fomichev
2026-10-14 17:41 ` Mina Almasry
2026-10-12 17:42 ` [PATCH net v2 2/4] net: devmem: detach TX bindings on NETDEV_UNREGISTER Mina Almasry
2026-10-13 18:14 ` netdev-bot+sashiko
2026-10-12 17:42 ` [PATCH net v2 3/4] netdevsim: support devmem RX and TX bindings Mina Almasry
2026-10-13 18:14 ` netdev-bot+sashiko
2026-10-12 17:43 ` [PATCH net v2 4/4] selftests: net: add devmem RX and TX netdev unregister tests Mina Almasry
2026-10-13 18:14 ` netdev-bot+sashiko
2026-10-14 12:28 ` Dragos Tatulea
2026-10-14 12:33 ` Dragos Tatulea [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=ff7cd77d-a7c6-42ec-a1bc-3790aee8b727@nvidia.com \
--to=dtatulea@nvidia.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=ap420073@gmail.com \
--cc=asml.silence@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=christian.koenig@amd.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dri-devel@lists.freedesktop.org \
--cc=dw@davidwei.uk \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kaifengw@google.com \
--cc=kaiyuanz@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=sumit.semwal@linaro.org \
--cc=tariqt@nvidia.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