[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 6/7] virtio: fix virtio-blk child refcount in
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 6/7] virtio: fix virtio-blk child refcount in transports |
Date: |
Fri, 30 May 2014 10:57:07 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Thu, May 29, 2014 at 07:11:27PM +1000, Peter Crosthwaite wrote:
> On Fri, May 23, 2014 at 1:40 AM, Stefan Hajnoczi <address@hidden> wrote:
> > object_initialize() leaves the object with a refcount of 1.
> > object_property_add_child() adds its own reference which is dropped
> > again when the property is deleted.
> >
> > The upshot of this is that we always have a refcount >= 1. Upon hot
> > unplug the virtio-blk child is not finalized!
> >
>
> Doesn't this suggest that hot unplug is what's broken? My
> understanding (which is fresh and not 100% yet) is the original == 1
> refcount should be dropped at object deletion time which is this sense
> would be unplug time. This would mean that hot-unplug should
> explicitly object_unref the object (should the intention of hot-unplug
> be to always finalise the device?).
We could add an explicit object_unref() but I think it's simpler to rely
on the QOM child property refcount semantics instead of keeping a
duplicate reference.
object_property_add_child() increments the refcount. Releasing the
child property decrements the refcount again.
Now, in the context of the virtio-blk-pci parent object and its
VirtIOBlock child:
When the parent object is finalized and its properties are released, the
ref to the child will automatically be decremented.
This is exactly what we need.
Stefan
- [Qemu-devel] [PATCH v2 4/7] virtio-blk: use aliases instead of duplicate qdev properties, (continued)
- [Qemu-devel] [PATCH v2 4/7] virtio-blk: use aliases instead of duplicate qdev properties, Stefan Hajnoczi, 2014/05/22
- [Qemu-devel] [PATCH v2 3/7] virtio-blk: move x-data-plane qdev property to virtio-blk.h, Stefan Hajnoczi, 2014/05/22
- [Qemu-devel] [PATCH v2 5/7] virtio-blk: drop virtio_blk_set_conf(), Stefan Hajnoczi, 2014/05/22
- [Qemu-devel] [PATCH v2 6/7] virtio: fix virtio-blk child refcount in transports, Stefan Hajnoczi, 2014/05/22
- [Qemu-devel] [PATCH v2 7/7] virtio-blk: move qdev properties into virtio-blk.c, Stefan Hajnoczi, 2014/05/22
- Re: [Qemu-devel] [PATCH v2 0/7] virtio-blk: use alias properties in transport devices, Stefan Hajnoczi, 2014/05/28