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 5/6] net: propagate busy status on memory provider uninstall
Date: Sun, 06 Dec 2026 00:07:44 +0000 [thread overview]
Message-ID: <179651566429.3148.3695287259978976134@kernel.org> (raw)
In-Reply-To: <20261204231030.3815575-6-almasrymina@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch adds `bool busy` to memory_provider_ops->uninstall()
and documents it as "If @busy is true, closing @rxq failed and…
- [Medium] The commit message describes this as a fix for an older
defect: "netif_rxq_cleanup_unlease() currently discards the return…
--
net: propagate busy status on memory provider uninstall
This patch adds a bool busy argument to memory_provider_ops->uninstall().
netif_rxq_cleanup_unlease() sets it from the __netif_mp_close_rxq()
result. Devmem records failed closes in a new binding->rxq_busy flag and
defers the dma_buf unmap while any queue of the binding failed to close.
> netif_rxq_cleanup_unlease() currently discards the return value of
> __netif_mp_close_rxq(), so memory providers cannot tell whether closing
> a leased queue failed and hardware may still be using the page pool.
[Severity: Medium]
Is this an older defect, or one that came in earlier in this series?
At the baseline, mp_dmabuf_devmem_uninstall() only unmapped behind a lease
guard:
if (!rxq->lease)
net_devmem_dmabuf_binding_unmap(binding);
At that point netif_rxq_cleanup_unlease() passed virt_rxq, whose ->lease
is still set, so the unlease path never unmapped.
Commit c4466d2c3e77 ("net: devmem: unmap dma_buf synchronously on queue
uninstall") added that guard for this case: "except when a leased queue is
unleased: the physical device is still registered and, if restarting its
queue failed, may still be using the binding."
The earlier series patch "net: devmem: resolve leased RX queues to
physical device on bind" did three things:
- dropped the guard
- made the unmap unconditional once bound_rxqs is empty
- switched netif_rxq_cleanup_unlease() to pass phys_rxq
It still ignored the __netif_mp_close_rxq() result.
In that commit, and in "net: devmem: synchronize and unmap all device
bindings on unregister", a failed leased-queue close during unlease
appears to lead to this:
netdev_rx_queue_unlease()
netif_rxq_cleanup_unlease()
__netif_mp_close_rxq() <- netdev_rx_queue_reconfig() fails
__netif_mp_uninstall_rxq(phys_rxq, ...)
mp_dmabuf_devmem_uninstall()
net_devmem_dmabuf_binding_unmap()
dma_buf_unmap_attachment()
dma_buf_unpin()
dma_buf_detach()
The physical RX queue is still running on the old devmem page pool when
this happens.
Could the busy/rxq_busy plumbing be folded into, or placed before, "net:
devmem: resolve leased RX queues to physical device on bind"? Then the
!rxq->lease guard would be replaced in one step, with no bisect window
where DMA can happen after unmap. If not, could the commit message at
least name the series patch that introduced the regression?
> diff --git a/include/net/page_pool/memory_provider.h b/include/net/page_pool/memory_provider.h
> index bceb5f7740e2f..82eac3feefc94 100644
> --- a/include/net/page_pool/memory_provider.h
> +++ b/include/net/page_pool/memory_provider.h
> @@ -26,7 +26,12 @@ struct memory_provider_ops {
> void (*destroy)(struct page_pool *pool);
> int (*nl_fill)(void *mp_priv, struct sk_buff *rsp,
> struct netdev_rx_queue *rxq);
> - void (*uninstall)(void *mp_priv, struct netdev_rx_queue *rxq);
> + /* Called under netdev_lock(rxq->dev) on device unregister or queue
> + * unlease. If @busy is true, closing @rxq failed and hardware may
> + * still be using the page pool.
> + */
> + void (*uninstall)(void *mp_priv, struct netdev_rx_queue *rxq,
> + bool busy);
> };
>
> bool net_mp_niov_set_dma_addr(struct net_iov *niov, dma_addr_t addr);
> diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
> index 20597bfa146d6..ed44835a783b5 100644
> --- a/io_uring/zcrx.c
> +++ b/io_uring/zcrx.c
> @@ -1457,7 +1457,8 @@ static int io_pp_nl_fill(void *mp_priv, struct sk_buff *rsp,
> return 0;
> }
>
> -static void io_pp_uninstall(void *mp_priv, struct netdev_rx_queue *rxq)
> +static void io_pp_uninstall(void *mp_priv, struct netdev_rx_queue *rxq,
> + bool busy)
> {
> struct io_zcrx_ifq *ifq = mp_priv;
>
[Severity: High]
The new comment above says that when busy is true, hardware may still be
using the page pool. io_pp_uninstall() never reads busy, though, and
still unmaps every time:
io_uring/zcrx.c:io_pp_uninstall() {
struct io_zcrx_ifq *ifq = mp_priv;
guard(mutex)(&ifq->pp_lock);
io_zcrx_unmap_areas(ifq);
io_zcrx_drop_netdev(ifq);
}
Can zcrx reach the busy=true path? zcrx_register_netdev() calls
netif_mp_open_rxq(). That function resolves a leased virtual queue to the
physical queue and installs io_uring_pp_zc_ops on phys_rxq.
When the netkit device is then deleted:
netdev_rx_queue_unlease()
netif_rxq_cleanup_unlease()
__netif_mp_close_rxq() <- netdev_rx_queue_reconfig() fails
__netif_mp_uninstall_rxq(phys_rxq, &p, true)
io_pp_uninstall()
io_zcrx_unmap_areas()
__io_zcrx_unmap_area()
The old hardware queue keeps using the zcrx page pool in either failure
case:
- a failure in kvzalloc, ndo_queue_mem_alloc,
page_pool_check_memory_provider or ndo_queue_stop leaves the old
queue untouched
- a start failure restarts the old queue with old_mem
__io_zcrx_unmap_area() then sets each niov DMA address to 0 with
net_mp_niov_set_dma_addr(niov, 0). It also calls dma_unmap_sgtable() or
io_unmap_dmabuf().
None of io_pp_zc_alloc_netmems(), io_zcrx_ring_refill() or
io_zcrx_refill_slow() checks area->is_mapped. Descriptors that were
already posted still point at the unmapped IOVAs.
Could the NIC then DMA into any of these?
- unmapped or reused IOVAs
- freed swiotlb slots
- physical address 0, when there is no IOMMU
io_close_queue() follows the same pattern: it ignores the return value of
netif_mp_close_rxq() and then calls io_zcrx_unmap_areas().
The commit message only says "Existing io_uring/zcrx uninstall behavior
is left unchanged". Should io_pp_uninstall() skip or defer
io_zcrx_unmap_areas() when busy is set, as mp_dmabuf_devmem_uninstall()
now does? If zcrx is meant to stay as it is, could the commit message say
why that is safe, and could the io_uring maintainers be asked about it?
[ ... ]
--
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
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 [this message]
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=179651566429.3148.3695287259978976134@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