Article View: linux.kernel.netdev
Article #27555Re: [PATCH net-next v5 5/6] net: propagate busy status on memory provider uninstall
From: netdev-bot+sashiko
Date: Sun, 06 Dec 2026 00:07
Date: Sun, 06 Dec 2026 00:07
174 lines
14892 bytes
14892 bytes
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
Technical Details
Message-ID:
<179651566429.3148.3695287259978976134@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378190-linux-kernel-netdev=dewy.ruReferences:
<20261204231030.3815575-6-almasrymina@google.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378190-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev 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 Organization: Usenet Network Message-ID: <179651566429.3148.3695287259978976134@kernel.org> References: <20261204231030.3815575-6-almasrymina@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3148374"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:lzg0bfL8/4gp3IElhZ6TEREWFYs= sha256:sAik4K5LyUxeooKx+Zwhc9Qlool1iI1LYENy2FLnhpk= sha1:E6QHzzfBY1qOuY9NtIPzFcD91vs= sha256:n9YLaFwzhaP5SRNdmo/rcYn0325kxgPxn5j5nUnIA+E= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id BA526117F00; Sun, 6 Dec 2026 03:08:18 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.54 X-Spam-Status: No, score=-3.54 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M0xsi-FCWBC7; Sun, 6 Dec 2026 03:08:16 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378190-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id B7BD6117E93; Sun, 6 Dec 2026 03:08:07 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 66B6F34685; Sun, 6 Dec 2026 00:07:52 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796515672; b=uzSWjpohHUANwoegRzMknl6dPDNO0RI3bjaUJy2B1jHvAy2/Fx6cZzt8nTkyjXeqHuqt 5Pz6/p5sMW4GhxEkuCxYjhQN7lnzuXDQVYLLI3hiwGFP53aU0qRCYJpCJPFqWxv0u9Mvo S8r/zPz2w/XvgUEZiiwglanZZA5TKuzN2K2P+vXRmriAlzR1U7NU+6yTa4sSKaNvk+Stk CyxS459B/ZNfkcHS3709Z4zfkdVIbDJ3ShT+y3dENvRSzyoXibnyrzrQdtwWqrc/gQRXV Qg6ROvuN4lPjLtiWBtR6AuqMcexVGyGKBeQAXnmhw43StZDH1Bu2zfYjXQL5sQvakiw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796515672; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=UGPhK0SqeW+wSfwXGqayUdl3ORvUuqc5/J6mm0626Ts=; b=4ixz2mEkRrS6nGZkuGI/0xfkT7yT7reFIHOJLra85gi2h7qEDOqlGgtJwEPZf2y1liEt 32xte0FuQcyco/T1oLteol7Ss3Yu9QlBBoOCZvkzxRmW/8B2efeODyFKILHrvaB2mhilc 4/FREo94PhVozbTYFfLQQezakJ0cnsC2WYLgEb5KLzt82kTjOzZazxvWW9DHITcIxbVfQ OnrjQuPSGWVgFzV1HUhUNK7iBTMQnTF7j/+HrgMdPWZSnkmPessoN0kgCjouqls8DPt1V Pt5FUaeeuhaq64+dS+gHWK1W2vQ5/mM1Qr3dOKPCCoa9lwmOoA22bw9gM37k+di5s8Q== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WYyxDPNY; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B96E606A339; Sun, 6 Dec 2026 00:07:52 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WYyxDPNY X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796515666; b=sKr02lc361Yt/4A3lYYMEd62MRC4iEWMGzoJMJ92GCnN/3Iw8jVJLwMuXSqpDgI56F5S Jnva/9I0j0oqRbFwLTcxLl6nlXIYSeROVFIVNFTJubnf2GHX9EuPfMzVA5T7vqVzlcLNJ i06WPdMjrJpjFV5DLgBcwDxTHR3WiR9ZncZ0B8fmiI7j+HstewZXTE98Y2VOfdZcJjjJ6 TeHnHDxjWVg+v2e5jGG9HYX8eIvw6zen8bu05Bh8V0b1eUIK3htA2t0KhlEzwvZjMol76 Ap3VnNiN8VlkxKijKA77sPAUKSRdWaSlCrUg2XcEWkzR0JLPrrtoCIee96h1wLr31ew== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796515666; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=UGPhK0SqeW+wSfwXGqayUdl3ORvUuqc5/J6mm0626Ts=; b=4ikLbNAFyKgOXiNYYin8wxFRS6W3BDkyuUwmy8HVXXxdtpYBOPEClykKkB3ZpLnmvGG3 gCHf3DSjokw5QU0STdB+ZANglTzMxQqe2iXAZc6Ju2f0fgZEvmmtR7/dmbKCM35/oaDnR uWV25jMka6BUFnAqy4e39ISEfq6yHUcJrwATnKvDIWhCOQyEwdMacjOfBqGltJCEgDpgv LjnZLXzoFUTvIaJ/ItCwhIuEzQA6RU99PU5d+cQa420Be3LTTVwSSCa9YGutLKVpZ7Fk5 NHeahkCd/EPcoJXPj6PQWceT4mDFD3EISsNfT2585kP2QvawWdFwAa0oi1tFNAAxvbQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WYyxDPNY; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C721606A332; Sun, 6 Dec 2026 00:07:46 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B590F1F00A10; Sun, 6 Dec 2026 00:07:44 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796515665; bh=UGPhK0SqeW+wSfwXGqayUdl3ORvUuqc5/J6mm0626Ts=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=WYyxDPNYHwu0yPjDDLScMtj7huV8QK9jZvayJWC2w2sLpHfKWjowutiFuP2g07Tzh c+D/G1Bqj3NPg08GG6kXv/KqHLoPpFbhUSuPNXP3Jp9wXAJX+Td75VicPLz4nGsV3Q 14VwyReosQaV9Bf39rDAtKEf+0q8L53QeEeIl2xYfNubQF8C2LYfqknhjbpFPmZmFf EyLP7kztmukDsuJ8MVTJI1gYd4rsmJ36jLyvrRmO/UPtwpu4QsfUuJVEErMvVM5GBg NvqdlYyESv1FAMh+TwCLG2h2cwhu9YyKK59+XK4XGUXFfLqzN7/kcaoiVp4nS2l95N bDu+ErWQDBBrA== X-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 X-In-Reply-To: <20261204231030.3815575-6-almasrymina@google.com> X-sashiko-severity: High X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list