From: Sam Li <faithilikerun@gmail.com>
To: "Matias Bjørling" <m@bjorling.me>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Raphael Norwitz <raphael.norwitz@nutanix.com>,
qemu-block@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
damien.lemoal@opensource.wdc.com, kvm@vger.kernel.org,
hare@suse.de, Paolo Bonzini <pbonzini@redhat.com>,
dmitry.fomichev@wdc.com, Hanna Reitz <hreitz@redhat.com>,
Cornelia Huck <cohuck@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Eric Blake <eblake@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v8 2/4] virtio-blk: add zoned storage emulation for zoned devices
Date: Thu, 23 Mar 2023 21:43:43 +0800 [thread overview]
Message-ID: <CAAAx-8L5RBeMmcL8UvxNNc8aYCeGMwKm4O65EiFcKCMmdZo4FQ@mail.gmail.com> (raw)
In-Reply-To: <a826f507-d216-adfb-1212-4d577db0ce9f@bjorling.me>
Matias Bjørling <m@bjorling.me> 于2023年3月23日周四 21:39写道:
>
> On 23/03/2023 06.28, Sam Li wrote:
> > This patch extends virtio-blk emulation to handle zoned device commands
> > by calling the new block layer APIs to perform zoned device I/O on
> > behalf of the guest. It supports Report Zone, four zone oparations (open,
> > close, finish, reset), and Append Zone.
> >
> > The VIRTIO_BLK_F_ZONED feature bit will only be set if the host does
> > support zoned block devices. Regular block devices(conventional zones)
> > will not be set.
> >
> > The guest os can use blktests, fio to test those commands on zoned devices.
> > Furthermore, using zonefs to test zone append write is also supported.
> >
> > Signed-off-by: Sam Li <faithilikerun@gmail.com>
> > ---
> > hw/block/virtio-blk-common.c | 2 +
> > hw/block/virtio-blk.c | 389 +++++++++++++++++++++++++++++++++++
> > 2 files changed, 391 insertions(+)
> >
> > diff --git a/hw/block/virtio-blk-common.c b/hw/block/virtio-blk-common.c
> > index ac52d7c176..e2f8e2f6da 100644
> > --- a/hw/block/virtio-blk-common.c
> > +++ b/hw/block/virtio-blk-common.c
> > @@ -29,6 +29,8 @@ static const VirtIOFeature feature_sizes[] = {
> > .end = endof(struct virtio_blk_config, discard_sector_alignment)},
> > {.flags = 1ULL << VIRTIO_BLK_F_WRITE_ZEROES,
> > .end = endof(struct virtio_blk_config, write_zeroes_may_unmap)},
> > + {.flags = 1ULL << VIRTIO_BLK_F_ZONED,
> > + .end = endof(struct virtio_blk_config, zoned)},
> > {}
> > };
>
> I used the qemu monitor to expect the state of the devices, and on the
> zoned block device specific entries, the zoned device feature shows up
> in the "unknown-features" field (info virtio-status <device>)
>
> What is missing is an entry in the blk_feature_map structure within
> hw/virtio/virtio-qmp.c. The below fixes it up.
>
> diff --git i/hw/virtio/virtio-qmp.c w/hw/virtio/virtio-qmp.c
> index b70148aba9..3efa529bab 100644
> --- i/hw/virtio/virtio-qmp.c
> +++ w/hw/virtio/virtio-qmp.c
> @@ -176,6 +176,8 @@ static const qmp_virtio_feature_map_t
> virtio_blk_feature_map[] = {
> "VIRTIO_BLK_F_DISCARD: Discard command supported"),
> FEATURE_ENTRY(VIRTIO_BLK_F_WRITE_ZEROES, \
> "VIRTIO_BLK_F_WRITE_ZEROES: Write zeroes command supported"),
> + FEATURE_ENTRY(VIRTIO_BLK_F_ZONED, \
> + "VIRTIO_BLK_F_ZONED: Zoned block device"),
> #ifndef VIRTIO_BLK_NO_LEGACY
> FEATURE_ENTRY(VIRTIO_BLK_F_BARRIER, \
> "VIRTIO_BLK_F_BARRIER: Request barriers supported"),
>
> Which then lets qemu report the support like this:
>
> (qemu) info virtio-status /machine/peripheral/virtblk0/virtio-backend
> /machine/peripheral/virtblk0/virtio-backend:
> device_name: virtio-blk
> device_id: 2
> vhost_started: false
> bus_name: (null)
> broken: false
> disabled: false
> disable_legacy_check: false
> started: true
> use_started: true
> start_on_kick: false
> use_guest_notifier_mask: true
> vm_running: true
> num_vqs: 4
> queue_sel: 3
> isr: 1
> endianness: little
> status:
> VIRTIO_CONFIG_S_ACKNOWLEDGE: Valid virtio device found,
> VIRTIO_CONFIG_S_DRIVER: Guest OS compatible with device,
> VIRTIO_CONFIG_S_FEATURES_OK: Feature negotiation complete,
> VIRTIO_CONFIG_S_DRIVER_OK: Driver setup and ready
> Guest features:
> VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled,
> VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported,
> VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy)
> VIRTIO_BLK_F_CONFIG_WCE: Cache writeback and ...,
> VIRTIO_BLK_F_FLUSH: Flush command supported,
> VIRTIO_BLK_F_ZONED: Zoned block device,
> VIRTIO_BLK_F_WRITE_ZEROES: Write zeroes command supported,
> VIRTIO_BLK_F_MQ: Multiqueue supported,
> VIRTIO_BLK_F_TOPOLOGY: Topology information available,
> VIRTIO_BLK_F_BLK_SIZE: Block size of disk available,
> VIRTIO_BLK_F_GEOMETRY: Legacy geometry available,
> VIRTIO_BLK_F_SEG_MAX: Max segments in a request is seg_max
> unknown-features(0x0000010000000000)
> Host features:
> VIRTIO_RING_F_EVENT_IDX: Used & avail. event fields enabled,
> VIRTIO_RING_F_INDIRECT_DESC: Indirect descriptors supported,
> VIRTIO_F_VERSION_1: Device compliant for v1 spec (legacy),
> VIRTIO_F_ANY_LAYOUT: Device accepts arbitrary desc. layouts,
> VIRTIO_F_NOTIFY_ON_EMPTY: Notify when device ...,
> VHOST_USER_F_PROTOCOL_FEATURES: Vhost-user protocol ...,
> VIRTIO_BLK_F_CONFIG_WCE: Cache writeback and w...,
> VIRTIO_BLK_F_FLUSH: Flush command supported,
> VIRTIO_BLK_F_ZONED: Zoned block device,
> VIRTIO_BLK_F_WRITE_ZEROES: Write zeroes command supported,
> VIRTIO_BLK_F_MQ: Multiqueue supported,
> VIRTIO_BLK_F_TOPOLOGY: Topology information available,
> VIRTIO_BLK_F_BLK_SIZE: Block size of disk available,
> VIRTIO_BLK_F_GEOMETRY: Legacy geometry available,
> VIRTIO_BLK_F_SEG_MAX: Max segments in a request is seg_max
> unknown-features(0x0000010000000000)
> Backend features:
Great!
>
> Cheers, Matias
next prev parent reply other threads:[~2023-03-23 13:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 5:28 [PATCH v8 0/4] Add zoned storage emulation to virtio-blk driver Sam Li
2023-03-23 5:28 ` [PATCH v8 1/4] include: update virtio_blk headers to v6.3-rc1 Sam Li
2023-03-23 5:28 ` [PATCH v8 2/4] virtio-blk: add zoned storage emulation for zoned devices Sam Li
2023-03-23 13:39 ` Matias Bjørling
2023-03-23 13:43 ` Sam Li [this message]
2023-03-23 5:28 ` [PATCH v8 3/4] block: add accounting for zone append operation Sam Li
2023-03-23 7:14 ` Markus Armbruster
2023-03-23 5:28 ` [PATCH v8 4/4] virtio-blk: add some trace events for zoned emulation Sam Li
2023-03-23 13:26 ` [PATCH v8 0/4] Add zoned storage emulation to virtio-blk driver Matias Bjørling
2023-03-23 13:38 ` Sam Li
2023-03-23 19:23 ` Stefan Hajnoczi
2023-03-23 19:26 ` 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=CAAAx-8L5RBeMmcL8UvxNNc8aYCeGMwKm4O65EiFcKCMmdZo4FQ@mail.gmail.com \
--to=faithilikerun@gmail.com \
--cc=armbru@redhat.com \
--cc=cohuck@redhat.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=dmitry.fomichev@wdc.com \
--cc=eblake@redhat.com \
--cc=hare@suse.de \
--cc=hreitz@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwolf@redhat.com \
--cc=m@bjorling.me \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=stefanha@redhat.com \
/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).