From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46338) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXRAs-0003Gl-36 for qemu-devel@nongnu.org; Fri, 26 Sep 2014 04:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXRAn-0004rz-LL for qemu-devel@nongnu.org; Fri, 26 Sep 2014 04:46:46 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:20539) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXRAm-0004qS-SC for qemu-devel@nongnu.org; Fri, 26 Sep 2014 04:46:41 -0400 From: Date: Fri, 26 Sep 2014 16:45:38 +0800 Message-ID: <1411721147-11712-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: weidong.huang@huawei.com, mst@redhat.com, armbru@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, agraf@suse.de, borntraeger@de.ibm.com, Gonglei , stefanha@redhat.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com, rth@twiddle.net From: Gonglei 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! -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(-) -- 1.7.12.4