qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: arei.gonglei@huawei.com
Cc: weidong.huang@huawei.com, mst@redhat.com, armbru@redhat.com,
	luonengjun@huawei.com, agraf@suse.de, qemu-devel@nongnu.org,
	borntraeger@de.ibm.com, stefanha@redhat.com, pbonzini@redhat.com,
	peter.huangpeng@huawei.com, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports
Date: Fri, 26 Sep 2014 16:21:25 +0200	[thread overview]
Message-ID: <20140926162125.71ea6598.cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1411721147-11712-1-git-send-email-arei.gonglei@huawei.com>

On Fri, 26 Sep 2014 16:45:38 +0800
<arei.gonglei@huawei.com> wrote:

> From: Gonglei <arei.gonglei@huawei.com>
> 
> virtio-$device-{pci, s390, ccw} all duplicate the
> qdev properties of their virtio child. This approach does
> not work well with string or pointer properties since we
> must be careful about leaking or double-freeing them.
> 
> Use the QOM alias property to forward property accesses to the
> VirtIORNG child.  This way no duplication is necessary.
> 
> For their child, 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-$device child is not finalized!
> 
> Drop our reference after the child property has been added to the
> parent.
> 
> Attention please:
>  As Michael's comments, the patches will introduce regresion about
>  "-device FOO,help", which had been fixed by my other patch series:
>   [PATCH v2 0/7] add description field in ObjectProperty and PropertyInfo struct
>  http://lists.nongnu.org/archive/html/qemu-devel/2014-09/msg04908.html
> 
> Acknowledgements:
>  I copied Stefan's commit c5d49db message about virtio-blk which
>  summarized reasons very well, I cannot agree more with him.
>  Holp Stefan do not mind, thanks!
> 
> Please review, Thanks a lot!

Do you have a git branch for quick testing?

> -Gonglei
> 
> Gonglei (9):
>   virtio-net: use aliases instead of duplicate qdev properties
>   virtio: fix virtio-net child refcount in transports
>   virtio/vhost scsi: use aliases instead of duplicate qdev properties
>   virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in
>     transports
>   virtio-serial: use aliases instead of duplicate qdev properties
>   virtio-serial: fix virtio-serial child refcount in transports
>   virtio-rng: use aliases instead of duplicate qdev properties
>   virtio-rng: fix virtio-rng child refcount in transports
>   virtio-balloon: fix virtio-balloon child refcount in transports
> 
>  hw/s390x/s390-virtio-bus.c | 16 ++++++++++------
>  hw/s390x/virtio-ccw.c      | 18 +++++++++++-------
>  hw/virtio/virtio-pci.c     | 18 +++++++++++-------
>  3 files changed, 32 insertions(+), 20 deletions(-)

One thing I noticed is that the various devices end up with similar
code in the end:

     object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_WHATEVER);
     object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
     object_unref(OBJECT(&dev->vdev));
     qdev_alias_all_properties(DEVICE(&dev->vdev), obj);

Would it make sense to add a helper function for that?

  parent reply	other threads:[~2014-09-26 14:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-26  8:45 [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 1/9] virtio-net: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 2/9] virtio: fix virtio-net child refcount in transports arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 3/9] virtio/vhost scsi: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 4/9] virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 5/9] virtio-serial: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 6/9] virtio-serial: fix virtio-serial child refcount in transports arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 7/9] virtio-rng: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 8/9] virtio-rng: fix virtio-rng child refcount in transports arei.gonglei
2014-09-26  8:45 ` [Qemu-devel] [PATCH RESEND 9/9] virtio-balloon: fix virtio-balloon " arei.gonglei
2014-09-26 14:21 ` Cornelia Huck [this message]
2014-09-27  4:46   ` [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount " Gonglei (Arei)
2014-09-27 10:37   ` Gonglei (Arei)
2014-09-29 10:53     ` Cornelia Huck
2014-09-29 12:09       ` Gonglei (Arei)
2014-09-29 12:33         ` Michael S. Tsirkin
2014-09-29 13:10           ` Cornelia Huck
2014-09-30  0:57             ` Gonglei (Arei)
2014-09-29 12:32       ` Paolo Bonzini
2014-09-29 12:37         ` Gonglei (Arei)
2014-09-29 11:32 ` Cornelia Huck
2014-09-29 12:26   ` Gonglei (Arei)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140926162125.71ea6598.cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=luonengjun@huawei.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).