qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci
@ 2010-10-11 10:00 Markus Armbruster
  2010-10-11 10:19 ` [Qemu-devel] " Kevin Wolf
  2010-10-12 11:59 ` [Qemu-devel] " M. Mohan Kumar
  0 siblings, 2 replies; 4+ messages in thread
From: Markus Armbruster @ 2010-10-11 10:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Venkateswararao Jujjuri, Adam Litke

Pattern:

FOO's PCIDeviceInfo method exit is virtio_FOO_exit_pci(), which calls
virtio_FOO_exit() and virtio_exit_pci().

virtio_{net,serial}_exit() call virtio_cleanup().

virtio_blk_exit() doesn't.  Why?

virtio-balloon-pci uses virtio_exit_pci() as exit method.  No
virtio_cleanup()?

virtio-9p-pci doesn't have an exit method.  Doesn't feel right.

I suspect these three leak memory or worse on hot unplug.

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

* [Qemu-devel] Re: virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci
  2010-10-11 10:00 [Qemu-devel] virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci Markus Armbruster
@ 2010-10-11 10:19 ` Kevin Wolf
  2010-10-12 11:59 ` [Qemu-devel] " M. Mohan Kumar
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2010-10-11 10:19 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Venkateswararao Jujjuri, qemu-devel, Adam Litke

Am 11.10.2010 12:00, schrieb Markus Armbruster:
> Pattern:
> 
> FOO's PCIDeviceInfo method exit is virtio_FOO_exit_pci(), which calls
> virtio_FOO_exit() and virtio_exit_pci().
> 
> virtio_{net,serial}_exit() call virtio_cleanup().
> 
> virtio_blk_exit() doesn't.  Why?
> 
> virtio-balloon-pci uses virtio_exit_pci() as exit method.  No
> virtio_cleanup()?
> 
> virtio-9p-pci doesn't have an exit method.  Doesn't feel right.
> 
> I suspect these three leak memory or worse on hot unplug.

Yes, virtio-blk seems to leak memory there.

We should probably also cancel all running requests before removing the
disk. I suspect not doing this could cause some segfaults when the AIO
callback wants to access a disk that doesn't exist any more.

Kevin

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

* Re: [Qemu-devel] virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci
  2010-10-11 10:00 [Qemu-devel] virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci Markus Armbruster
  2010-10-11 10:19 ` [Qemu-devel] " Kevin Wolf
@ 2010-10-12 11:59 ` M. Mohan Kumar
  2010-10-12 12:18   ` Markus Armbruster
  1 sibling, 1 reply; 4+ messages in thread
From: M. Mohan Kumar @ 2010-10-12 11:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Venkateswararao Jujjuri, Markus Armbruster,
	Adam Litke

> Pattern:
> 
> FOO's PCIDeviceInfo method exit is virtio_FOO_exit_pci(), which calls
> virtio_FOO_exit() and virtio_exit_pci().
> 
> virtio_{net,serial}_exit() call virtio_cleanup().
> 
> virtio_blk_exit() doesn't.  Why?
> 
> virtio-balloon-pci uses virtio_exit_pci() as exit method.  No
> virtio_cleanup()?
> 
> virtio-9p-pci doesn't have an exit method.  Doesn't feel right.

9p does not support hot-plug now. We will implement virtio_9p_exit when we are 
adding support for hot-plug

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

* Re: [Qemu-devel] virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci
  2010-10-12 11:59 ` [Qemu-devel] " M. Mohan Kumar
@ 2010-10-12 12:18   ` Markus Armbruster
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Armbruster @ 2010-10-12 12:18 UTC (permalink / raw)
  To: M. Mohan Kumar
  Cc: Kevin Wolf, Venkateswararao Jujjuri, qemu-devel, Adam Litke

"M. Mohan Kumar" <mohan@in.ibm.com> writes:

>> Pattern:
>> 
>> FOO's PCIDeviceInfo method exit is virtio_FOO_exit_pci(), which calls
>> virtio_FOO_exit() and virtio_exit_pci().
>> 
>> virtio_{net,serial}_exit() call virtio_cleanup().
>> 
>> virtio_blk_exit() doesn't.  Why?
>> 
>> virtio-balloon-pci uses virtio_exit_pci() as exit method.  No
>> virtio_cleanup()?
>> 
>> virtio-9p-pci doesn't have an exit method.  Doesn't feel right.
>
> 9p does not support hot-plug now. We will implement virtio_9p_exit when we are 
> adding support for hot-plug

If hot plug is not expected to work, perhaps the driver should refuse
it.  Untested sketch:

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 729917d..b09d85d 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -683,6 +683,11 @@ static int virtio_9p_init_pci(PCIDevice *pci_dev)
     VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
     VirtIODevice *vdev;
 
+    if (pci_dev->qdev.hotplugged) {
+        error_report("Device doesn't support hot plug");
+        return -1;
+    }
+
     vdev = virtio_9p_init(&pci_dev->qdev, &proxy->fsconf);
     virtio_init_pci(proxy, vdev,
                     PCI_VENDOR_ID_REDHAT_QUMRANET,

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

end of thread, other threads:[~2010-10-12 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11 10:00 [Qemu-devel] virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci Markus Armbruster
2010-10-11 10:19 ` [Qemu-devel] " Kevin Wolf
2010-10-12 11:59 ` [Qemu-devel] " M. Mohan Kumar
2010-10-12 12:18   ` Markus Armbruster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).