From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Andreas Faerber <afaerber@suse.de>,
Stefan Hajnoczi <stefanha@redhat.com>,
fred.konrad@greensocs.com
Subject: [Qemu-devel] [RFC 0/5] virtio: use alias properties in transport devices
Date: Wed, 19 Mar 2014 16:48:53 +0100 [thread overview]
Message-ID: <1395244138-8834-1-git-send-email-stefanha@redhat.com> (raw)
This RFC is just the beginning. The same problem exists for virtio-net and
other devices. I am looking for feedback before I convert all of virtio.
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 qdev child alias property that lets the transport device forward
qdev property accesses into the virtio device (the child).
2. Use qdev child 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.
Note about the new qdev child alias property type: I haven't made the alias
fully transparent yet. Perhaps we should hide the alias completely?
$ qemu-system-x86_64 -device virtio-blk-pci,\?
...
virtio-blk-pci.logical_block_size=ChildAlias <--- should be uint64 or similar
Stefan Hajnoczi (5):
qdev: add child alias properties
virtio: add child alias properties for virtio-blk
virtio: use child aliases for virtio-blk transport properties
virtio-blk: drop virtio_blk_set_conf()
virtio: fix virtio-blk child refcount in transports
hw/block/virtio-blk.c | 6 ------
hw/core/qdev-properties.c | 28 ++++++++++++++++++++++++++++
hw/s390x/s390-virtio-bus.c | 4 ++--
hw/s390x/s390-virtio-bus.h | 1 -
hw/s390x/virtio-ccw.c | 6 +++---
hw/s390x/virtio-ccw.h | 1 -
hw/virtio/virtio-pci.c | 6 +++---
hw/virtio/virtio-pci.h | 1 -
include/hw/block/block.h | 14 ++++++++++++++
include/hw/qdev-properties.h | 28 ++++++++++++++++++++++++++++
include/hw/virtio/virtio-blk.h | 17 ++++++++++++++++-
11 files changed, 94 insertions(+), 18 deletions(-)
--
1.8.5.3
next reply other threads:[~2014-03-19 15:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 15:48 Stefan Hajnoczi [this message]
2014-03-19 15:48 ` [Qemu-devel] [RFC 1/5] qdev: add child alias properties Stefan Hajnoczi
2014-05-14 13:27 ` Andreas Färber
2014-05-14 13:31 ` Paolo Bonzini
2014-05-14 14:13 ` Peter Crosthwaite
2014-05-14 14:17 ` Andreas Färber
2014-05-14 14:26 ` Peter Crosthwaite
2014-03-19 15:48 ` [Qemu-devel] [RFC 2/5] virtio: add child alias properties for virtio-blk Stefan Hajnoczi
2014-05-14 14:04 ` Peter Crosthwaite
2014-05-14 14:33 ` Stefan Hajnoczi
2014-05-14 14:38 ` Peter Crosthwaite
2014-03-19 15:48 ` [Qemu-devel] [RFC 3/5] virtio: use child aliases for virtio-blk transport properties Stefan Hajnoczi
2014-03-19 15:48 ` [Qemu-devel] [RFC 4/5] virtio-blk: drop virtio_blk_set_conf() Stefan Hajnoczi
2014-03-19 15:48 ` [Qemu-devel] [RFC 5/5] virtio: fix virtio-blk child refcount in transports Stefan Hajnoczi
2014-05-14 13:21 ` [Qemu-devel] [RFC 0/5] virtio: use alias properties in transport devices Stefan Hajnoczi
2014-05-16 15:08 ` Frederic Konrad
2014-05-19 14:21 ` Stefan Hajnoczi
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=1395244138-8834-1-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=afaerber@suse.de \
--cc=fred.konrad@greensocs.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).