virtio_cleanup() missing in virtio-{blk, balloon, 9p}-pci
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.
Am 11.10.2010 12:00, schrieb Markus Armbruster:
Quoted 7 lines
Pattern:
FOO's PCIDeviceInfo method exit is
virtio_FOO_exit_pci(), which callsvirtio_FOO_exit()andvirtio_exit_pci().virtio_{net,serial}_exit() call
virtio_cleanup().
Quoted 8 lines
virtio_blk_exit()doesn't. Why?virtio-balloon-pci uses
virtio_exit_pci()as exit method. Novirtio_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
Quoted 5 lines
Pattern:
FOO's PCIDeviceInfo method exit is
virtio_FOO_exit_pci(), which callsvirtio_FOO_exit()andvirtio_exit_pci().
Quoted 8 lines
virtio_{net,serial}_exit() call
virtio_cleanup().
virtio_blk_exit()doesn't. Why?virtio-balloon-pci uses
virtio_exit_pci()as exit method. Novirtio_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
Quoted 9 lines · M. Mohan Kumar
Quoted 9 lines
Pattern:
FOO's PCIDeviceInfo method exit is
virtio_FOO_exit_pci(), which callsvirtio_FOO_exit()andvirtio_exit_pci().virtio_{net,serial}_exit() call
virtio_cleanup().
virtio_blk_exit()doesn't. Why?
Quoted 7 lines
Quoted 4 lines
virtio-balloon-pci uses
virtio_exit_pci()as exit method. Novirtio_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_exitwhen we are adding support for hot-plug
If hot plug is not expected to work, perhaps the driver should refuse it. Untested sketch:
hw/virtio-pci.c +5 -0
@@ -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,