Article View: linux.kernel.netdev
Article #26381Re: [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation
From: Jesper Dangaard Brouer
Date: Thu, 03 Dec 2026 12:50
Date: Thu, 03 Dec 2026 12:50
62 lines
12930 bytes
12930 bytes
On 11/16/26 23:27, Jakub Kicinski wrote:
[...]
>
> The question is _why_ you use it. Let's leave the cpumap case aside,
> you provided no legitimate reason why having an XDP prog in that case
> is a problem. With veth - you are right that attaching XDP causes
> problems for pure skb traffic. For veth cases, however, there's no
> strong reason to delay the skb allocation. Hence my question.
> Why not let the driver allocate the skb if we know that the
> redirect target will need to allocate one, anyway.
>
The reason is the same for cpumap and veth: we do not just delay the
skb allocation, we move it to another CPU.
In our RX-pipeline setup, the RX NAPI CPUs are isolated, and we keep
their number small. They run the NIC XDP prog (DDoS drop, decap, load
balancing), and then XDP_REDIRECT the xdp_frame away. Another CPU
allocates the skb and runs the netstack: the cpumap kthread, or the veth
NAPI threads. We run veth in threaded NAPI mode in production, and we
pin the NAPI threads to CPUs outside the RX set. So an XDP_REDIRECT of
an xdp_frame into veth always moves the skb work off the RX CPU.
If the driver allocates the skb, the isolated RX CPU does the skb
alloc, the receive path, and also the free: TCP and UDP free the skb
with skb_attempt_defer_free(), which sends it back to skb->alloc_cpu.
Keeping memory allocator work off the RX CPUs is the purpose of
redirecting the xdp_frame:
- During a DDoS attack, these CPUs must spend their cycles on XDP_DROP.
- Page frees from the netstack (for example TCP ACKs that free TX skbs)
take the MM zone->lock with IRQs disabled, and stall NAPI behind
other CPUs that drain large batches. We see these stalls on RX CPUs
in production.
> Since your patches are not a natural / clean extension of the existing
> infrastructure - we should step back and make sure the use case is
> practically justified.
We found this gap in production testing of our RX-pipeline setup.
After the cpumap redirect, the skb on the remote CPU has no RX hash,
so GRO cannot spread the flows over its buckets. veth in threaded NAPI
mode, which we already run in production, has the same gap. There the
lost csum status also makes the netstack verify every checksum in
software. In both cases the skb is built from the xdp_frame on a
remote CPU, and the RX hash and csum status are lost on the way.
On "natural extension": this adds infrastructure that XDP is missing.
An XDP prog can change the packet (decap, VLAN), but it cannot tell
the kernel which HW offload info it changed. You called the stale csum
after a decap "a known bug" [1]. The kernel lists the same gap: the
"currently missing" comment in __xdp_build_skb_from_frame(), and the
"In the future" note in xdp-rx-metadata.rst. The open question is the
API, which I answered in [2].
--Jesper
[1] https://lore.kernel.org/all/20260722113525.34092660@kernel.org/
[2]
https://lore.kernel.org/all/b3e67ffc-5610-4598-9291-ee0264983a4a@kernel.org/
Technical Details
Message-ID:
<f4bc8388-e4b9-4451-bbd1-9f5d0a86256f@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376607-linux-kernel-netdev=dewy.ruReferences:
<cover.1794281983.git.tianyi@cloudflare.com> <avOvI8xrHI0dwyHj@devvm16445.scu0.facebook.com> <CAG4wq-egD55NZDw+OKVKTKN2tQJ9oKEC504wFv=xoMXyJ-0z4g@mail.gmail.com> <20261115113902.4834dda6@kernel.org> <CAG4wq-dhd5a5zxQcSShaKifYd2z+pMpHaCYtZJRX1QCxEH4dfg@mail.gmail.com> <20261116142710.347e8571@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376607-linux-kernel-netdev=dewy.ru From: hawk@kernel.org (Jesper Dangaard Brouer) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation Date: Thu, 3 Dec 2026 13:50:48 +0100 Organization: Usenet Network Message-ID: <f4bc8388-e4b9-4451-bbd1-9f5d0a86256f@kernel.org> References: <cover.1794281983.git.tianyi@cloudflare.com> <avOvI8xrHI0dwyHj@devvm16445.scu0.facebook.com> <CAG4wq-egD55NZDw+OKVKTKN2tQJ9oKEC504wFv=xoMXyJ-0z4g@mail.gmail.com> <20261115113902.4834dda6@kernel.org> <CAG4wq-dhd5a5zxQcSShaKifYd2z+pMpHaCYtZJRX1QCxEH4dfg@mail.gmail.com> <20261116142710.347e8571@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="2493043"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ytSQSIWCGSIfDfohza99gUn0prQ= sha256:G/bjCbq0iuT9gM3XDFCRz54Nmn2ysQ8o9KdaflTjlSQ= sha1:7QJGXyslGa3ZfxdsF0YEmdjvzIc= sha256:AgXj1JJCToBxKgO9a5CsAVUuejt21fFoUwCiJp/Elrc= Content-Language: en-US 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 EC291117947; Thu, 3 Dec 2026 15:51:17 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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 LkOLLLOgKeHK; Thu, 3 Dec 2026 15:51:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376607-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 CB118117942; Thu, 3 Dec 2026 15:51:04 +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 C3D1C29D0D; Thu, 3 Dec 2026 12:51:02 +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=1796302260; b=oN2kA0KmUBmWhQhBcwCLu1Z69D3HP0FPYFTjVxnH0cUMg9UhRDOPiCfFbjZYeVdjvG+t 0XWcpf0sZKQsXnLN4BcVLdDgQLWKCQ+AuB4Z+5t1RzyVbITY+utLCX8VrNxKHlMmEArZh X3ktN0W6wvGxnRBdzxACP8h0cjNRpQa47vAYSp1KlWsVXxrBDi29FiBkUMUbmtmtN/R8v mNTJZ+ZnGv9UKA+K64k4GGc0JxqL/2WMNfKbCBXTddc0rPDw1jgnXC0hLYGVFODgK3r8Y LiFC8s/2QNHyswCnWTpYtbdS8qQA1zRcnRJcl+b+AEQGa/YnaX4nxmd5YoN+FjUGohA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796302260; h=X-Original-To:Received:Received:DKIM-Signature:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=hwylzoMhorBfryCl1vhJiSGKfIwPP02z4A6pGui1rx4=; b=xm9/lPNPWNawMMHDzK/naZBkqmQHmSdn5OaFtCVl29WIElzhYDw3YTxaREip52ow0Wfw 5XxanCT48XUMFGMhSlsPSrtKC5O8nUiYVc/5gDloYo0jWYc6/AIeY4CQ10C92nRDr4fNj E4fqnl4HVj8YbvjsOh+Cx+cxjo7ME5w9ywLBN3HDkFgLH4HtX3VLOSyWdH1oiYt0vGVy8 vM6s/i9uQAP3wZIKvlb5m8/5cnY4+KiXGuMP4l1bMrFi/ploLN7obw9uCIhHkMbYQ5rga AQh0V5E/Mlmi22YziZzoT08vCNiceKUENb2yjWcOPtbgrlKOvj+17bIBJrf02QmmJHw== 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=QO8uiKWN; 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 D620C606A683; Thu, 3 Dec 2026 12:51:00 +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=QO8uiKWN 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=1796302260; b=MSmcCgBsMuLW167/tjOdWn6bE7w+7ntNA+E7rkcRQaXrx4c7UqXgeImsZClbywV475xL cm7F0WGbQF8NsEPDpn5l7NpDF5SUzWBQeN8coI7CVyFnQdC7vEj5Fp+9UhaO4GAjyFRpa WRsjWo5fohf+p2ZEYzETLpZ8A6EZ4xGENKnaVXGIJvjFYyuVuCtd5FWc5CvuFc5UbSpOs Ouv/1XhIxUqVZ2pzRZB4JcAOEUz9Iu4zfNSOt+g9quYSkC60Osg+Co/PG2Fo/3PsqIvPt m1R9fGs3UflON56jjUZ+hRrXd2rcNmmlwp+4Xua0A5xFUlHAWQUE0+wkS3AvikJG0bQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796302260; h=Received:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=hwylzoMhorBfryCl1vhJiSGKfIwPP02z4A6pGui1rx4=; b=idl4Tp6k0z5BcDFbqdRpZ2UTXTFMZnwVquK1nmXXvr0wop6L8YJxSkzVv0IHlXkiaOl8 kM+LlJfJcOv7xiq+uknTbCMminjjGRLagOlQPOX2/n+6EN09/9migGABcV7ne+RrdBwCt 7k8GTSl57Elmtt21BDOhUZ5uiotY0+Ykii4guPc/LmbUZDp6uTgqNfwM1AxiRM8q79aea ttWIRgA+wW8U4zdDgYlAE1U1felqGbEUG6F/44U1pPzJYqU2d1XCsLys0r9tmdMy92c2I e+2/Zsyu1iZKYp5E0WQzFZZhIM9guy4yn0pkuS7vQMcv9BdilPhO/876FF5T8BK/9Iw== 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=QO8uiKWN; 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 F1D2F606A32F; Thu, 3 Dec 2026 12:50:59 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0FC11F00893; Thu, 3 Dec 2026 12:50:49 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796302259; bh=hwylzoMhorBfryCl1vhJiSGKfIwPP02z4A6pGui1rx4=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=QO8uiKWNrcaAt0H9pDlJ/+yvEhy2w07wkfUHg/Y2FUnFAj4QTHpjpYpOOBDzA5hGf NVVsQMH2CR7+FEwCF4cCOf4gmfIKGdQBrshUDlG2GndxQYhKzu24s/Gi7MZvySWcVW mO7QnJYkWfC+WgwKNCqeUX6I6CuUJEm1DcUc230xhHpTD9YGuoT5V7Eg933gqRpcu4 uOpRzMpOzRr7PTdQKffCHzTWBdlWQyjCe9daG+k5tdPmhjMbh1mZGj+kQw3aAEUsuU xLWj9cds5efWxJDX0mi5zIJeVCRIbFdFGZtQxvhb1wdE3y9v2I6LFbQrqqnSN0/2UZ CsDjZnY1dQEcw== 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 X-User-Agent: Mozilla Thunderbird X-Cc: Stanislav Fomichev <sdf.kernel@gmail.com>, bpf@vger.kernel.org, netdev@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <martin.lau@linux.dev>, John Fastabend <john.fastabend@gmail.com>, Stanislav Fomichev <sdf@fomichev.me>, Lorenzo Bianconi <lorenzo@kernel.org>, Vladimir Vdovin <deliran@verdict.gg>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Andrew Lunn <andrew+netdev@lunn.ch>, Donald Hunter <donald.hunter@gmail.com>, Eduard Zingerman <eddyz87@gmail.com>, Kumar Kartikeya Dwivedi <memxor@gmail.com>, 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>, Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Alexander Lobakin <aleksander.lobakin@intel.com>, Magnus Karlsson <magnus.karlsson@intel.com>, Tushar Vyavahare <tushar.vyavahare@intel.com>, Jason Xing <kerneljasonxing@gmail.com>, Nikolay Aleksandrov <razor@blackwall.org>, Madalin Bucur <madalin.bucur@nxp.com>, Ioana Ciornei <ioana.ciornei@nxp.com>, Jonathan Corbet <corbet@lwn.net>, Shuah Khan <skhan@linuxfoundation.org>, Shuah Khan <shuah@kernel.org>, Randy Dunlap <rdunlap@infradead.org>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Bill Wendling <morbo@google.com>, Justin Stitt <justinstitt@google.com>, Chris J Arges <carges@cloudflare.com>, Jakub Sitnicki <jakub@cloudflare.com>, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, intel-wired-lan@lists.osuosl.org, llvm@lists.linux.dev, kernel-team@cloudflare.com, Tianyi Gao <tianyi.gao@linux.dev> X-In-Reply-To: <20261116142710.347e8571@kernel.org>