๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21246

Re: [PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE

#21246
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 18:46
142 lines
13672 bytes
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
Technical Details
Message-ID: <179545959251.3135.2838051579849778301@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369695-linux-kernel-netdev=dewy.ru
References: <20261119164636.1071385-3-maciej.fijalkowski@intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369695-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179545959251.3135.2838051579849778301@kernel.org>
References: <20261119164636.1071385-3-maciej.fijalkowski@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3957621"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:IUX5j06T74wPiVuTMCCc1aXuE3Q= sha256:HFKbdqfLI1UBGwkcnK02S0lD30snfMyHQjfQnwTGIaY=
	sha1:l026S0GTpR4vrmV1mXY7WBMxZ5s= sha256:oNp7M+uIwyz6ZAA1QE0YdALYYAgsUddIlK/rSN4ittM=
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 6F162125DC9; Mon, 23 Nov 2026 21:46:53 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, 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, URIBL_BLOCKED=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 qeLx5hBoQymt;
	Mon, 23 Nov 2026 21:46:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369695-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 08B76125DC3; Mon, 23 Nov 2026 21:46:37 +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 A05682E4A5; Mon, 23 Nov 2026 18:46:35 +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=1795459594;
	b=CeIzNbhtNVy5+xkZjThl2LFc1+SUAXsi/LEbWQ2Iu3+mM2b3WBricpNqAl+okxBrwh0X
	 RwWQN4ySEwZ6LMeetDsbYES8sb1ExoLpspkdavlCfNN+BiYwejkzLaE62lf2BdsfH+/Pj
	 DMleEff0IP+8n38fLjAdg2qov273JHs6EDAdagmCqodDnJXFbDtlT0MlLJ4UfTlvMfn1t
	 9RSBx9zju/La9jT+L5zgxWkFeOFa/ykovXLpPkzTa1yHifCvlXV6HHF3V5xhvb3Vdib5g
	 d9nx5GX18G414ZqSBmiT33vETK6b60tw4PxiyNoCN+iqeKDgmAtO5a+cyN3wMSpYxIw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795459594;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=CK4bj4ETGSuMjf+bBniHN5elZgX+mhEpv9dbVOTCqHo=;
	b=5KLbh8j5hY/CmzvLuxgvzOYIqGSLvo1WYpEm8nwDfEGy82Wb1VZNIZhcXVsCAu21zzQ2
	 tuDbfhMDNVQkxfSFKIoFO5lhA4sSZPOBMZAvQttPv4mO3ApTO/l/YNrkowD1AjZYn2fVi
	 AtwjmL/z8rlwRpwHSpaHFEYY7rLvYs1wIV8+PpeQYCSDLVlA4fvxaUmT64MgxHWn7p+KO
	 GI4f3sfrzKFm2gSVr6H2Dug5sBwOj33whmHfIiJKSjDam2qnlk3cODeXorA3HMzArrw2S
	 abQ65teXcCB+ZLgncTae7hk/cTRIdVMFwRd1OFjYGWHL22ZS4+4mbO2qZvOd8Nzg3Sw==
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=jv3WVORy;
	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 CD61A606A321;
	Mon, 23 Nov 2026 18:46:34 +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=jv3WVORy
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=1795459594;
	b=41TjQoi95979dgdWV1vmq0g2ZtZ83BcNkC+EqQLhL35ChHPLy84ZrMC2t71VYBblVfw2
	 OjIdRZyyNaptI7i8myW9nFD9O8BvYnnis0YwNyUGGCOoZ5/2Uuc00gzsVa4nnTcyaDplu
	 q1NzQdpn85GUuebDoaqP39bcexrUg7Z+c9xa5HXHu5vrwKfXMhnwH9gxKvnrRfdB8iviE
	 BEjJK+5AaE2QiBAixnpf5dn40C2+Y20ZFDAqUIZ4j/6h9hEN17seyuAgDsPr70DnTCMa5
	 L6pdcOpJnmiAdAcCEUeABqbZwvj8KbB46bRYS/sZWiUiNvXkGfU8KLyYy1WZsaaJjYA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795459594;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=CK4bj4ETGSuMjf+bBniHN5elZgX+mhEpv9dbVOTCqHo=;
	b=WiBufhuyMBWbwE4Y3E6+eb555Ef8azdAkCvu2Knwf4nnKuy22Z/ox1anjqrFeaCTKNmf
	 NmPYuF95g8miKw+VzLempEbpaANWGaQkhgLBF0V1fy7O8bpk5n91VfyzGfBei+/+TX8//
	 l6fVHExSGmP9aWEofUMg/AR5KqUxLwjLkDekDwmtS2BH5dnOGNrGI+Ha46f47kxs38JeE
	 CfTPBjyexWUslCnK8oCFUCyfnhpmXkDTh2qYqcP1uDMRNrDMH9+LlNK4GuX7j2Cd1Kn6c
	 DxR97MBan5xQbFhRCUPECJHpSfO17uNwid7URiINKUVP0URrg06Gs7lSbWW2SJLx1fA==
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=jv3WVORy;
	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 E8C5E606A31A
	for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 18:46:33 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA4FE1F000C4;
	Mon, 23 Nov 2026 18:46:32 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795459593;
	bh=CK4bj4ETGSuMjf+bBniHN5elZgX+mhEpv9dbVOTCqHo=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=jv3WVORyte8AcCQ0AKxEvltVL1ULTbighWAhoTlLa3L79NxTgdhkcN58cBJs9ANOZ
	 xSUCa/ZEDJPnrROiqu4xAveoDXtwR8luV8k+lfj1U47NKgXgecBmVwUAH61YI1tLaf
	 Qv9EDLeiy8fnfOaO4ZFdtWSbf35xX7xy8xg0U/7P7YwnXbBntQHppSCX3g9sqYnOs1
	 cZ+t/ciuF07boEj6d00DNzeii9DR4VvnV7JAPXAF2UGGTBy63aqSRJj1REsZR4ewKE
	 Hi4ihUUAVzPpuqqEZS6xTf6PDOgrAEqV/GQE/Km5Vxx/edPCVTaerRhkJJWsfDj8jp
	 yeLnmj3W8Hc4w==
X-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
X-In-Reply-To: <20261119164636.1071385-3-maciej.fijalkowski@intel.com>
X-sashiko-severity: Low
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