All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen-netfront: remove warning when unloading module
@ 2017-11-20 10:41 Eduardo Otubo
  2017-11-20 10:49 ` Wei Liu
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Eduardo Otubo @ 2017-11-20 10:41 UTC (permalink / raw)
  To: xen-devel
  Cc: netdev, paul.durrant, wei.liu2, linux-kernel, vkuznets, cavery,
	cheshi, mgamal, Eduardo Otubo

When unloading module xen_netfront from guest, dmesg would output
warning messages like below:

  [  105.236836] xen:grant_table: WARNING: g.e. 0x903 still in use!
  [  105.236839] deferring g.e. 0x903 (pfn 0x35805)

This problem relies on netfront and netback being out of sync. By the time
netfront revokes the g.e.'s netback didn't have enough time to free all of
them, hence displaying the warnings on dmesg.

The trick here is to make netfront to wait until netback frees all the g.e.'s
and only then continue to cleanup for the module removal, and this is done by
manipulating both device states.

Signed-off-by: Eduardo Otubo <otubo@redhat.com>
---
 drivers/net/xen-netfront.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 8b8689c6d887..b948e2a1ce40 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -2130,6 +2130,17 @@ static int xennet_remove(struct xenbus_device *dev)
 
 	dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
+	xenbus_switch_state(dev, XenbusStateClosing);
+	while (xenbus_read_driver_state(dev->otherend) != XenbusStateClosing){
+		cpu_relax();
+		schedule();
+	}
+	xenbus_switch_state(dev, XenbusStateClosed);
+	while (dev->xenbus_state != XenbusStateClosed){
+		cpu_relax();
+		schedule();
+	}
+
 	xennet_disconnect_backend(info);
 
 	unregister_netdev(info->netdev);
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [PATCH] xen-netfront: remove warning when unloading module
@ 2017-11-20 10:41 Eduardo Otubo
  0 siblings, 0 replies; 14+ messages in thread
From: Eduardo Otubo @ 2017-11-20 10:41 UTC (permalink / raw)
  To: xen-devel
  Cc: Eduardo Otubo, wei.liu2, netdev, linux-kernel, paul.durrant,
	cheshi, vkuznets, mgamal, cavery

When unloading module xen_netfront from guest, dmesg would output
warning messages like below:

  [  105.236836] xen:grant_table: WARNING: g.e. 0x903 still in use!
  [  105.236839] deferring g.e. 0x903 (pfn 0x35805)

This problem relies on netfront and netback being out of sync. By the time
netfront revokes the g.e.'s netback didn't have enough time to free all of
them, hence displaying the warnings on dmesg.

The trick here is to make netfront to wait until netback frees all the g.e.'s
and only then continue to cleanup for the module removal, and this is done by
manipulating both device states.

Signed-off-by: Eduardo Otubo <otubo@redhat.com>
---
 drivers/net/xen-netfront.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 8b8689c6d887..b948e2a1ce40 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -2130,6 +2130,17 @@ static int xennet_remove(struct xenbus_device *dev)
 
 	dev_dbg(&dev->dev, "%s\n", dev->nodename);
 
+	xenbus_switch_state(dev, XenbusStateClosing);
+	while (xenbus_read_driver_state(dev->otherend) != XenbusStateClosing){
+		cpu_relax();
+		schedule();
+	}
+	xenbus_switch_state(dev, XenbusStateClosed);
+	while (dev->xenbus_state != XenbusStateClosed){
+		cpu_relax();
+		schedule();
+	}
+
 	xennet_disconnect_backend(info);
 
 	unregister_netdev(info->netdev);
-- 
2.13.6


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-11-22 11:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-20 10:41 [PATCH] xen-netfront: remove warning when unloading module Eduardo Otubo
2017-11-20 10:49 ` Wei Liu
2017-11-20 11:17   ` Juergen Gross
2017-11-20 12:59     ` Eduardo Otubo
2017-11-20 12:59     ` Eduardo Otubo
2017-11-20 11:17   ` Juergen Gross
2017-11-20 10:49 ` Wei Liu
2017-11-20 10:55 ` Paul Durrant
2017-11-20 10:55   ` Paul Durrant
2017-11-20 12:56   ` 'Eduardo Otubo'
2017-11-20 12:56   ` 'Eduardo Otubo'
2017-11-22 11:44 ` kbuild test robot
2017-11-22 11:44 ` kbuild test robot
  -- strict thread matches above, loose matches on Subject: below --
2017-11-20 10:41 Eduardo Otubo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.