qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/9] virtio: fix virtio child recount in transports
@ 2014-09-09  6:35 arei.gonglei
  2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 1/9] virtio-net: use aliases instead of duplicate qdev properties arei.gonglei
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: arei.gonglei @ 2014-09-09  6:35 UTC (permalink / raw)
  To: qemu-devel
  Cc: weidong.huang, mst, luonengjun, peter.huangpeng, agraf,
	borntraeger, Gonglei, stefanha, cornelia.huck, pbonzini, rth

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.

The v1 as below:
 http://lists.gnu.org/archive/html/qemu-devel/2014-09/msg01208.html

Changes since v1:
 1. using alias properties avoid to double-free property.(Stefan)
 2. add handling all other virtio-devices had the same probleam.
 3. same handling for CCW and s390-virito.
 
Acknowledgements:
 I copied Stefan's commit message about virtio-blk which summarized
 reasons very well, I cannot agree more with him. Holp Stefan do not
 mind, thank you so much!

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(-)

-- 
1.7.12.4

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2014-09-19  9:53 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09  6:35 [Qemu-devel] [PATCH v2 0/9] virtio: fix virtio child recount in transports arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 1/9] virtio-net: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-14 18:13   ` Michael S. Tsirkin
2014-09-15  1:03     ` Gonglei (Arei)
2014-09-15  5:36       ` Michael S. Tsirkin
2014-09-15  5:49         ` Gonglei (Arei)
2014-09-15  6:41           ` Michael S. Tsirkin
2014-09-15  7:12             ` Gonglei (Arei)
2014-09-15  8:37               ` Michael S. Tsirkin
2014-09-15  9:06                 ` Gonglei (Arei)
2014-09-15  9:23                 ` Gonglei (Arei)
2014-09-15  9:29                   ` Gonglei (Arei)
2014-09-15  9:59                     ` Michael S. Tsirkin
2014-09-15 14:11                       ` Gonglei (Arei)
2014-09-15  9:58                   ` Michael S. Tsirkin
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 2/9] virtio: fix virtio-net child refcount in transports arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 3/9] virtio/vhost scsi: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 4/9] virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 5/9] virtio-serial: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 6/9] virtio-serial: fix virtio-serial child refcount in transports arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 7/9] virtio-rng: use aliases instead of duplicate qdev properties arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 8/9] virtio-rng: fix virtio-rng child refcount in transports arei.gonglei
2014-09-09  6:35 ` [Qemu-devel] [PATCH v2 9/9] virtio-balloon: fix virtio-balloon " arei.gonglei
2014-09-12 11:55 ` [Qemu-devel] [PATCH v2 0/9] virtio: fix virtio child recount " Gonglei (Arei)
2014-09-19  9:52 ` Gonglei (Arei)

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).