๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17546

Re: [PATCH net 3/6] i40e: avoid resetting BQL state when freeing temporary Tx rings in set_ringparam

#17546
From: netdev-bot+sashiko
Date: Tue, 17 Nov 2026 00:47
128 lines
12447 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 names the wrong function for the idiom it says
  it copies.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but the same bug
  exists in the sibling ice driver and this series leaves it unfixed.

--

i40e: avoid resetting BQL state when freeing temporary Tx rings in set_ringparam

i40e_set_ringparam() builds temporary Tx rings as struct copies of the
live rings, so the copies share netdev and queue_index with them. When an
error path frees these copies before i40e_down(), the BQL state of the
live queue gets reset. That can trip the BUG_ON in dql_completed(). The
patch clears netdev on each copy before i40e_free_tx_resources() in both
error paths, so i40e_clean_tx_ring() skips netdev_tx_reset_queue().

> This mirrors the
> same idiom i40e already uses for XDP Tx rings, which also have no
> netdev_queue of their own (ring->netdev = NULL in i40e_vsi_setup_tx()).

[Severity: Low]
This isn't a bug, but is i40e_vsi_setup_tx() the right function name
here? There's no function with that name in the i40e driver.
i40e_vsi_setup_tx_resources() is the closest match, and it doesn't touch
ring->netdev.

The XDP Tx ring assignment appears to be in i40e_alloc_rings() in
i40e_main.c:

		if (!i40e_enabled_xdp_vsi(vsi))
			goto setup_rx;

		ring->queue_index = vsi->alloc_queue_pairs + i;
		...
		ring->netdev = NULL;
		...
		set_ring_xdp(ring);

Could the commit message point to i40e_alloc_rings() instead?

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> index ef756487d6684..58d842d676422 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c

[ ... ]

