BPF List
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: "Björn Töpel" <bjorn@kernel.org>
Cc: Magnus Karlsson <magnus.karlsson@intel.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Alexei Starovoitov <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Andrii Nakryiko <andrii@kernel.org>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Kumar Kartikeya Dwivedi <memxor@gmail.com>,
	Shuah Khan <shuah@kernel.org>, <netdev@vger.kernel.org>,
	<bpf@vger.kernel.org>, "Simon Horman" <horms@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>,
	"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>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Larysa Zaremba <larysa.zaremba@intel.com>,
	Tushar Vyavahare <tushar.vyavahare@intel.com>,
	Jason Xing <kerneljasonxing@gmail.com>,
	"Bastien Curutchet" <bastien.curutchet@bootlin.com>,
	Colin Ian King <colin.i.king@gmail.com>,
	<intel-wired-lan@lists.osuosl.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH net 3/3] selftests/bpf: Drop the zero-copy tailroom from the xsk tests
Date: Fri, 27 Nov 2026 16:49:30 +0100	[thread overview]
Message-ID: <awmmhuuailYkTtLu@boxer> (raw)
In-Reply-To: <20261127142131.3527737-4-bjorn@kernel.org>

On Fri, Nov 27, 2026 at 03:21:29PM +0100, Björn Töpel wrote:
> The xsk tests take the size of the shared info off the UMEM headroom
> of RX_DROPPED and off the growth of XDP_ADJUST_TAIL_GROW_MULTI_BUFF,
> as zero-copy multi-buffer pools kept it at the end of each chunk.
> 
> The previous patch moves the shared info into the buffer pool, so the
> UMEM headroom limit and the frame size no longer leave room for it.
> Drop it from both tests.
> 
> Signed-off-by: Björn Töpel <bjorn@kernel.org>
> ---
>  tools/testing/selftests/bpf/prog_tests/test_xsk.c | 10 ++++------
>  tools/testing/selftests/bpf/prog_tests/test_xsk.h |  2 --
>  tools/testing/selftests/bpf/prog_tests/xsk.c      | 13 +------------
>  tools/testing/selftests/bpf/xskxceiver.c          | 15 +--------------

This is based on old xskxceiver location, would it be better to have this
one send to -next out of this set? I assume the move might not have been
back-propagated yet...so seems we would have to double the effort?

