All of lore.kernel.org
 help / color / mirror / Atom feed
* get a handle for the tap device to shut it down
@ 2014-11-28 15:47 Olaf Hering
  2014-12-02 15:53   ` Olaf Hering
  0 siblings, 1 reply; 3+ messages in thread
From: Olaf Hering @ 2014-11-28 15:47 UTC (permalink / raw)
  To: qemu-devel, xen-devel


Xen does a shutdown of the emulated PCI network device in
pci_unplug_nics. But this just disables the PCI device. The tap device
for a given emulated card remains active because nothing closes the
file descriptor. 

The cmdline for qemu contains something like "-device
rtl8139,id=nic0,netdev=net0,mac=00:16:3e:28:f1:ee -netdev
type=tap,id=net0,ifname=vif1.0-emu,script=no,downscript=no".

I wonder if the missing disable of the tap device is intentional, or
just an oversight, or if its just to complicated to get from a
"PCIDevice *" to the other end and call the ->cleanup function.


Olaf

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

* Re: [Qemu-devel] get a handle for the tap device to shut it down
  2014-11-28 15:47 get a handle for the tap device to shut it down Olaf Hering
@ 2014-12-02 15:53   ` Olaf Hering
  0 siblings, 0 replies; 3+ messages in thread
From: Olaf Hering @ 2014-12-02 15:53 UTC (permalink / raw)
  To: qemu-devel, xen-devel; +Cc: Stefano Stabellini

On Fri, Nov 28, Olaf Hering wrote:

> I wonder if the missing disable of the tap device is intentional, or
> just an oversight, or if its just to complicated to get from a
> "PCIDevice *" to the other end and call the ->cleanup function.

qemu-traditional did just close all tap devices. With qemu-upstream a
helper function exists to do all the cleanup. I think in a xen guest
there are just emulated network devices, so the "wipe all remaining"
could be done without breaking anything.


What about something like this?


Index: xen-4.4.1-testing/tools/qemu-xen-dir-remote/hw/xen/xen_platform.c
===================================================================
--- xen-4.4.1-testing.orig/tools/qemu-xen-dir-remote/hw/xen/xen_platform.c
+++ xen-4.4.1-testing/tools/qemu-xen-dir-remote/hw/xen/xen_platform.c
@@ -99,9 +99,11 @@ static void unplug_nic(PCIBus *b, PCIDev
     }
 }
 
+extern void net_cleanup(void);
 static void pci_unplug_nics(PCIBus *bus)
 {
     pci_for_each_device(bus, 0, unplug_nic, NULL);
+    net_cleanup();
 }
 
 static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)


Olaf

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

* Re: get a handle for the tap device to shut it down
@ 2014-12-02 15:53   ` Olaf Hering
  0 siblings, 0 replies; 3+ messages in thread
From: Olaf Hering @ 2014-12-02 15:53 UTC (permalink / raw)
  To: qemu-devel, xen-devel; +Cc: Stefano Stabellini

On Fri, Nov 28, Olaf Hering wrote:

> I wonder if the missing disable of the tap device is intentional, or
> just an oversight, or if its just to complicated to get from a
> "PCIDevice *" to the other end and call the ->cleanup function.

qemu-traditional did just close all tap devices. With qemu-upstream a
helper function exists to do all the cleanup. I think in a xen guest
there are just emulated network devices, so the "wipe all remaining"
could be done without breaking anything.


What about something like this?


Index: xen-4.4.1-testing/tools/qemu-xen-dir-remote/hw/xen/xen_platform.c
===================================================================
--- xen-4.4.1-testing.orig/tools/qemu-xen-dir-remote/hw/xen/xen_platform.c
+++ xen-4.4.1-testing/tools/qemu-xen-dir-remote/hw/xen/xen_platform.c
@@ -99,9 +99,11 @@ static void unplug_nic(PCIBus *b, PCIDev
     }
 }
 
+extern void net_cleanup(void);
 static void pci_unplug_nics(PCIBus *bus)
 {
     pci_for_each_device(bus, 0, unplug_nic, NULL);
+    net_cleanup();
 }
 
 static void unplug_disks(PCIBus *b, PCIDevice *d, void *o)


Olaf

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

end of thread, other threads:[~2014-12-02 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-28 15:47 get a handle for the tap device to shut it down Olaf Hering
2014-12-02 15:53 ` [Qemu-devel] " Olaf Hering
2014-12-02 15:53   ` Olaf Hering

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.