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 via email to