From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1XFk-0001og-U7 for qemu-devel@nongnu.org; Mon, 30 Jun 2014 04:48:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1XFf-0000sn-9d for qemu-devel@nongnu.org; Mon, 30 Jun 2014 04:47:56 -0400 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:56791) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1XFe-0000sT-V2 for qemu-devel@nongnu.org; Mon, 30 Jun 2014 04:47:51 -0400 Received: by mail-wi0-f175.google.com with SMTP id r20so5601037wiv.8 for ; Mon, 30 Jun 2014 01:47:50 -0700 (PDT) Date: Mon, 30 Jun 2014 10:47:47 +0200 From: Stefan Hajnoczi Message-ID: <20140630084747.GA32764@stefanha-thinkpad.redhat.com> References: <1403085516-10340-1-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5vNYLRcllDrimb99" Content-Disposition: inline In-Reply-To: <1403085516-10340-1-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PATCH v4 0/9] virtio-blk: use alias properties in transport devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: cornelia.huck@de.ibm.com, Paolo Bonzini , peter.crosthwaite@xilinx.com, qemu-devel@nongnu.org, Andreas Faerber --5vNYLRcllDrimb99 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 18, 2014 at 05:58:27PM +0800, Stefan Hajnoczi wrote: > v4: > * Coding style: typedef struct { on a single line [Andreas] > * Add "dataplane: bail out on unsupported transport" for s390-virtio [Co= rnelia] >=20 > v3: > * Split qdev_alias_all_properties() into its own patch [Peter Crosthwait= e] > * Do not dereference DEVICE_CLASS(class) inline [Peter Crosthwaite] >=20 > v2: > * Add qdev_alias_all_properties() instead of virtio-blk-specific functio= n [Paolo] > * Explain refcount handling in doc comment [Paolo] > * Fix "property" duplicate typo [Peter Crosthwaite] > * Add "the same object or" to clarify commit description [Igor] >=20 > Thanks for the feedback on the RFC. This time around the alias property = is > implemented at the QOM property level instead of at the qdev property lev= el. >=20 > Note that this series only addresses virtio-blk. In later series we can > convert virtio net, scsi, rng, and serial. >=20 > The virtio transport/device split is broken as follows: >=20 > 1. The virtio-blk device is never finalized because the transport devices > (virtio-blk-pci and friends) leak the refcount. >=20 > 2. If we fix the refcount leak then we double-free the 'serial' string pr= operty > upon hot unplug since its char* is copied into the virtio-blk device w= hich > has an identical 'serial' qdev property. >=20 > This series solves both of these problems as follows: >=20 > 1. Introduce a QOM alias property that lets the transport device forward > property accesses into the virtio device (the child). >=20 > 2. Use alias properties in transport devices, instead of keeping a duplic= ate > copy of the VirtIOBlkConf struct. >=20 > 3. Fix the virtio-blk device refcount leak. It's now safe to do this sin= ce the > double-free has been resolved. >=20 > Tested that hotplug/hotunplug of virtio-blk-pci still works. >=20 > Cornelia Huck (1): > dataplane: bail out on unsupported transport >=20 > Stefan Hajnoczi (8): > qom: add object_property_add_alias() > virtio-blk: avoid qdev property definition duplication > virtio-blk: move x-data-plane qdev property to virtio-blk.h > qdev: add qdev_alias_all_properties() > virtio-blk: use aliases instead of duplicate qdev properties > virtio-blk: drop virtio_blk_set_conf() > virtio: fix virtio-blk child refcount in transports > virtio-blk: move qdev properties into virtio-blk.c >=20 > hw/block/dataplane/virtio-blk.c | 10 ++++++++ > hw/block/virtio-blk.c | 18 +++++++++------ > hw/core/qdev.c | 21 +++++++++++++++++ > hw/s390x/s390-virtio-bus.c | 10 ++------ > hw/s390x/s390-virtio-bus.h | 1 - > hw/s390x/virtio-ccw.c | 7 ++---- > hw/s390x/virtio-ccw.h | 1 - > hw/virtio/virtio-pci.c | 7 ++---- > hw/virtio/virtio-pci.h | 1 - > include/hw/qdev-properties.h | 2 ++ > include/hw/virtio/virtio-blk.h | 19 --------------- > include/qom/object.h | 20 ++++++++++++++++ > qom/object.c | 51 +++++++++++++++++++++++++++++++++++= ++++++ > 13 files changed, 121 insertions(+), 47 deletions(-) Applied to my block tree: https://github.com/stefanha/qemu/commits/block Stefan --5vNYLRcllDrimb99 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJTsSQzAAoJEJykq7OBq3PI1ZoIAMWpeJyqABRHa5gVvROt2Czl sGmnh+C3H/fyxk1DYiiXwTEyx7tdHzWu8zHhFrZJCQ5mGzFhzxV/0CdftjQNIHfk oxXHRIzuASVGVFUBvJqMk+IcYisooLRTNjf8J/LD4XPVS2m/dLa6vwKz0ULpkOhf 58HulE1jk7pUd3Q8JpkN/jrtoeHmi+TnUCBsEDzYFE1V4lePRMBjmi/nV/BpkmtA Rq27K3fJi2FcB5UYP2YYo7VcTew33qkvaGN3bLA7K9KHZ3GP7MvSdTvzhaQEf5yj tTJktdNjC5rOVGnHRXWygWyMbjqtnFL6kzlSMRQztJw0Ic1poXVdVNnXHI+7fO4= =4BYI -----END PGP SIGNATURE----- --5vNYLRcllDrimb99--