From: netdev-bot+sashiko@kernel.org
To: almasrymina@google.com
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, willemb@google.com,
horms@kernel.org, shuah@kernel.org,
linux-kselftest@vger.kernel.org, sdf.kernel@gmail.com,
bobbyeshleman@meta.com, razor@blackwall.org,
daniel@iogearbox.net, dw@davidwei.uk, asml.silence@gmail.com,
axboe@kernel.dk, bestswngs@gmail.com, io-uring@vger.kernel.org,
hawk@kernel.org, ilias.apalodimas@linaro.org
Subject: Re: [PATCH net-next v5 1/6] net: guard leased queue ops against physical netdev unregister
Date: Sun, 06 Dec 2026 00:07:39 +0000 [thread overview]
Message-ID: <179651565922.3148.7652510579542585203@kernel.org> (raw)
In-Reply-To: <20261204231030.3815575-2-almasrymina@google.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit fixes concrete teardown races in recently merged
queue-lease code but carries no Fixes: tag.
- [Low] The patch reports one condition, "physical lessor device has
entered unregistration", with different user-visible errors depending…
--
net: guard leased queue ops against physical netdev unregister
This adds netdev_lock_if_alive(), which takes the instance lock and fails
if the device has entered unregistration. It is used when descending from
a leasing virtual device to the physical lessor in netif_mp_open_rxq(),
netdev_queue_get_dma_dev() and netdev_nl_bind_tx_doit().
__netif_mp_close_rxq() now clears mp_params without reconfiguring the
queue once the device is no longer alive.
> These races were identified by code inspection while adding leased-queue
> unregister support for devmem; they have not been observed in production
> or tested on real hardware. Verified with netdevsim and netkit selftests
> in nl_netdev.py and nk_qlease.py.
>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
[Severity: Low]
Should this carry Fixes: tags? It repairs teardown races in recently
merged queue-lease code, and without the tags stable and backport tooling
won't pick it up for kernels that already ship queue leasing.
Going by blame on the lines being changed, the candidates look like:
Fixes: 5602ad61ebee ("net: Proxy netif_mp_{open,close}_rxq for leased queues")
Fixes: 222b5566a02d ("net: Proxy netdev_queue_get_dma_dev for leased queues")
Fixes: 1abe839b34ae ("net: devmem: support TX over NETMEM_TX_NO_DMA devices")
The unguarded netdev_lock() calls in netif_mp_open_rxq() and
netdev_queue_get_dma_dev() were also reworked by 581d28606cdd ("net:
remove the netif_get_rx_queue_lease_locked() helpers").
[ ... ]
> diff --git a/net/core/netdev-genl.c b/net/core/netdev-genl.c
> index d2ccb1090496d..87dac9c5e84c3 100644
> --- a/net/core/netdev-genl.c
> +++ b/net/core/netdev-genl.c
> @@ -1253,8 +1253,18 @@ int netdev_nl_bind_tx_doit(struct sk_buff *skb, struct genl_info *info)
> goto err_unlock_netdev;
> }
>
> - if (bind_dev != netdev)
> - netdev_lock(bind_dev);
> + if (bind_dev != netdev) {
> + if (!netdev_lock_if_alive(bind_dev)) {
> + err = -ENODEV;
> + NL_SET_ERR_MSG(info->extack,
> + "Device is being unregistered");
> + goto err_unlock_netdev;
> + }
> + if (!netif_device_present(bind_dev)) {
> + err = -ENODEV;
> + goto err_unlock_bind_dev;
> + }
> + }
>
> dma_dev = netdev_queue_get_dma_dev(bind_dev, 0, NETDEV_QUEUE_TYPE_TX);
>
> diff --git a/net/core/netdev_queues.c b/net/core/netdev_queues.c
> index 27cb6397bdd4e..c796957c07f4b 100644
> --- a/net/core/netdev_queues.c
> +++ b/net/core/netdev_queues.c
> @@ -50,7 +50,8 @@ struct device *netdev_queue_get_dma_dev(struct net_device *dev,
>
> hw_rxq = __netif_get_rx_queue(dev, idx)->lease;
>
> - netdev_lock(hw_rxq->dev);
> + if (!netdev_lock_if_alive(hw_rxq->dev))
> + return NULL;
[Severity: Low]
When the lessor is dying, netdev_queue_get_dma_dev() now returns NULL.
Callers already read NULL as "no DMA capable device". Does that hide the
real error from io_uring zcrx?
io_uring/zcrx.c:zcrx_register_netdev() {
...
ifq->dev = netdev_queue_get_dma_dev(ifq->netdev, if_rxq, NETDEV_QUEUE_TYPE_RX);
if (!ifq->dev) {
ret = -EOPNOTSUPP;
goto netdev_put_unlock;
}
...
}
This path holds only the netkit instance lock, not RTNL. A zcrx
registration on a netkit leased queue can therefore land in the window
between the physical device being set to NETREG_UNREGISTERING and the
cascaded netkit unlease. In that case it fails with -EOPNOTSUPP.
It never reaches netif_mp_open_rxq(), which this patch makes report the
same condition as -ENODEV with "Device is being unregistered".
The netif_device_present(bind_dev) check added to
netdev_nl_bind_tx_doit() above also returns -ENODEV without an extack
message. The ifindex the user passed is the netkit device, which still
exists. Would an extack message help there, since the device that went
away is one the user never named?
At this commit, bind-rx also turns the new NULL into -EOPNOTSUPP "Device
doesn't support DMA" via net_devmem_bind_dmabuf(). A later patch in this
series, "net: devmem: resolve leased RX queues to physical device on
bind", appears to fix that part. It routes bind-rx through
netdev_nl_resolve_rx_phys(), which returns -ENODEV "Device is being
unregistered". Both the zcrx -EOPNOTSUPP mapping and the missing bind-tx
extack are still there at the end of the series.
> idx = get_netdev_rx_queue_index(hw_rxq);
> dma_dev = __netdev_queue_get_dma_dev(hw_rxq->dev, idx);
> netdev_unlock(hw_rxq->dev);
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204231030.3815575-1-almasrymina%40google.com
next prev parent reply other threads:[~2026-12-06 0:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 23:10 [PATCH net-next v5 0/6] net: devmem: support leased RX and TX queues on netdev unregister Mina Almasry
2026-12-04 23:10 ` [PATCH net-next v5 1/6] net: guard leased queue ops against physical " Mina Almasry
2026-12-06 0:07 ` netdev-bot+sashiko [this message]
2026-12-04 23:10 ` [PATCH net-next v5 2/6] net: devmem: fold net_devmem_lookup_dmabuf() into net_devmem_get_binding() Mina Almasry
2026-12-04 23:10 ` [PATCH net-next v5 3/6] net: devmem: resolve leased RX queues to physical device on bind Mina Almasry
2026-12-06 0:07 ` netdev-bot+sashiko
2026-12-04 23:10 ` [PATCH net-next v5 4/6] net: devmem: synchronize and unmap all device bindings on unregister Mina Almasry
2026-12-06 0:07 ` netdev-bot+sashiko
2026-12-04 23:10 ` [PATCH net-next v5 5/6] net: propagate busy status on memory provider uninstall Mina Almasry
2026-12-06 0:07 ` netdev-bot+sashiko
2026-12-04 23:10 ` [PATCH net-next v5 6/6] selftests: net: add leased devmem RX and TX netdev unregister tests Mina Almasry
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=179651565922.3148.7652510579542585203@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=almasrymina@google.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=bestswngs@gmail.com \
--cc=bobbyeshleman@meta.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=io-uring@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=sdf.kernel@gmail.com \
--cc=shuah@kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox