From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B590F1F00A10; Sun, 6 Dec 2026 00:07:44 +0000 (UTC) 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== Subject: Re: [PATCH net-next v5 5/6] net: propagate busy status on memory provider uninstall 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 Date: Sun, 06 Dec 2026 00:07:44 +0000 Message-ID: <179651566429.3148.3695287259978976134@kernel.org> In-Reply-To: <20261204231030.3815575-6-almasrymina@google.com> References: <20261204231030.3815575-6-almasrymina@google.com> X-sashiko-severity: High Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: io-uring@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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