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=1796302260; b=MSmcCgBsMuLW167/tjOdWn6bE7w+7ntNA+E7rkcRQaXrx4c7UqXgeImsZClbywV475xL cm7F0WGbQF8NsEPDpn5l7NpDF5SUzWBQeN8coI7CVyFnQdC7vEj5Fp+9UhaO4GAjyFRpa WRsjWo5fohf+p2ZEYzETLpZ8A6EZ4xGENKnaVXGIJvjFYyuVuCtd5FWc5CvuFc5UbSpOs Ouv/1XhIxUqVZ2pzRZB4JcAOEUz9Iu4zfNSOt+g9quYSkC60Osg+Co/PG2Fo/3PsqIvPt m1R9fGs3UflON56jjUZ+hRrXd2rcNmmlwp+4Xua0A5xFUlHAWQUE0+wkS3AvikJG0bQ== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0FC11F00893; Thu, 3 Dec 2026 12:50:49 +0000 (UTC) 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== Message-ID: Date: Thu, 3 Dec 2026 13:50:48 +0100 X-Mailing-List: bpf@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH bpf-next 00/15] xdp: add SKB core extensions to keep RX metadata until skb creation To: Jakub Kicinski , Tianyi Gao Cc: Stanislav Fomichev , bpf@vger.kernel.org, netdev@vger.kernel.org, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , John Fastabend , Stanislav Fomichev , Lorenzo Bianconi , Vladimir Vdovin , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , Andrew Lunn , Donald Hunter , Eduard Zingerman , Kumar Kartikeya Dwivedi , Song Liu , Yonghong Song , Jiri Olsa , Emil Tsalapatis , Ihor Solodrai , Tony Nguyen , Przemek Kitszel , Maciej Fijalkowski , Alexander Lobakin , Magnus Karlsson , Tushar Vyavahare , Jason Xing , Nikolay Aleksandrov , Madalin Bucur , Ioana Ciornei , Jonathan Corbet , Shuah Khan , Shuah Khan , Randy Dunlap , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Chris J Arges , Jakub Sitnicki , 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 References: <20261115113902.4834dda6@kernel.org> <20261116142710.347e8571@kernel.org> Content-Language: en-US From: Jesper Dangaard Brouer In-Reply-To: <20261116142710.347e8571@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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/