πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21616

Re: [PATCH net-next v2 5/8] ibmveth: Refactor TX resource allocation in open/close paths

#21616
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 08:54
97 lines
11545 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] In ibmveth_open() (drivers/net/ethernet/ibm/ibmveth.c, lines
  1194-1199), the commit "ibmveth: Refactor TX resource allocation in…

--

ibmveth: Refactor TX resource allocation in open/close paths

This moves TX LTB allocation and freeing out of ibmveth_open() and
ibmveth_close() into new ibmveth_alloc_tx_resources() and
ibmveth_free_tx_resources() helpers. The TX LTBs are still mapped before
RX buffers are handed to PHYP. TX queues are now started under
netif_tx_lock_bh().

> diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
> index ea0e5158040cb..06741a6756b88 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c

[ ... ]

> @@ -1147,7 +1191,12 @@ static int ibmveth_open(struct net_device *netdev)
>  	netdev_dbg(netdev, "initial replenish cycle\n");
>  	ibmveth_schedule_rx_queue(adapter, 0);
>
> +	/* netif_tx_lock() takes each txq lock, so a sender that then sees
> +	 * DRV_XOFF clear under its txq lock also sees the LTBs set up above.
> +	 */
> +	netif_tx_lock_bh(netdev);
>  	netif_tx_start_all_queues(netdev);
> +	netif_tx_unlock_bh(netdev);

[Severity: Low]
The commit message does describe this change. It is a behaviour change
justified as an ordering fix, though, and it sits in a patch titled as a
refactor with no Fixes: tag. Would it be better sent as a separate patch
with its own Fixes: tag?

The change in ibmveth_open() looks correct on its own terms.
netif_tx_lock() goes through netif_freeze_queues(), which takes and
releases each txq _xmit_lock. That gives senders the pairing the comment
describes.

The new comment sets a rule that the driver's other LTB publish path does
not follow. ibmveth_set_channels() runs while adapter->opened is true. It
publishes new tx_ltb_ptr[] entries and clears DRV_XOFF without taking
netif_tx_lock or any txq lock:

drivers/net/ethernet/ibm/ibmveth.c:ibmveth_set_channels() {
    ...
	netif_tx_stop_all_queues(netdev);

	/* Allocate any queue that we need */
	for (i = old; i < goal; i++) {
		if (adapter->tx_ltb_ptr[i])
			continue;

		rc = ibmveth_allocate_tx_ltb(adapter, i);
    ...
	rc = netif_set_real_num_tx_queues(netdev, goal);
    ...
	netif_tx_wake_all_queues(netdev);
    ...
}

The sender side then reads the new pointer in ibmveth_start_xmit():

	memcpy(adapter->tx_ltb_ptr[queue_num], skb->data, skb_headlen(skb));

By the reasoning in the new comment, an ethtool -L that grows the TX queue
count on an open device would leave the same gap for the new queues. A
sender on another CPU could see DRV_XOFF clear and still read a stale NULL
tx_ltb_ptr[i]. In practice this is only a load-load reordering, and a lot
of work happens between the LTB store and the wake, so no failure has
been shown.

Should ibmveth_set_channels() get the same netif_tx_lock treatment? If
not, does the lock in ibmveth_open() need the justification given in the
comment and the commit message?

The set_channels code is older than this patch, and nothing in it changes
here.

>
>  	adapter->opened = true;
>  	netdev_dbg(netdev, "open complete\n");

[ ... ]

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123075136.3278-1-mmc%40linux.ibm.com
Technical Details
Message-ID: <179551045457.3135.17656003339909508108@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370124-linux-kernel-netdev=dewy.ru
References: <20261123075136.3278-6-mmc@linux.ibm.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-370124-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v2 5/8] ibmveth: Refactor TX resource allocation
 in open/close paths
