Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mmc@linux.ibm.com
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
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	[thread overview]
Message-ID: <179551045457.3135.17656003339909508108@kernel.org> (raw)
In-Reply-To: <20261123075136.3278-6-mmc@linux.ibm.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] 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

  reply	other threads:[~2026-11-24  8:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  7:51 [PATCH net-next v2 0/8] ibmveth: prepare the RX path for multi-queue Mingming Cao
2026-11-23  7:51 ` [PATCH net-next v2 1/8] ibmveth: Prepare MQ RX adapter data structures Mingming Cao
2026-11-23  7:51 ` [PATCH net-next v2 2/8] ibmveth: Refactor RX resource allocation for MQ RX bring-up Mingming Cao
2026-11-23  7:51 ` [PATCH net-next v2 3/8] ibmveth: Refactor buffer pool management for per-queue MQ RX Mingming Cao
2026-11-24  8:54   ` netdev-bot+sashiko
2026-11-23  7:51 ` [PATCH net-next v2 4/8] ibmveth: Refactor RX interrupt control for MQ RX queues Mingming Cao
2026-11-23  7:51 ` [PATCH net-next v2 5/8] ibmveth: Refactor TX resource allocation in open/close paths Mingming Cao
2026-11-24  8:54   ` netdev-bot+sashiko [this message]
2026-11-23  7:51 ` [PATCH net-next v2 6/8] ibmveth: Add RX queue register helpers for MQ Mingming Cao
2026-11-23  7:51 ` [PATCH net-next v2 7/8] ibmveth: Pass the RX queue index through replenish and poll Mingming Cao
2026-11-23  7:51 ` [PATCH net-next v2 8/8] ibmveth: Split RX poll into per-slot helpers for MQ Mingming Cao

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=179551045457.3135.17656003339909508108@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjking1@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=davem@davemloft.net \
    --cc=davemarq@linux.ibm.com \
    --cc=edumazet@kernel.org \
    --cc=haren@linux.ibm.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mmc@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=netdev@vger.kernel.org \
    --cc=nnac123@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=ricklind@linux.ibm.com \
    --cc=ritesh.list@gmail.com \
    --cc=shaik.abdulla1@ibm.com \
    --cc=sshegde@linux.ibm.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