> @@ -2248,8 +2250,11 @@ static int i40e_set_ringparam(struct net_device *netdev,
>  	/* error cleanup if the Rx allocations failed after getting Tx */
>  	if (tx_rings) {
>  		for (i = 0; i < tx_alloc_queue_pairs; i++) {
> -			if (i40e_active_tx_ring_index(vsi, i))
> +			if (i40e_active_tx_ring_index(vsi, i)) {
> +				/* not live yet, skip its BQL reset on free */
> +				tx_rings[i].netdev = NULL;
>  				i40e_free_tx_resources(&tx_rings[i]);
> +			}
>  		}
>  		kfree(tx_rings);
>  		tx_rings = NULL;

[Severity: High]
This is a pre-existing issue, not one introduced by this patch. Does the
sibling ice driver have the same problem in ice_set_ringparam() in
drivers/net/ethernet/intel/ice/ice_ethtool.c?

There, each temporary Tx ring is also a struct copy of the live ring, so
it keeps the live netdev and q_index:

	ice_for_each_txq(vsi, i) {
		/* clone ring and setup updated count */
		tx_rings[i] = *vsi->tx_rings[i];
		tx_rings[i].count = new_tx_cnt;
		tx_rings[i].desc = NULL;
		tx_rings[i].tx_buf = NULL;
		...
		err = ice_setup_tx_ring(&tx_rings[i]);
		if (err) {
			while (i--)
				ice_clean_tx_ring(&tx_rings[i]);
			kfree(tx_rings);
			goto done;
		}

The free_xdp/free_tx labels are reached when the XDP ring setup, the Rx
kzalloc or ice_setup_rx_ring() fails. They also clean the copies before
ice_down() has run:

	/* error cleanup if the Rx allocations failed after getting Tx */
	if (tx_rings) {
		ice_for_each_txq(vsi, i)
			ice_free_tx_ring(&tx_rings[i]);
		kfree(tx_rings);
	}

ice_free_tx_ring() calls ice_clean_tx_ring() in ice_txrx.c. That function
only skips the BQL reset when netdev is NULL:

	if (!tx_ring->netdev)
		return;

	/* cleanup Tx queue statistics */
	netdev_tx_reset_queue(txring_txq(tx_ring));

txring_txq() resolves to netdev_get_tx_queue(ring->netdev, ring->q_index).
For a copy, that is the live netdev_queue.

Consider ethtool -G on a running ice interface, under memory pressure,
with Tx traffic in flight. If one of those allocations fails, can the next
netdev_tx_completed_queue() from ice_clean_tx_irq() hit this check in
dql_completed()?

	BUG_ON(count > num_queued - dql->num_completed);

That would be the same panic the commit message describes for i40e.
Nothing in this series touches drivers/net/ethernet/intel/ice/.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261113004602.129864-1-anthony.l.nguyen%40intel.com
Technical Details
Message-ID: <179487647012.3136.17665986611017849845@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364863-linux-kernel-netdev=dewy.ru
References: <20261113004602.129864-4-anthony.l.nguyen@intel.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364863-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 3/6] i40e: avoid resetting BQL state when freeing
 temporary Tx rings in set_ringparam
Date: Tue, 17 Nov 2026 00:47:50 +0000
Organization: Usenet Network
Message-ID: <179487647012.3136.17665986611017849845@kernel.org>
References: <20261113004602.129864-4-anthony.l.nguyen@intel.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2206240"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:IuQ89y/kTio3iwVyF/If4KGBHLA= sha256:MGCjqvAHuS5aqVdhZoYEgHtksuvnjhlWXl2G4Fca49Q=
	sha1:s/NXBOTIe+ezce3FnxlWGUow3Tk= sha256:9TP6kj2cv9/C5fmTweEm25Px/p2mcg1DUMXor9+unOY=
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 2226B114DEB; Tue, 17 Nov 2026 03:48:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 KSi03IQMTbO2;
	Tue, 17 Nov 2026 03:48:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364863-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 3B4EC114DEA; Tue, 17 Nov 2026 03:48:07 +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 B5DEE2B800; Tue, 17 Nov 2026 00:47:57 +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=1794876477;
	b=Em/YQXI9vlOmDLvHL4dbBSKlSVsiVWoYidH743gHmS8sA+vGEPGyl8tlxtBtlZDnsap0
	 /FPEXMjllef9oS6SiaJASxzRTrdgZcY78UX/upTPtSPdnVtofFYyziRJrEg+eJpTtPn3j
	 WF8zsCXXD1hNEsUDl7UlcRiSPSJ8MkmR1rdP/Qk9YpmYusPl9FifrwC5Oar2IQXcgzClb
	 iopi8KCpw/YegC9dI0nk7rXu+Oxm7eMeLyc2Nx1Xe1WVxp3XCM0qlAYbVHU75u04Y+d3j
	 UPk8aBBOvCWBW/d7AhM6Q2J0gooQ2QPSxj/NaJZ8N1T5Vd56pzy7frtPPbvUpqkpjcg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794876477;
	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=hhknR2CMqirxAtldjyoyIn+m0/i18Htb3W1llHXKCFs=;
	b=O9MO2maf8Cr90idYgpERibAUOP1N2jtUaelPlZJ+DbDRA4D6ZXyK47MS/0b/VUgusHyR
	 zQtzBdoS1rhsrzQzkfJniFXWm8XfAOF4fdYpsVQz7QfW0Obe+PRzJ3e+nIN4t6xeDpQvc
	 67hlgu10F+Ogj3ksT6G+SGd7yynl2Lp0kBXZdOrUfKop3iC7WVZFAA221GT7mf/Du1GRy
	 Ox5YmzQvd8S6+RZQVsmZ5lDVZKkhWDEUb0+AvwwsiiQxCc/0aKPuhgKCCOKSzuNqNMcMs
	 H0wOLdlc7K0iSP+hXCIzbhntGi/mi1SMGebmWOUvRbADiVxcp9pnaq2Y+DJRWPxqkIg==
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="k/6wsKm2";
	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 8DFAC606A330;
	Tue, 17 Nov 2026 00:47:57 +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=k/6wsKm2
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=1794876471;
	b=FkIbKIvePfdJx3Z7XNkzgIpP3MH+a/CBNkCn/6sqBad97b+yxoG1Sz7bx8VwCH9S1RV2
	 4+LR185p4R9zbr6PijKcHlFYoHjde7h4a/k+h8NDcN+CWwlXP2g6JtJAzoF0NWXfltJPT
	 PenBCuhNVetc/CcJoZoeSpo4rraFdGk8gmqomRCFSPozTaCImuL0wOzpuH5DrVF7LsJ7M
	 tCasJKhB24tq+DnHbiCckeLq+Em/MiIladUQH/IWOINC6tUo6+3mKlMQ/e1wZog9hBKXH
	 POUv9G47FET9FgsLh3mUolBkvrqPgO6lfWF8PvO93QScceY9U7LxQ35yyy1DREIZ8qw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794876471;
	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=hhknR2CMqirxAtldjyoyIn+m0/i18Htb3W1llHXKCFs=;
	b=srt7VUsIjK4bPcm9kvRBsviYQ92+79XWdPWPZ7PwFrZa2h/vCiLp8JXMCc1ZZcxOooma
	 eA0cdgGgOzUnapfXbMcVHnEajjxR7bSc9rf3lHZpKM0IsLykmiC8uIWLldIZlqr0d6M2Z
	 EC0zQ11t6RxDoj99R234aGCYslvoB5v2BxNJroaToUoI8EIolr4xiRJCFkUjUBSpbF30R
	 5dSoJIn+8adZOQpOPD111SAy1vYMpU5dacbMV/DBssUgG1XfPXw6CsKR4HpuUZ57H4kkO
	 YKzEFZcvC0zEjPXM02IB3ElEoM8TYS6K7QgPGMqrsVUBLk0EvBwiUlZjLEG6J7LPqxQ==
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="k/6wsKm2";
	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 AD3E7606A334;
	Tue, 17 Nov 2026 00:47:51 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 925741F000C4;
	Tue, 17 Nov 2026 00:47:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794876471;
	bh=hhknR2CMqirxAtldjyoyIn+m0/i18Htb3W1llHXKCFs=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=k/6wsKm2ZuO4BjO7ZKNRVv4OG9zUb3A2Q5SkqXFJIGvPwHceXlW/SK0A+I8VxOl0k
	 TOI4OEGT/bNREj2YWGI4qdvIkq7EdVAJbUurE0I2+Msk11YCuUUQ7xqA2o0eoMSHPz
	 x/25sF7rUF+bU+5W7hK6PUYQFIwFxMZstmzNxvG97efzeH0J48zcm+4niOxT53eL/2
	 iSjnZun+3v01AdTCG69cdc5Cxz4aLVPvKRrfcBh3ub43Jtsp/RubHxbR3Ya4LQ1Zh4
	 Xm95iWCdTNoepOI5Yj1X5RuxoKUBxeg7ZIOQB+UTlyOr5NqDucZGsJEGizj4ZGGepP
	 BEWsFoLD0lJIw==
X-Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
 edumazet@kernel.org, andrew+netdev@lunn.ch, netdev@vger.kernel.org,
 luoxuanqiang@kylinos.cn, mheib@redhat.com, fballuch@redhat.com,
 aleksandr.loktionov@intel.com, richardcochran@gmail.com,
 saikrishnag@marvell.com, stable@vger.kernel.org, vadim.fedorenko@linux.dev,
 jacob.e.keller@intel.com, rafal.romanowski@intel.com
X-In-Reply-To: <20261113004602.129864-4-anthony.l.nguyen@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