Date: Tue, 24 Nov 2026 08:54:14 +0000
Organization: Usenet Network
Message-ID: <179551045457.3135.17656003339909508108@kernel.org>
References: <20261123075136.3278-6-mmc@linux.ibm.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4093553"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:pu11senIztIY/5hemYv0OfLWEfc= sha256:s7bi8hCh9GwpJdzjhPZS+sAZiC7mUU39hYdLFi6rAVY=
	sha1:7opE8D/8msGmrtpLYpKasgSWpi0= sha256:FGY8qC55hlXlHTT2yzzpPFBRpWSWgA6rLuJQlPK9JmE=
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 E2C41125DE5; Tue, 24 Nov 2026 11:54:41 +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 6fSX_pkUPjv0;
	Tue, 24 Nov 2026 11:54:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-370124-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 F209E125DD7; Tue, 24 Nov 2026 11:54:29 +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 AE02237CC9; Tue, 24 Nov 2026 08:54:17 +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=1795510457;
	b=YAg4jzEHtzOBqGxa0cgZByQFJndNLkj0AuOP66R4Wg4DpUM/OWdiSqCAJS+sx/SIRldl
	 O2uLF3SotmMVZ7BT429yxufmewOQVGC4/ZukFzubFBtp0nnXTYr6sfADQTghTmkJB+DVw
	 S4o2ebBBJlm7i2AQSkrvknb85lGQ6uRc4nmbQlaPaMqp7jC7DMaLVWDPMYCQLkAO+nqHE
	 frxV1tkm9rHdsvMfeJ7EHdarA0ZlVKM+AfZmQHp9m0Hz5NnDq/7oAXoFIWVBiKxHE9gNg
	 8bzBTdMaZDWJur/ZbbE1YFb5ey63PYMcngqbVmqh4IC0r2a27tkX5jtHSwLT11b7Dyg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795510457;
	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=iS94JK1jOdY+h44hOhoK83b/1UtofAXx+07J9jYlskE=;
	b=M02uZKxMajPWoVrziGxIXXWKoWpPF6vZnzN/ctTUF629uiNUc1kZjcjAhR8HsDGbVI5g
	 6Sgbo7lljyIc4fgyJfB24zGYixJbeVE2maD/DHV3gifdyQTc1zElNlalJ0OuPdLCuBvd3
	 eRiplN9Hw2Blk3/ih8s11QP/YZocNszy10Dvf5h0HdE0oTo1lVEx/1e5GXyKO5q6aA0Gx
	 ILhe3b6Ql99/afAC4OUUxOjGrbjAfrOtlemZMpt1wwc9ABQuyX39OSWFVX8F9XpgJdxHh
	 PlRJceiCWx+XWV9FtBA0aUndYVpZq5evtR3cz0peNOowWQJTLA4eeSvjRDxljPRKRBA==
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=bcO1jkNN;
	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 8706D606A32D;
	Tue, 24 Nov 2026 08:54:17 +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=bcO1jkNN
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=1795510456;
	b=M8braVPb5vzSfo1HI+BQpGI+Oe+J2Fk5B+z3wfHoSHBkPcID7x83VDcbVXI6TjfBnJ8V
	 hg3Su4gkVdTg+A5ohHOwAkZGrQxAa3MuhqpPwr67/9qdQxueLrqu5dONGerAnoIhq7qKb
	 0Tdn5zYD4oYkYkHIG0BJviP2ALKECobKSjRzhnDSgmlX6wSa+Sgr8o/WTXBQ9dQn42CUe
	 v3aPBTDvzxhtS8Lg4H+eH2FC4r+zAmGqsgxD9akHmPa/HrwLemsPtKnh+ibpLpsgUV08M
	 xosMsnhsIVJn3pIe94fZpTE4L7CxJcOFY+FjZ/A/u2M3T2tUmLCOHF2fqLiIvUPwxLQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795510456;
	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=iS94JK1jOdY+h44hOhoK83b/1UtofAXx+07J9jYlskE=;
	b=B3LfbG03RH4IVBs7pgCYt1RXBNAgWyDittiZeamK/8vBdrhS2Q53eLy+dfAWE7iV/Bv6
	 9qR6qI02u8XxAaducUeMtpxWBPcJZf9tORsdT6iTD+rzrljyrKwQGzRoierGHgsQPOR5l
	 +ILYPO8k8Ja8A92uQ4DDIwgAguzmAoloeeBs9ljj3CI5qcEUu4MS3Ht13lcPWofDthk2V
	 0oAxp4l/u8z8mcYJtUKE9bxmY4PZs7eNVrBbWAimChWONdqwomP/0ACXtuSFus6Pb3Xr0
	 bSmHx6Z+IOUvc/Zk10uary950ndrQdzgsgQ1TXbHisu0VhOXiaOpgPEyLlzTq/V1zRA==
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=bcO1jkNN;
	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 A37C8606A32A
	for <netdev@vger.kernel.org>; Tue, 24 Nov 2026 08:54:16 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F381D1F000D1;
	Tue, 24 Nov 2026 08:54:14 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795510456;
	bh=iS94JK1jOdY+h44hOhoK83b/1UtofAXx+07J9jYlskE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=bcO1jkNNiQfwNBX5PYZwMsqbeJKPp+Wdm6kJV3MuYvIyUdvvFmW+17OQUTeQU574B
	 yOJ2pSFaMEH1SA07iIvzo5hksFfHunkS25Xq/Yq0NeJ7h3zEjFZY/w02n7dV03ulP4
	 53n/pJtDuoapKZTjy2XXDXojidfM6ONG0XDP+GJk6SgPjaPHUNcFJ2z+FSWa/cyX5X
	 NIiiGpvMHmgdOl/zGyol0kjzLoYlfB9zKEvjePurtp2prwonfW5yx8/xMcDWjBSNdE
	 Hl8JA+eH/F5PSfSKTJLAERH7vmYnAv8Q3g36zjyxGdLTK5Pgm0MoQmAt73fWBmx33b
	 4cBTZ1l+EOfVQ==
X-Cc: netdev@vger.kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au,
 npiggin@gmail.com, chleroy@kernel.org, ritesh.list@gmail.com,
 sshegde@linux.ibm.com, nnac123@linux.ibm.com, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 linuxppc-dev@lists.ozlabs.org, horms@kernel.org, davemarq@linux.ibm.com,
 haren@linux.ibm.com, ricklind@linux.ibm.com, bjking1@linux.ibm.com,
 shaik.abdulla1@ibm.com
X-In-Reply-To: <20261123075136.3278-6-mmc@linux.ibm.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