>  4 files changed, 6 insertions(+), 34 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> index 4549358cc8c2..7145a36e6ea2 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c
> @@ -1984,17 +1984,16 @@ int testapp_headroom(struct test_spec *test)
>  int testapp_stats_rx_dropped(struct test_spec *test)
>  {
>  	struct xsk_umem_info *umem = test->ifobj_rx->xsk->umem;
> -	u32 umem_tr = test->ifobj_tx->umem_tailroom;
>  
>  	if (test->mode == TEST_MODE_ZC) {
>  		ksft_print_msg("Can not run RX_DROPPED test for ZC mode\n");
>  		return TEST_SKIP;
>  	}
>  
> -	if (pkt_stream_replace_half(test, (MIN_PKT_SIZE * 3) + umem_tr, 0))
> +	if (pkt_stream_replace_half(test, MIN_PKT_SIZE * 4, 0))
>  		return TEST_FAILURE;
>  	umem->frame_headroom = umem->frame_size -
> -		XDP_PACKET_HEADROOM - (MIN_PKT_SIZE * 2) - umem_tr;
> +		XDP_PACKET_HEADROOM - MIN_PKT_SIZE * 3;
>  	if (pkt_stream_receive_half(test))
>  		return TEST_FAILURE;
>  	test->ifobj_rx->validation_func = validate_rx_dropped;
> @@ -2592,12 +2591,11 @@ int testapp_adjust_tail_grow_mb(struct test_spec *test)
>  	 * pkt_len, expect that it will be broken down to 2 descs each
>  	 * with 3k payload;
>  	 *
> -	 * 4k is truesize, 3k payload, 256 HR, 320 TR;
> +	 * 4k is truesize, 3k payload, 256 HR;
>  	 */
>  	grow_size = XSK_UMEM__MAX_FRAME_SIZE -
>  		    XSK_UMEM__LARGE_FRAME_SIZE -
> -		    XDP_PACKET_HEADROOM -
> -		    test->ifobj_tx->umem_tailroom;
> +		    XDP_PACKET_HEADROOM;
>  	test->mtu = MAX_ETH_JUMBO_SIZE;
>  
>  	return testapp_adjust_tail(test, grow_size, XSK_UMEM__LARGE_FRAME_SIZE * 2);
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.h b/tools/testing/selftests/bpf/prog_tests/test_xsk.h
> index 03753ddc5dcd..1b816226597b 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.h
> +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.h
> @@ -32,7 +32,6 @@
>  #define USLEEP_MAX			10000
>  
>  #define MAX_SKB_FRAGS_PATH "/proc/sys/net/core/max_skb_frags"
> -#define SMP_CACHE_BYTES_PATH "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size"
>  
>  extern bool opt_verbose;
>  #define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while (0)
> @@ -137,7 +136,6 @@ struct ifobject {
>  	int mtu;
>  	u32 bind_flags;
>  	u32 xdp_zc_max_segs;
> -	u32 umem_tailroom;
>  	u32 max_skb_frags;
>  	bool tx_on;
>  	bool rx_on;
> diff --git a/tools/testing/selftests/bpf/prog_tests/xsk.c b/tools/testing/selftests/bpf/prog_tests/xsk.c
> index 772f3dd7ce64..b3758b9bf2ec 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xsk.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xsk.c
> @@ -62,7 +62,7 @@ int configure_ifobj(struct ifobject *tx, struct ifobject *rx)
>  
>  static void test_xsk(const struct test_spec *test_to_run, enum test_mode mode)
>  {
> -	u32 max_frags, umem_tailroom, cache_line_size;
> +	u32 max_frags;
>  	struct ifobject *ifobj_tx, *ifobj_rx;
>  	struct test_spec test;
>  	int ret;
> @@ -85,10 +85,6 @@ static void test_xsk(const struct test_spec *test_to_run, enum test_mode mode)
>  		ifobj_tx->set_ring.default_rx = ifobj_tx->ring.rx_pending;
>  	}
>  
> -	cache_line_size = read_procfs_val(SMP_CACHE_BYTES_PATH);
> -	if (!cache_line_size)
> -		cache_line_size = 64;
> -
>  	max_frags = read_procfs_val(MAX_SKB_FRAGS_PATH);
>  	if (!max_frags)
>  		max_frags = 17;
> @@ -96,13 +92,6 @@ static void test_xsk(const struct test_spec *test_to_run, enum test_mode mode)
>  	ifobj_tx->max_skb_frags = max_frags;
>  	ifobj_rx->max_skb_frags = max_frags;
>  
> -	/* 48 bytes is a part of skb_shared_info w/o frags array;
> -	 * 16 bytes is sizeof(skb_frag_t)
> -	 */
> -	umem_tailroom = ALIGN(48 + (max_frags * 16), cache_line_size);
> -	ifobj_tx->umem_tailroom = umem_tailroom;
> -	ifobj_rx->umem_tailroom = umem_tailroom;
> -
>  	if (!ASSERT_OK(init_iface(ifobj_rx, worker_testapp_validate_rx), "init RX"))
>  		goto delete_rx;
>  	if (!ASSERT_OK(init_iface(ifobj_tx, worker_testapp_validate_tx), "init TX"))
> diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> index 7dad8556a722..a385464cfaf8 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.c
> +++ b/tools/testing/selftests/bpf/xskxceiver.c
> @@ -334,7 +334,7 @@ static void print_tests(void)
>  int main(int argc, char **argv)
>  {
>  	const size_t total_tests = ARRAY_SIZE(tests) + ARRAY_SIZE(ci_skip_tests);
> -	u32 cache_line_size, max_frags, umem_tailroom;
> +	u32 max_frags;
>  	struct pkt_stream *rx_pkt_stream_default;
>  	struct pkt_stream *tx_pkt_stream_default;
>  	struct ifobject *ifobj_tx, *ifobj_rx;
> @@ -356,12 +356,6 @@ int main(int argc, char **argv)
>  
>  	setlocale(LC_ALL, "");
>  
> -	cache_line_size = read_procfs_val(SMP_CACHE_BYTES_PATH);
> -	if (!cache_line_size) {
> -		ksft_print_msg("Can't get SMP_CACHE_BYTES from system, using default (64)\n");
> -		cache_line_size = 64;
> -	}
> -
>  	max_frags = read_procfs_val(MAX_SKB_FRAGS_PATH);
>  	if (!max_frags) {
>  		ksft_print_msg("Can't get MAX_SKB_FRAGS from system, using default (17)\n");
> @@ -370,13 +364,6 @@ int main(int argc, char **argv)
>  	ifobj_tx->max_skb_frags = max_frags;
>  	ifobj_rx->max_skb_frags = max_frags;
>  
> -	/* 48 bytes is a part of skb_shared_info w/o frags array;
> -	 * 16 bytes is sizeof(skb_frag_t)
> -	 */
> -	umem_tailroom = ALIGN(48 + (max_frags * 16), cache_line_size);
> -	ifobj_tx->umem_tailroom = umem_tailroom;
> -	ifobj_rx->umem_tailroom = umem_tailroom;
> -
>  	parse_command_line(ifobj_tx, ifobj_rx, argc, argv);
>  
>  	if (opt_print_tests) {
> -- 
> 2.56.1
> 

  reply	other threads:[~2026-11-27 15:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 14:21 [PATCH net 0/3] xsk: Keep the shared info of zero-copy buffers in kernel memory Björn Töpel
2026-11-27 14:21 ` [PATCH net 1/3] libeth: xsk: Count each XDP_TX buffer on its own Björn Töpel
2026-11-27 14:21 ` [PATCH net 2/3] xsk: Keep the shared info of zero-copy buffers in kernel memory Björn Töpel
2026-11-27 14:21 ` [PATCH net 3/3] selftests/bpf: Drop the zero-copy tailroom from the xsk tests Björn Töpel
2026-11-27 15:49   ` Maciej Fijalkowski [this message]
2026-11-27 16:56     ` Björn Töpel
2026-11-27 14:24 ` [PATCH net 0/3] xsk: Keep the shared info of zero-copy buffers in kernel memory netdev-bot+sinfo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awmmhuuailYkTtLu@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrii@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bastien.curutchet@bootlin.com \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=colin.i.king@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=emil@etsalapatis.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=ihor.solodrai@linux.dev \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=magnus.karlsson@intel.com \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tushar.vyavahare@intel.com \
    --cc=willemb@google.com \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox