From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzPk1-0002fD-8h for qemu-devel@nongnu.org; Tue, 24 Jun 2014 08:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzPjs-0001HI-7k for qemu-devel@nongnu.org; Tue, 24 Jun 2014 08:22:25 -0400 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]:38665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzPjr-0001Gx-WD for qemu-devel@nongnu.org; Tue, 24 Jun 2014 08:22:16 -0400 Received: by mail-we0-f171.google.com with SMTP id q58so254137wes.16 for ; Tue, 24 Jun 2014 05:22:12 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <53A96D6F.5010609@redhat.com> Date: Tue, 24 Jun 2014 14:22:07 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1403085516-10340-1-git-send-email-stefanha@redhat.com> In-Reply-To: <1403085516-10340-1-git-send-email-stefanha@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 , qemu-devel@nongnu.org Cc: cornelia.huck@de.ibm.com, peter.crosthwaite@xilinx.com, Andreas Faerber Il 18/06/2014 11:58, Stefan Hajnoczi ha scritto: > v4: > * Coding style: typedef struct { on a single line [Andreas] > * Add "dataplane: bail out on unsupported transport" for s390-virtio [Cornelia] > > v3: > * Split qdev_alias_all_properties() into its own patch [Peter Crosthwaite] > * Do not dereference DEVICE_CLASS(class) inline [Peter Crosthwaite] > > v2: > * Add qdev_alias_all_properties() instead of virtio-blk-specific function [Paolo] > * Explain refcount handling in doc comment [Paolo] > * Fix "property" duplicate typo [Peter Crosthwaite] > * Add "the same object or" to clarify commit description [Igor] > > 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 level. > > Note that this series only addresses virtio-blk. In later series we can > convert virtio net, scsi, rng, and serial. > > The virtio transport/device split is broken as follows: > > 1. The virtio-blk device is never finalized because the transport devices > (virtio-blk-pci and friends) leak the refcount. > > 2. If we fix the refcount leak then we double-free the 'serial' string property > upon hot unplug since its char* is copied into the virtio-blk device which > has an identical 'serial' qdev property. > > This series solves both of these problems as follows: > > 1. Introduce a QOM alias property that lets the transport device forward > property accesses into the virtio device (the child). > > 2. Use alias properties in transport devices, instead of keeping a duplicate > copy of the VirtIOBlkConf struct. > > 3. Fix the virtio-blk device refcount leak. It's now safe to do this since the > double-free has been resolved. > > Tested that hotplug/hotunplug of virtio-blk-pci still works. > > Cornelia Huck (1): > dataplane: bail out on unsupported transport > > 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 > > 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(-) > Andreas, can you review this series? Paolo