[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH 0/9] qom: improve reference counting and hot
From: |
Anthony Liguori |
Subject: |
Re: [Qemu-devel] [RFC PATCH 0/9] qom: improve reference counting and hotplug |
Date: |
Mon, 27 Aug 2012 08:15:08 -0500 |
User-agent: |
Notmuch/0.13.2+93~ged93d79 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) |
Paolo Bonzini <address@hidden> writes:
> Il 27/08/2012 13:46, Andreas Färber ha scritto:
>>>> >>
>>>> >> Since link and child properties all hold references, in order to
>>>> >> actually 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 which
>>>> >> 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 count.
>
> 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