Article View: linux.kernel.netdev
Article #15229Re: [PATCH net-next v1 06/11] page_pool: Coordinate refill with memory providers
From: Björn Töpel
Date: Thu, 12 Nov 2026 14:53
Date: Thu, 12 Nov 2026 14:53
55 lines
11600 bytes
11600 bytes
Stanislav Fomichev <sdf.kernel@gmail.com> writes:
> On 11/11, Björn Töpel wrote:
>> Stanislav Fomichev <sdf.kernel@gmail.com> writes:
>>
>> > On 11/10, Björn Töpel wrote:
>>
>> >> diff --git a/include/net/netdev_rx_queue.h b/include/net/netdev_rx_queue.h
>> >> index 989120cbf452..ca12cbf7b825 100644
>> >> --- a/include/net/netdev_rx_queue.h
>> >> +++ b/include/net/netdev_rx_queue.h
>> >> @@ -33,6 +33,12 @@ struct netdev_rx_queue {
>> >> struct pp_memory_provider_params mp_params;
>> >> /* stamps the page pools of each queue allocation */
>> >> u32 mp_gen;
>> >> + /* NAPI of the running queue, for memory provider wakeups. Set while
>> >> + * mp_armed, and if the provider has a refill_done op. Written under
>> >> + * the ops lock, read under RCU, see netif_mp_wake().
>> >> + */
>> >> + struct napi_struct __rcu *mp_napi;
>> >> + bool mp_armed;
>> >
>> > The comment should explain why mp_napi != napi? (I do not understand why)
>>
>> Fair. It's the same NAPI, with other rules. napi is the driver's
>> association: read under the ops lock, and not cleared when the NAPI is
>> deleted. Provider wakeups run without that lock, from socket syscalls
>> and ->release_netmem().
>>
>> mp_napi is an RCU copy, set only while the device is up and the queue
>> isn't restarting, for providers with ->refill_done(). netif_napi_del()
>> clears it before its grace period. Setting it also schedules the NAPI
>> once, which replays wakeups lost while the queue was stopped. I'll put
>> that in the comment.
>
> And all this only to make sure that we are not recycling something from
> the old pp into the new one? And reworking existing pointer to change/update
> its lifetime is not gonna do it?
No, it's how the provider wakes the queue when chunks show up: userspace
posts FILL and calls {e,}poll() or sendto(), or an old page pool
releases chunks after a restart. It replaces ndo_xsk_wakeup.
But! I think that rxq->napi can do it: make it RCU, clear it when the
NAPI is deleted, and have the driver poll the queue once after enabling
its NAPI, as fbnic does. A wakeup that hits a stopped queue is then
covered by that poll, so mp_napi and mp_armed go (and with them the
error-path bugs Sashiko found...) I'll do that in v2.
Björn
Technical Details
Message-ID:
<87y0ayqexk.fsf@all.your.base.are.belong.to.us>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361956-linux-kernel-netdev=dewy.ruReferences:
<20261110102039.1002605-1-bjorn@kernel.org> <20261110102039.1002605-7-bjorn@kernel.org> <avOtxBw_grmuDJae@devvm16445.scu0.facebook.com> <87tslnrwgt.fsf@all.your.base.are.belong.to.us> <avT2Fj5qjbJkArpg@devvm16445.scu0.facebook.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361956-linux-kernel-netdev=dewy.ru From: bjorn@kernel.org (Björn Töpel) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v1 06/11] page_pool: Coordinate refill with memory providers Date: Thu, 12 Nov 2026 15:53:27 +0100 Organization: Usenet Network Message-ID: <87y0ayqexk.fsf@all.your.base.are.belong.to.us> References: <20261110102039.1002605-1-bjorn@kernel.org> <20261110102039.1002605-7-bjorn@kernel.org> <avOtxBw_grmuDJae@devvm16445.scu0.facebook.com> <87tslnrwgt.fsf@all.your.base.are.belong.to.us> <avT2Fj5qjbJkArpg@devvm16445.scu0.facebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="1111814"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:KcXl+QG1y/EQE0rPX4xfEgUJcV8= sha256:dVopJiCcureDxrQGOOHDCROKcwVEF1rXP7HWKEE64XY= sha1:XtgJJi1+d1SfJReW0QiNG0xYXio= sha256:KyGN5h8MneiEptLggxCNMikjQ39Zo8RDldLwV8RLZkU= 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 4FFA91142AC; Thu, 12 Nov 2026 18:04:02 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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 f4wdNdeY0EdN; Thu, 12 Nov 2026 18:03:59 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-361956-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 C8F5B1142A7; Thu, 12 Nov 2026 18:03:50 +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 951181A5DFB; Thu, 12 Nov 2026 14:53:40 +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=1794495211; b=bk+3KjQ4FyKBqvEp4O+v0dSqRvYpZEhQDYb084E78OLLbTG7CZMj89IxBimTcDYik3+C QuXGEFBRw/u0I58/E5E1a4Wi19cL1WsErOsRMP6Ej+hQIPgY/XAJIC1uwAxqbZXtW4v/X s/TsgHBN11Vm++w8xYGYEvALwR438z26MkiQP0BlHc5f7P5dLp8Ae6BNvABhWhD0EPAsl dw+DCNZAHLnWLt0Ilqqgkz/OGN0ECXXSSp+5zcqaMjHVE2cA6x1W/qasowTrxRrJmSNkr lWNixAEK20DUhnS+z5WM1UylSeub56X+oN7bYT61n2VokIXimBtrN22QFxuKCy7igGw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794495211; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=UBXnliURw1WYp3chrqS7sjRbFTt6XEXbMT1fDo9/1TM=; b=eIGDnqlW4P4u1/2E1L3+kpLgseRnfrqGlO5c+PY80fPbNjR8Qe2UEUaQF3OUZbqwdG0/ sV/swDd1TaXqJm9aLh5lRy0DwBb2vQhC256uCm+0TdBHQZ0j0GupfBB6WqrOFFzo3XH25 JGEu3AAsCCcWhdq+l/oyR5eN61skITUD2NGPxpb3NSQsf3bVZlb3MWcQBk47TSULxdEhl RiKAxqTFEmutqR0BdAQB2wNfwMb70VLawnkUyWSSVAwPEa3qelV070igpaws/S+78Bp+G bqoHRNlbG1JP3/WQJ8//QfwP9TbrT6UWtIhAcg2P0MlfR+DmyDgsGrw9mqLnffjnxjw== 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=BSUSIwfp; 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 D8918606A891; Thu, 12 Nov 2026 14:53:31 +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=BSUSIwfp 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=1794495211; b=Hy7dIJwjwQfOy1jzOZqUlrX22NwAQSHPvmeSi8c/pTYpPj+FYC4yzVK5OWu216JfSTpj xc5vPTceyvCuc9uPM3mfUKU2VpIy9pmkLCDroN5ZffU0or8YYTbwoHdfCuPyJSASbv1ya zb6oURAyMuzU5dE/8Ly/WUmSx9LIsMpER146kB13XXDuUQis0Zk0WDiungV0fG9Jr6Prp phy1n/1fmfOKDMdyWHJRCDma0U/a49P4WcKh3idq/qxMKiRKUL/GUBt5fmBgEmsplZ9Ae AYKu1057xnkLIU8Q/8kO06bpcvSPo68rNIFNNIdpNesQJSAbcsV6wa6COv2oHNdO8Bg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794495211; h=Received:DKIM-Signature:From:To:Cc:Subject:In-Reply-To:References: Date:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=UBXnliURw1WYp3chrqS7sjRbFTt6XEXbMT1fDo9/1TM=; b=k0WkBC8jp8SEp/9JQwXWc5wZ+xPP3RpSlE/VpRP80stzw0WLMQ8XTj9UyRl8qQ7CuEFi ZevJCAohyoJ+xmDseK77juG24UKmPD2MOhgWya/jhtLd0BfX5mmjhvMU1Hm7CQDqXB8Y2 im9swdd4rStxRTU1ZK0/8/8ELR8TTUBWG3MrxLZrQyL4EemXoqs3of7I9MwTTVY5DipnQ wu1ZINpAq40qdW46tCbI5arTKS14Eh7QvpXpNhdsVD4taMUnFmutlPW8V2tMUeboF9amy Ahgu7bQa4dSeff7aaeZGinkqwY1dlppTjweG1Rq3dXTwpBKoUMAExea+Q412pYgm26Q== 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=BSUSIwfp; 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 F3AB5606A321; Thu, 12 Nov 2026 14:53:30 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B67991F00A08; Thu, 12 Nov 2026 14:53:29 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794495210; bh=UBXnliURw1WYp3chrqS7sjRbFTt6XEXbMT1fDo9/1TM=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=BSUSIwfpwBS95bhGX07VGZDkvg5eJbUBRjTovvFvuyyl9O4KKBkRLMpDjQWmkCCv2 14m3/vbC/nnjlVkglV3QPl3riOJFD5UvK39YWhOEfVVmFRUJ6aRnkuKMGk2TlFeMjl fF/cbZbYAcderFGW12psD5gJtpIIDqGl1SFcnrBPY22izW2LGGLEjRj9nv2UFbNeja ikfgKQrbKaFPQxmwodBjYhUvcCNmek0dufRRAc0o9J9WdFqNM4qoL/zLgX4ZpXxN5U f9k4ZswwSCr/tGFWel0B7PdTbQGT86nnmEhWHpnSnsbHTQhx6EGPCoN97SjZQisZGn MibpFZab8bc+w== X-Cc: Magnus Karlsson <magnus.karlsson@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Stanislav Fomichev <sdf@fomichev.me>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>, Shuah Khan <skhan@linuxfoundation.org>, Randy Dunlap <rdunlap@infradead.org>, Alexander Duyck <alexanderduyck@fb.com>, kernel-team@meta.com, Andrew Lunn <andrew+netdev@lunn.ch>, Jesper Dangaard Brouer <hawk@kernel.org>, Ilias Apalodimas <ilias.apalodimas@linaro.org>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, John Fastabend <john.fastabend@gmail.com>, Pavel Begunkov <asml.silence@gmail.com>, Jens Axboe <axboe@kernel.dk>, Andrii Nakryiko <andrii@kernel.org>, Eduard Zingerman <eddyz87@gmail.com>, Kumar Kartikeya Dwivedi <memxor@gmail.com>, Martin KaFai Lau <martin.lau@linux.dev>, Song Liu <song@kernel.org>, Yonghong Song <yonghong.song@linux.dev>, Jiri Olsa <jolsa@kernel.org>, Emil Tsalapatis <emil@etsalapatis.com>, Ihor Solodrai <ihor.solodrai@linux.dev>, netdev@vger.kernel.org, bpf@vger.kernel.org, io-uring@vger.kernel.org, Mina Almasry <almasrymina@google.com>, "Mike Marciniszyn (Meta)" <mike.marciniszyn@gmail.com>, Weiming Shi <bestswngs@gmail.com>, Nikolay Aleksandrov <razor@blackwall.org>, David Wei <dw@davidwei.uk>, Alexander Lobakin <aleksander.lobakin@intel.com>, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Stuart Clark <stuclar@meta.com> X-In-Reply-To: <avT2Fj5qjbJkArpg@devvm16445.scu0.facebook.com> 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