Re: [PATCH net 1/4] bnxt: don't lock the tx queue from napi poll
From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-08-11 21:09:53
On Wed, 11 Aug 2021 13:42:40 -0700 Michael Chan wrote:
quoted
- 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.