From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5zuH-00026i-4L for qemu-devel@nongnu.org; Mon, 27 Aug 2012 10:03:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5zu8-0007Ly-Al for qemu-devel@nongnu.org; Mon, 27 Aug 2012 10:03:08 -0400 Received: from cantor2.suse.de ([195.135.220.15]:58481 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5zu8-0007Lg-1A for qemu-devel@nongnu.org; Mon, 27 Aug 2012 10:03:00 -0400 Message-ID: <503B7E11.6050009@suse.de> Date: Mon, 27 Aug 2012 16:02:57 +0200 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> <1345996298-4892-4-git-send-email-aliguori@us.ibm.com> In-Reply-To: <1345996298-4892-4-git-send-email-aliguori@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 3/9] qbus: remove glib_allocated/qom_allocated and use release hook to free memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: Paolo Bonzini , Liu Ping Fan , qemu-devel@nongnu.org Am 26.08.2012 17:51, schrieb Anthony Liguori: > Signed-off-by: Anthony Liguori That's a really nice solution for cleaning this up, thanks! Acked-by: Andreas F=E4rber However one conceptional detail... > --- > hw/pci.c | 7 ++++++- > hw/qdev.c | 15 --------------- > hw/qdev.h | 7 ------- > hw/sysbus.c | 7 ++++++- > 4 files changed, 12 insertions(+), 24 deletions(-) [...] > diff --git a/hw/qdev.c b/hw/qdev.c > index b5a52ac..6b61daa 100644 > --- a/hw/qdev.c > +++ b/hw/qdev.c [...] > @@ -468,18 +466,6 @@ BusState *qbus_create(const char *typename, Device= State *parent, const char *nam > return bus; > } > =20 > -void qbus_free(BusState *bus) > -{ > - if (bus->qom_allocated) { > - object_delete(OBJECT(bus)); > - } else { > - object_finalize(OBJECT(bus)); > - if (bus->glib_allocated) { > - g_free(bus); > - } > - } > -} > - > static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev) > { > BusClass *bc =3D BUS_GET_CLASS(bus); > @@ -698,7 +684,6 @@ static void device_finalize(Object *obj) > if (dev->state =3D=3D DEV_STATE_INITIALIZED) { > while (dev->num_child_bus) { > bus =3D QLIST_FIRST(&dev->child_bus); > - qbus_free(bus); > } > if (qdev_get_vmsd(dev)) { > vmstate_unregister(dev, qdev_get_vmsd(dev), dev); I wonder how this is gonna work: The device used to be in charge of tearing down its bus children ... now it neither deletes nor finalizes nor unrefs? Is the while loop even still needed? Wouldn't the busses still have the device as parent, referencing it, blocking device_finalize? Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg