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=1796306347; b=MWsAss9dxuTRpM38WxpHbwszVUmeJqrpNBiX0yi68tfNxT7hf1NHDLCIDjZwodkljFOC 9S4e+N4WsPrwXmMpMBkbFhva8aDeKt7qzGrI8JYSMs3UlQcxNaoeebDEu/AdtWu//+CSm 1WnAV/J7WuYDpyMFh8G1rAHSJLpLr0cjeDvBBiaezNimYOrlSPLTI6/U3hUL2o5xfutLS VFLHSB5/Z6teVvCDdZGWQao5NevZshRKB1M+OjWw63mjjG7MOj8ELzw6ehuCzxVXhiQsi SBCk/bpvS9sMEvR2ZwG1mAoxt6J5HbaMIIz7PSxG2WqID8sWcgrXTnjGeh+CkPnf6tQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796306347; 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=iTL0vO7EYdo9tosw/Thg7EKMpx6I6Vb5FgG9sWuxWq4=; b=WkJDgt39V7rVL/X+0bX47aqP20Y12muD4i9jU7LE4qu8gHMUHhp+31ejSEUkgU4HsUSj J7SPjBg7YemRIW0fLCO7uw7/rxbusbRnrRKOeRpskXUte/7v3esgGCelUE++Ubu70VnkH Y8ye8I+cGzvodg5Q9sZbcuZpwyv4yVILrc5rPfpbWslzQlV5t5shGXVBgvj9CLnsOYrjV FE5erNKA9i6B9hAhCZC0biNXAc0OpE5TULFXFCDkedCJaCPcz+GTNhX8sBXsi+cuIXj0N QM55Q21vFA2KowDoYuP+SKViByD1Ws9aTXiCCfVpAwU31wced6Kyfprk5lVNkIZStCg== 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=WcvGyWtR; 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 CB644606A32C; Thu, 3 Dec 2026 13:59:07 +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=WcvGyWtR Received: by smtp.kernel.org (Postfix) with ESMTPSA id 963B21F00893; Thu, 3 Dec 2026 13:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796306347; bh=iTL0vO7EYdo9tosw/Thg7EKMpx6I6Vb5FgG9sWuxWq4=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=WcvGyWtRlWlvfkKmOgwrGsMneMseY/TQsYXYeAyXSFS3kUfU3yu5kYhAY/TYjmOj9 psbx6BM7OHYgh+WTtR/M3bwTktBTU0c/CmRbkzZMVA64iuHXFCDdOmiMgKLl6SDs3E mRUj9IevN73fAFfoP2t066n+tXTeq/+o7voSFQXdBZcK6SvJ4MIB7YYrt16Z38COVB PYQLOOALF0sbVxD+CxcK6VefutENHILtcFP7T28ffcsnAsfqtizo++RI9Sxd+EljxH L0afSAeucsxnquS1BHehHQHFTh4a1HJ0sJx5iudwc0O46B28ertinsGBtBmpuCHm9k YpABqcaQuXC+A== Message-ID: Date: Thu, 3 Dec 2026 14:58:56 +0100 X-Mailing-List: linux-kselftest@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> <20261117161856.6f6c2ce9@kernel.org> Content-Language: en-US From: Jesper Dangaard Brouer In-Reply-To: <20261117161856.6f6c2ce9@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/18/26 01:18, Jakub Kicinski wrote: > On Mon, 16 Nov 2026 23:55:42 +0000 Tianyi Gao wrote: [...] >> On the setup we want to build: an XDP program on the NIC does the >> decap for all traffic. The services run in namespaces, so the packets >> must be delivered into them. Some services attach their own XDP >> program to the veth, and some do not. The host does not control the >> service's program. > > The host doesn't have to control the program, just know whether the > program will be attached, and therefore whether to use TC or XDP. True, the host can know. But TC does not fit our setup, because it builds the skb on the isolated RX CPU. The reason why we avoid that is in [1]. With bpf_redirect_peer() it is even more work: the RX CPU also runs the whole receive path into the netns, up to the socket. bpf_redirect_peer() is great in a micro-benchmark, where one CPU does all the work. In production we handle much more concurrent traffic. There we split the netstack processing into pipeline stages: XDP on the RX CPUs, the skb and the netns stack on other CPUs. This scales to more CPUs. [...] >> In a minimal benchmark, pktgen sends UDP, and perf stat counts the >> cycles on the RX CPU. bpf_redirect_peer() from tc costs 3% more >> cycles per packet than XDP_REDIRECT with the checksum status kept >> (mlx5, one extra __netif_receive_skb_core()). So one XDP_REDIRECT path >> for all namespaces is both simpler and cheaper. > > That's noise. Agreed, but the test measured the wrong thing. veth runs its NAPI on the sending CPU unless NAPI is threaded. So both paths did all the work on the RX CPU, and the test compared two ways to do the same work on one CPU. The number that matters is the cost on the RX CPU, with veth NAPI threaded on a CPU outside the RX set. I will work with Tianyi on a better test that shows this. I answered the rest of your mail in [2]. --Jesper [1] https://lore.kernel.org/all/f4bc8388-e4b9-4451-bbd1-9f5d0a86256f@kernel.org/ [2] https://lore.kernel.org/all/b3e67ffc-5610-4598-9291-ee0264983a4a@kernel.org/