mbox series

[0/3] virtio-blk: support zoned block devices

Message ID 20220919022921.946344-1-dmitry.fomichev@wdc.com (mailing list archive)
Headers show
Series virtio-blk: support zoned block devices | expand

Message

Dmitry Fomichev Sept. 19, 2022, 2:29 a.m. UTC
In its current form, the virtio protocol for block devices (virtio-blk)
is not aware of zoned block devices (ZBDs) but it allows the driver to
successfully scan a host-managed drive provided by the virtio block
device. As the result, the host-managed drive is recognized by the
virtio driver as a regular, non-zoned drive that will operate
erroneously under the most common write workloads. Host-aware ZBDs are
currently usable, but their performance may not be optimal because the
driver can only see them as non-zoned block devices.

To fix this, the virtio-blk protocol needs to be extended to add the
capabilities to convey the zone characteristics of ZBDs at the device
side to the driver and to provide support for ZBD-specific commands -
Report Zones, four zone operations (Open, Close, Finish and Reset) and
(optionally) Zone Append.

The required virtio-blk protocol extensions are currently under review
at OASIS Technical Committee and the specification patch is linked at

https://github.com/oasis-tcs/virtio-spec/issues/143 .

The QEMU zoned device code that implements these protocol extensions
has been developed by Sam Li, an intern, as a part of Outreachy
community mentorship initiative. The latest version of the QEMU
patchset can be found here:

https://lists.gnu.org/archive/html/qemu-devel/2022-09/msg01469.html

This patch series modifies the virtio block driver code to implement
the above virtio specification extensions. This patch has been tested
to be compatible with the QEMU implementation referred above.

Dmitry Fomichev (3):
  virtio-blk: use a helper to handle request queuing errors
  virtio-blk: add a placeholder for secure erase config
  virtio-blk: add support for zoned block devices

 drivers/block/virtio_blk.c      | 410 +++++++++++++++++++++++++++++---
 include/uapi/linux/virtio_blk.h | 109 +++++++++
 2 files changed, 488 insertions(+), 31 deletions(-)

Comments

Christoph Hellwig Sept. 20, 2022, 7:43 a.m. UTC | #1
On Sun, Sep 18, 2022 at 10:29:18PM -0400, Dmitry Fomichev wrote:
> In its current form, the virtio protocol for block devices (virtio-blk)
> is not aware of zoned block devices (ZBDs) but it allows the driver to
> successfully scan a host-managed drive provided by the virtio block
> device. As the result, the host-managed drive is recognized by the
> virtio driver as a regular, non-zoned drive that will operate
> erroneously under the most common write workloads. Host-aware ZBDs are
> currently usable, but their performance may not be optimal because the
> driver can only see them as non-zoned block devices.

What is the advantage in extending virtio-blk vs just using virtio-scsi
or nvme with shadow doorbells that just work?
Stefan Hajnoczi Sept. 20, 2022, 10:41 a.m. UTC | #2
On Tue, 20 Sept 2022 at 03:43, Christoph Hellwig <hch@infradead.org> wrote:
>
> On Sun, Sep 18, 2022 at 10:29:18PM -0400, Dmitry Fomichev wrote:
> > In its current form, the virtio protocol for block devices (virtio-blk)
> > is not aware of zoned block devices (ZBDs) but it allows the driver to
> > successfully scan a host-managed drive provided by the virtio block
> > device. As the result, the host-managed drive is recognized by the
> > virtio driver as a regular, non-zoned drive that will operate
> > erroneously under the most common write workloads. Host-aware ZBDs are
> > currently usable, but their performance may not be optimal because the
> > driver can only see them as non-zoned block devices.
>
> What is the advantage in extending virtio-blk vs just using virtio-scsi
> or nvme with shadow doorbells that just work?

virtio-blk is widely used and new request types are added as needed.

QEMU's NVMe emulation may support passing through zoned storage
devices in the future but it doesn't today. Support was implemented in
virtio-blk first because NVMe emulation isn't widely used in
production QEMU VMs.

Stefan
Dmitry Fomichev Sept. 21, 2022, 2:33 a.m. UTC | #3
On Tue, 2022-09-20 at 06:41 -0400, Stefan Hajnoczi wrote:
> On Tue, 20 Sept 2022 at 03:43, Christoph Hellwig <hch@infradead.org> wrote:
> > 
> > On Sun, Sep 18, 2022 at 10:29:18PM -0400, Dmitry Fomichev wrote:
> > > In its current form, the virtio protocol for block devices (virtio-blk)
> > > is not aware of zoned block devices (ZBDs) but it allows the driver to
> > > successfully scan a host-managed drive provided by the virtio block
> > > device. As the result, the host-managed drive is recognized by the
> > > virtio driver as a regular, non-zoned drive that will operate
> > > erroneously under the most common write workloads. Host-aware ZBDs are
> > > currently usable, but their performance may not be optimal because the
> > > driver can only see them as non-zoned block devices.
> > 
> > What is the advantage in extending virtio-blk vs just using virtio-scsi
> > or nvme with shadow doorbells that just work?
> 
> virtio-blk is widely used and new request types are added as needed.
> 
> QEMU's NVMe emulation may support passing through zoned storage
> devices in the future but it doesn't today. Support was implemented in
> virtio-blk first because NVMe emulation isn't widely used in
> production QEMU VMs.
> 
> Stefan
 
A large share of hyperscaler guest VM images only supports virtio for
storage and doesn't define CONFIG_SCSI, COPNFIG_ATA, etc. at all in their
kernel config. This is especially common in hyperscale environments that
are dedicated to serverless computing.

In such environments, there is currently no way to present a zoned device
to the guest user because the virtio-blk driver is not ZBD-aware. An attempt
to virtualize a host-managed drive in this setup causes the drive to show up
at the guest as a regular block device - certainly not an ideal situation.

Dmitry