Message ID | 5daa3ce7cc77ed1bbec75f96361362e3e627cd6d.1311833521.git.amit.shah@redhat.com |
---|---|
State | New |
Headers | show |
On (Thu) 28 Jul 2011 [11:47:15], Amit Shah wrote: > Add an exit handler that will free up RAM and unregister the savevm > section after a virtio-balloon device is unplugged. This commit message should be changed; I'll do that in the pull request I send out. Amit
Amit Shah <amit.shah@redhat.com> writes: > Add an exit handler that will free up RAM and unregister the savevm > section after a virtio-balloon device is unplugged. > > Signed-off-by: Amit Shah <amit.shah@redhat.com> > --- > hw/virtio-balloon.c | 5 +++++ > hw/virtio-pci.c | 11 ++++++++++- > hw/virtio.h | 1 + > 3 files changed, 16 insertions(+), 1 deletions(-) > > diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c > index 26ee364..0ce0049 100644 > --- a/hw/virtio-balloon.c > +++ b/hw/virtio-balloon.c > @@ -297,3 +297,8 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev) > > return &s->vdev; > } > + > +void virtio_balloon_exit(VirtIODevice *vdev) > +{ > + virtio_cleanup(vdev); > +} > diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c > index ca5f125..316bf92 100644 > --- a/hw/virtio-pci.c > +++ b/hw/virtio-pci.c > @@ -795,6 +795,15 @@ static int virtio_balloon_init_pci(PCIDevice *pci_dev) > return 0; > } > > +static int virtio_balloon_exit_pci(PCIDevice *pci_dev) > +{ > + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); > + > + virtio_pci_stop_ioeventfd(proxy); > + virtio_balloon_exit(proxy->vdev); > + return virtio_exit_pci(pci_dev); > +} > + Same code in every other virtio_*_exit_pci(). Suggests there's something wrong with the generic code. Outside the scope of this series, of course. [...]
Amit Shah <amit.shah@redhat.com> writes: > On (Thu) 28 Jul 2011 [11:47:15], Amit Shah wrote: >> Add an exit handler that will free up RAM and unregister the savevm >> section after a virtio-balloon device is unplugged. > > This commit message should be changed; I'll do that in the pull > request I send out. You mean drop "unregister the savevm", because it has become PATCH 5/5?
On (Thu) 28 Jul 2011 [09:39:40], Markus Armbruster wrote: > Amit Shah <amit.shah@redhat.com> writes: > > > On (Thu) 28 Jul 2011 [11:47:15], Amit Shah wrote: > >> Add an exit handler that will free up RAM and unregister the savevm > >> section after a virtio-balloon device is unplugged. > > > > This commit message should be changed; I'll do that in the pull > > request I send out. > > You mean drop "unregister the savevm", because it has become PATCH 5/5? Right. Amit
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c index 26ee364..0ce0049 100644 --- a/hw/virtio-balloon.c +++ b/hw/virtio-balloon.c @@ -297,3 +297,8 @@ VirtIODevice *virtio_balloon_init(DeviceState *dev) return &s->vdev; } + +void virtio_balloon_exit(VirtIODevice *vdev) +{ + virtio_cleanup(vdev); +} diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c index ca5f125..316bf92 100644 --- a/hw/virtio-pci.c +++ b/hw/virtio-pci.c @@ -795,6 +795,15 @@ static int virtio_balloon_init_pci(PCIDevice *pci_dev) return 0; } +static int virtio_balloon_exit_pci(PCIDevice *pci_dev) +{ + VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev); + + virtio_pci_stop_ioeventfd(proxy); + virtio_balloon_exit(proxy->vdev); + return virtio_exit_pci(pci_dev); +} + static PCIDeviceInfo virtio_info[] = { { .qdev.name = "virtio-blk-pci", @@ -869,7 +878,7 @@ static PCIDeviceInfo virtio_info[] = { .qdev.alias = "virtio-balloon", .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_balloon_init_pci, - .exit = virtio_exit_pci, + .exit = virtio_balloon_exit_pci, .vendor_id = PCI_VENDOR_ID_REDHAT_QUMRANET, .device_id = PCI_DEVICE_ID_VIRTIO_BALLOON, .revision = VIRTIO_PCI_ABI_VERSION, diff --git a/hw/virtio.h b/hw/virtio.h index 0fd0bb0..c129264 100644 --- a/hw/virtio.h +++ b/hw/virtio.h @@ -213,6 +213,7 @@ VirtIODevice *virtio_9p_init(DeviceState *dev, V9fsConf *conf); void virtio_net_exit(VirtIODevice *vdev); void virtio_blk_exit(VirtIODevice *vdev); void virtio_serial_exit(VirtIODevice *vdev); +void virtio_balloon_exit(VirtIODevice *vdev); #define DEFINE_VIRTIO_COMMON_FEATURES(_state, _field) \ DEFINE_PROP_BIT("indirect_desc", _state, _field, \
Add an exit handler that will free up RAM and unregister the savevm section after a virtio-balloon device is unplugged. Signed-off-by: Amit Shah <amit.shah@redhat.com> --- hw/virtio-balloon.c | 5 +++++ hw/virtio-pci.c | 11 ++++++++++- hw/virtio.h | 1 + 3 files changed, 16 insertions(+), 1 deletions(-)