[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210811140939.3a13b6e3@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Wed, 11 Aug 2021 14:09:39 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Michael Chan <michael.chan@...adcom.com>
Cc: David Miller <davem@...emloft.net>,
Jeffrey Huang <huangjw@...adcom.com>,
Eddie Wai <eddie.wai@...adcom.com>,
Prashant Sreedharan <prashant@...adcom.com>,
Andrew Gospodarek <gospo@...adcom.com>,
Netdev <netdev@...r.kernel.org>,
Edwin Peer <edwin.peer@...adcom.com>
Subject: Re: [PATCH net 1/4] bnxt: don't lock the tx queue from napi poll
On Wed, 11 Aug 2021 13:42:40 -0700 Michael Chan wrote:
> > - if (unlikely(netif_tx_queue_stopped(txq)) &&
> > - (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh)) {
> > - __netif_tx_lock(txq, smp_processor_id());
> > - if (netif_tx_queue_stopped(txq) &&
> > - bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh &&
> > - txr->dev_state != BNXT_DEV_STATE_CLOSING)
> > - netif_tx_wake_queue(txq);
> > - __netif_tx_unlock(txq);
> > - }
> > + if (netif_tx_queue_stopped(txq) &&
> > + bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh &&
> > + READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING)
>
> This can race with bnxt_start_xmit(). bnxt_start_xmit() can also wake
> up the queue when it sees that descriptors are available. I think
> this is the reason we added tx locking here. The race may be ok
> because in the worst case, we will wake up the TX queue when it's not
> supposed to wakeup. If that happens, bnxt_start_xmit() will return
> NETDEV_TX_BUSY and stop the queue again when there are not enough TX
> descriptors.
Good point, let me remove the warning from patch 3, then.
Powered by blists - more mailing lists