Patch "xen/netfront: stop tx queues during live migration" has been added to the 4.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    xen/netfront: stop tx queues during live migration

to the 4.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     xen-netfront-stop-tx-queues-during-live-migration.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7697dc689072e4a9853612fd00ef328a8ebab778
Author: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
Date:   Fri Oct 22 16:31:39 2021 -0700

    xen/netfront: stop tx queues during live migration
    
    [ Upstream commit 042b2046d0f05cf8124c26ff65dbb6148a4404fb ]
    
    The tx queues are not stopped during the live migration. As a result, the
    ndo_start_xmit() may access netfront_info->queues which is freed by
    talk_to_netback()->xennet_destroy_queues().
    
    This patch is to netif_device_detach() at the beginning of xen-netfront
    resuming, and netif_device_attach() at the end of resuming.
    
         CPU A                                CPU B
    
     talk_to_netback()
     -> if (info->queues)
            xennet_destroy_queues(info);
        to free netfront_info->queues
    
                                            xennet_start_xmit()
                                            to access netfront_info->queues
    
      -> err = xennet_create_queues(info, &num_queues);
    
    The idea is borrowed from virtio-net.
    
    Cc: Joe Jin <joe.jin@xxxxxxxxxx>
    Signed-off-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 7d4c0c46a889d..6d4bf37c660f7 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -1454,6 +1454,10 @@ static int netfront_resume(struct xenbus_device *dev)
 
 	dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
+	netif_tx_lock_bh(info->netdev);
+	netif_device_detach(info->netdev);
+	netif_tx_unlock_bh(info->netdev);
+
 	xennet_disconnect_backend(info);
 	return 0;
 }
@@ -2014,6 +2018,10 @@ static int xennet_connect(struct net_device *dev)
 	 * domain a kick because we've probably just requeued some
 	 * packets.
 	 */
+	netif_tx_lock_bh(np->netdev);
+	netif_device_attach(np->netdev);
+	netif_tx_unlock_bh(np->netdev);
+
 	netif_carrier_on(np->netdev);
 	for (j = 0; j < num_queues; ++j) {
 		queue = &np->queues[j];



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux