From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:41085) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5zA3-0001A2-9I for qemu-devel@nongnu.org; Mon, 27 Aug 2012 09:15:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5z9t-0005S8-P0 for qemu-devel@nongnu.org; Mon, 27 Aug 2012 09:15:23 -0400 Received: from mail-ob0-f173.google.com ([209.85.214.173]:40333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5z9t-0005QR-JP for qemu-devel@nongnu.org; Mon, 27 Aug 2012 09:15:13 -0400 Received: by obbta14 with SMTP id ta14so7568793obb.4 for ; Mon, 27 Aug 2012 06:15:12 -0700 (PDT) From: Anthony Liguori In-Reply-To: <503B637A.7060905@redhat.com> References: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> <503B5DFD.2030106@suse.de> <503B637A.7060905@redhat.com> Date: Mon, 27 Aug 2012 08:15:08 -0500 Message-ID: <877gskh3xf.fsf@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH 0/9] qom: improve reference counting and hotplug List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Andreas =?utf-8?Q?F=C3=A4rber?= Cc: Liu Ping Fan , liu ping fan , qemu-devel@nongnu.org Paolo Bonzini writes: > Il 27/08/2012 13:46, Andreas F=C3=A4rber ha scritto: >>>> >> >>>> >> Since link and child properties all hold references, in order to ac= tually free >>>> >> an object, we need to break those links. User created devices end = up as >>>> >> children of a container. But child properties cannot be removed wh= ich means >>>> >> there's no obvious way to remove the reference and ultimately free = the object. >>>> >> >>> > Why? Since we call _add_child() in qdev_device_add(), why can not we >>> > call object_property_del_child() for qmp_device_del(). Could you >>> > explain it more detail? >> Seconded. If we hot-unplug a device, we should surely remove its child<> >> property from /machine/unassigned or parent bus or whatever. That's exactly what is happening in this series. qmp_device_del adds an ejection notifier that unparents the device to remove the last reference co= unt. > > Sure, as soon as the device is ejected by the guest. But until that > point we need to keep the device in the QOM tree so that: 1) it has a > canonical path; 2) it can be examined; 3) it keeps children alive. > >> Why is it that child<> properties cannot be removed? > > Yeah, I didn't quite understand the difference between unparenting and > setting the child property to NULL. They are exactly the same thing. Setting the child property to NULL is unparenting. Unparenting is essentially deleting. This series makes it such that there is a white list of devices that are capable of being deleted. Regards, Anthony Liguori > > Paolo