From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:36309) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmL8S-00007O-HA for qemu-devel@nongnu.org; Thu, 28 Jul 2011 03:36:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmL8Q-0003al-D9 for qemu-devel@nongnu.org; Thu, 28 Jul 2011 03:36:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmL8Q-0003aT-4e for qemu-devel@nongnu.org; Thu, 28 Jul 2011 03:35:58 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6S7ZvHx024089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Jul 2011 03:35:57 -0400 From: Markus Armbruster References: <5daa3ce7cc77ed1bbec75f96361362e3e627cd6d.1311833521.git.amit.shah@redhat.com> Date: Thu, 28 Jul 2011 09:35:55 +0200 In-Reply-To: <5daa3ce7cc77ed1bbec75f96361362e3e627cd6d.1311833521.git.amit.shah@redhat.com> (Amit Shah's message of "Thu, 28 Jul 2011 11:47:15 +0530") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2 4/5] virtio-balloon: Add exit handler, fix memleaks List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: qemu list , "Michael S. Tsirkin" Amit Shah 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 > --- > 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. [...]