Re: [PATCH hyperv-fixes] hv_netvsc: Fix unwanted wakeup after tx_disable
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2019-03-28 18:38:33
Also in:
linux-hyperv, lkml
From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2019-03-28 18:38:33
Also in:
linux-hyperv, lkml
On Thu, 28 Mar 2019 17:48:45 +0000 Haiyang Zhang [off-list ref] wrote:
+static inline void netvsc_tx_enable(struct netvsc_device *nvscdev,
+ struct net_device *ndev)
+{
+ nvscdev->tx_disable = false;
+ mb(); /* ensure queue wake up mechanism is on */
+
+ netif_tx_wake_all_queues(ndev);
+}You don't need a full mb(). virt_wmb() should be sufficient. Could I suggest an alternative approach. You don't need to introduce a local tx_disable flag, the only place where a wakeup could cause problems is after a send_completion was processed during detach state. Instead, just avoid wakeup in that place.
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c@@ -720,6 +720,7 @@ static void netvsc_send_tx_complete(struct net_device *ndev, struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx); if (netif_tx_queue_stopped(txq) && + netif_device_present(ndev) && (hv_get_avail_to_write_percent(&channel->outbound) > RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { netif_tx_wake_queue(txq);