Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: maciej.fijalkowski@intel.com
Cc: netdev@vger.kernel.org, magnus.karlsson@intel.com,
	stfomichev@gmail.com, kuba@kernel.org, pabeni@redhat.com,
	tushar.vyavahare@intel.com, kerneljasonxing@gmail.com,
	bjorn@kernel.org
Subject: Re: [PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE
Date: Mon, 23 Nov 2026 18:46:32 +0000	[thread overview]
Message-ID: <179545959251.3135.2838051579849778301@kernel.org> (raw)
In-Reply-To: <20261119164636.1071385-3-maciej.fijalkowski@intel.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message and the new code comment describe the wrong
  failure mechanism, and the wrong threshold, for the batch cap.
- [Low] The patch fixes HW_SW_MAX_RING_SIZE failures that can be hit on
  the current code, but it has no Fixes: tag.
- [Low] Two comments in testapp_hw_sw_max_ring_size() do not match the
  new batch-size computation.

--

selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE

This sizes the TX UMEM in testapp_hw_sw_max_ring_size() the same way as
the RX UMEM: 8k frames, plus 8k fill and completion rings. That lets the
test work with two interfaces, where TX has its own UMEM. It also caps
the second-step batch at min(tx_max_pending, 8192) - 8, and skips the
case when the HW TX ring has 8 or fewer descriptors.

> diff --git a/tools/testing/selftests/net/lib/xsk/test_xsk.c b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> index 74eea4a4dfebd..0b2aa6919d72d 100644
> --- a/tools/testing/selftests/net/lib/xsk/test_xsk.c
> +++ b/tools/testing/selftests/net/lib/xsk/test_xsk.c
> @@ -2504,8 +2504,16 @@ int testapp_hw_sw_min_ring_size(struct test_spec *test)
>  int testapp_hw_sw_max_ring_size(struct test_spec *test)
>  {
>  	u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 4;
> +	u32 batch_size;
>  	int ret;
>  
> +	/* The second step sends batches of tx_max_pending - 8 descriptors. */

[Severity: Low]
This isn't a bug, but this comment leaves out the max_descs cap that the
patch adds further down. The batch is now
min(tx_max_pending, max_descs) - 8. Whenever tx_max_pending > 8192, that
is 8184, not tx_max_pending - 8.

The edited block comment above the batch_size computation also still
starts with "Set batch_size to 8152 for testing". That is only true when
tx_max_pending == 8160 (ice).

Could both comments be updated to describe the capped value?

> +	if (test->ifobj_tx->hw_ring_size_supp &&
> +	    test->ifobj_tx->ring.tx_max_pending <= 8) {
> +		ksft_print_msg("HW TX ring too small.\n");
> +		return TEST_SKIP;
> +	}
> +

[ ... ]

> @@ -2513,6 +2521,9 @@ int testapp_hw_sw_max_ring_size(struct test_spec *test)
>  	test->ifobj_rx->xsk->umem->num_frames = max_descs;
>  	test->ifobj_rx->xsk->umem->fill_size = max_descs;
>  	test->ifobj_rx->xsk->umem->comp_size = max_descs;
> +	test->ifobj_tx->xsk->umem->num_frames = max_descs;
> +	test->ifobj_tx->xsk->umem->fill_size = max_descs;
> +	test->ifobj_tx->xsk->umem->comp_size = max_descs;

[Severity: Low]
This change, together with the batch cap below, fixes failures that the
current code can already hit.

With two different interfaces (xskxceiver -i ethA -i ethB), TX has its
own UMEM, which keeps DEFAULT_UMEM_BUFFERS (1024) frames while the first
step uses a 2048-descriptor batch. The in-flight limit in __send_pkts()
then comes out as -1024, and RX times out, as the commit message itself
describes.

In single-interface mode on a NIC with tx_max_pending >= 8200, the
second-step batch of tx_max_pending - 8 uses up the whole 8192-frame
UMEM, and the case fails the same way.

Should this have a Fixes: tag pointing at the commit that added
HW_SW_MAX_RING_SIZE, so it can be found for stable? At the moment it is
described only as preparation for removing the single-interface mode.

>  	test->ifobj_tx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
>  	test->ifobj_rx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
>  
> @@ -2521,10 +2532,12 @@ int testapp_hw_sw_max_ring_size(struct test_spec *test)
>  		return ret;
>  
>  	/* Set batch_size to 8152 for testing, as the ice HW ignores the 3 lowest bits when
> -	 * updating the Rx HW tail register.
> +	 * updating the Rx HW tail register. __send_pkts() waits until a whole batch fits
> +	 * in the XSK TX ring, so keep it below that ring's size on NICs with larger rings.

[Severity: Low]
Is the XSK TX ring the limit that actually fails here? The commit message
says:

  With a HW TX ring of more than 8200 descriptors, the second batch would
  also outgrow the 8k XSK TX ring, and __send_pkts() would spin forever
  waiting to reserve it

In __send_pkts(), the in-flight check runs before the
xsk_ring_prod__reserve() loop:

	if (pkts_in_flight >= (int)((umem_size(umem) - xsk->batch_size * buffer_len) /
	    buffer_len) && !test_timeout) {
		ret = kick_tx(xsk);
		if (ret)
			return TEST_FAILURE;
		return TEST_CONTINUE;
	}

The UMEM has 8192 frames, and buffer_len is the 4096-byte frame size for
MIN_PKT_SIZE, so the limit is 8192 - batch_size. With
batch_size = tx_max_pending - 8:

- at tx_max_pending == 8200, the limit is 0
- above 8200, the u64 subtraction wraps, and the (int) cast gives a
  negative value (-8 at 8208)

pkts_in_flight starts at 0, so the check is true on every call. TX never
reaches the reserve loop, and RX ends up hitting THREAD_TMOUT.

Would it be more accurate to say that the case times out on the UMEM
in-flight limit from 8200 descriptors up, rather than spinning in
reserve above 8200? The cap itself (8184, which leaves a limit of 8)
looks correct; only the explanation in this comment and in the commit
message seems off.

>  	 */
> -	test->ifobj_tx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
> -	test->ifobj_rx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
> +	batch_size = min(test->ifobj_tx->ring.tx_max_pending, max_descs) - 8;
> +	test->ifobj_tx->xsk->batch_size = batch_size;
> +	test->ifobj_rx->xsk->batch_size = batch_size;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119164636.1071385-1-maciej.fijalkowski%40intel.com

  reply	other threads:[~2026-11-23 18:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 16:46 [PATCH v5 net-next 00/13] selftests: net: adjust xskxceiver to drv-net Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 01/13] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Maciej Fijalkowski
2026-11-23 18:46   ` netdev-bot+sashiko [this message]
2026-11-19 16:46 ` [PATCH v5 net-next 03/13] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 04/13] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 05/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-11-23 18:46   ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 06/13] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-11-23 18:46   ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 07/13] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-11-23 18:46   ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 08/13] selftests: xsk: send UDP over IPv4 or IPv6 between the interface MACs Maciej Fijalkowski
2026-11-23 18:46   ` netdev-bot+sashiko
2026-11-23 19:08   ` Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 09/13] selftests: xsk: prepare xskxceiver for endpoints on two hosts Maciej Fijalkowski
2026-11-23 18:46   ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 10/13] selftests: xsk: list the endpoint roles of the test cases Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 11/13] selftests: drv-net: decouple local link setup from netdevsim Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 12/13] selftests: drv-net: run the AF_XDP tests over veth or a NIC Maciej Fijalkowski
2026-11-23 18:46   ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 13/13] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski

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=179545959251.3135.2838051579849778301@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stfomichev@gmail.com \
    --cc=tushar.vyavahare@intel.com \
    /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