Skip to content

Commit 042b204

Browse files
Dongli Zhangdavem330
authored andcommitted
xen/netfront: stop tx queues during live migration
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 <[email protected]> Signed-off-by: Dongli Zhang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0c57eee commit 042b204

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/net/xen-netfront.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,6 +1730,10 @@ static int netfront_resume(struct xenbus_device *dev)
17301730

17311731
dev_dbg(&dev->dev, "%s\n", dev->nodename);
17321732

1733+
netif_tx_lock_bh(info->netdev);
1734+
netif_device_detach(info->netdev);
1735+
netif_tx_unlock_bh(info->netdev);
1736+
17331737
xennet_disconnect_backend(info);
17341738
return 0;
17351739
}
@@ -2349,6 +2353,10 @@ static int xennet_connect(struct net_device *dev)
23492353
* domain a kick because we've probably just requeued some
23502354
* packets.
23512355
*/
2356+
netif_tx_lock_bh(np->netdev);
2357+
netif_device_attach(np->netdev);
2358+
netif_tx_unlock_bh(np->netdev);
2359+
23522360
netif_carrier_on(np->netdev);
23532361
for (j = 0; j < num_queues; ++j) {
23542362
queue = &np->queues[j];

0 commit comments

Comments
 (0)