Message ID | 20230323052828.6545-1-faithilikerun@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | Add zoned storage emulation to virtio-blk driver | expand |
On 23/03/2023 06.28, Sam Li wrote: > This patch adds zoned storage emulation to the virtio-blk driver. > > The patch implements the virtio-blk ZBD support standardization that is > recently accepted by virtio-spec. The link to related commit is at > > https://github.com/oasis-tcs/virtio-spec/commit/b4e8efa0fa6c8d844328090ad15db65af8d7d981 > > The Linux zoned device code that implemented by Dmitry Fomichev has been > released at the latest Linux version v6.3-rc1. > > Aside: adding zoned=on alike options to virtio-blk device will be > considered in following-up plan. > > v7: > - address Stefan's review comments > * rm aio_context_acquire/release in handle_req > * rename function return type > * rename BLOCK_ACCT_APPEND to BLOCK_ACCT_ZONE_APPEND for clarity > > v6: > - update headers to v6.3-rc1 > > v5: > - address Stefan's review comments > * restore the way writing zone append result to buffer > * fix error checking case and other errands > > v4: > - change the way writing zone append request result to buffer > - change zone state, zone type value of virtio_blk_zone_descriptor > - add trace events for new zone APIs > > v3: > - use qemuio_from_buffer to write status bit [Stefan] > - avoid using req->elem directly [Stefan] > - fix error checkings and memory leak [Stefan] > > v2: > - change units of emulated zone op coresponding to block layer APIs > - modify error checking cases [Stefan, Damien] > > v1: > - add zoned storage emulation > > Sam Li (4): > include: update virtio_blk headers to v6.3-rc1 > virtio-blk: add zoned storage emulation for zoned devices > block: add accounting for zone append operation > virtio-blk: add some trace events for zoned emulation > > block/qapi-sysemu.c | 11 + > block/qapi.c | 18 + > hw/block/trace-events | 7 + > hw/block/virtio-blk-common.c | 2 + > hw/block/virtio-blk.c | 405 +++++++++++++++++++ > include/block/accounting.h | 1 + > include/standard-headers/drm/drm_fourcc.h | 12 + > include/standard-headers/linux/ethtool.h | 48 ++- > include/standard-headers/linux/fuse.h | 45 ++- > include/standard-headers/linux/pci_regs.h | 1 + > include/standard-headers/linux/vhost_types.h | 2 + > include/standard-headers/linux/virtio_blk.h | 105 +++++ > linux-headers/asm-arm64/kvm.h | 1 + > linux-headers/asm-x86/kvm.h | 34 +- > linux-headers/linux/kvm.h | 9 + > linux-headers/linux/vfio.h | 15 +- > linux-headers/linux/vhost.h | 8 + > qapi/block-core.json | 62 ++- > qapi/block.json | 4 + > 19 files changed, 769 insertions(+), 21 deletions(-) > Hi Sam, I applied your patches and can report that they work with both SMR HDDs and ZNS SSDs. Very nice work! Regarding the documentation (docs/system/qemu-block-drivers.rst.inc). Is it possible to expose the host's zoned block device through something else than virtio-blk? If not, I wouldn't mind seeing the documentation updated to show a case when using the virtio-blk driver. For example (this also includes the device part): -device virtio-blk-pci,drive=drive0,id=virtblk0 \ -blockdev host_device,node-name=drive0,filename=/dev/nullb0,cache.direct=on`` It might also be nice to describe the shorthand for those that likes to pass in the parameters using only the -drive parameter. -drive driver=host_device,file=/dev/nullb0,if=virtio,cache.direct=on Cheers, Matias
Matias Bjørling <m@bjorling.me> 于2023年3月23日周四 21:26写道: > > On 23/03/2023 06.28, Sam Li wrote: > > This patch adds zoned storage emulation to the virtio-blk driver. > > > > The patch implements the virtio-blk ZBD support standardization that is > > recently accepted by virtio-spec. The link to related commit is at > > > > https://github.com/oasis-tcs/virtio-spec/commit/b4e8efa0fa6c8d844328090ad15db65af8d7d981 > > > > The Linux zoned device code that implemented by Dmitry Fomichev has been > > released at the latest Linux version v6.3-rc1. > > > > Aside: adding zoned=on alike options to virtio-blk device will be > > considered in following-up plan. > > > > v7: > > - address Stefan's review comments > > * rm aio_context_acquire/release in handle_req > > * rename function return type > > * rename BLOCK_ACCT_APPEND to BLOCK_ACCT_ZONE_APPEND for clarity > > > > v6: > > - update headers to v6.3-rc1 > > > > v5: > > - address Stefan's review comments > > * restore the way writing zone append result to buffer > > * fix error checking case and other errands > > > > v4: > > - change the way writing zone append request result to buffer > > - change zone state, zone type value of virtio_blk_zone_descriptor > > - add trace events for new zone APIs > > > > v3: > > - use qemuio_from_buffer to write status bit [Stefan] > > - avoid using req->elem directly [Stefan] > > - fix error checkings and memory leak [Stefan] > > > > v2: > > - change units of emulated zone op coresponding to block layer APIs > > - modify error checking cases [Stefan, Damien] > > > > v1: > > - add zoned storage emulation > > > > Sam Li (4): > > include: update virtio_blk headers to v6.3-rc1 > > virtio-blk: add zoned storage emulation for zoned devices > > block: add accounting for zone append operation > > virtio-blk: add some trace events for zoned emulation > > > > block/qapi-sysemu.c | 11 + > > block/qapi.c | 18 + > > hw/block/trace-events | 7 + > > hw/block/virtio-blk-common.c | 2 + > > hw/block/virtio-blk.c | 405 +++++++++++++++++++ > > include/block/accounting.h | 1 + > > include/standard-headers/drm/drm_fourcc.h | 12 + > > include/standard-headers/linux/ethtool.h | 48 ++- > > include/standard-headers/linux/fuse.h | 45 ++- > > include/standard-headers/linux/pci_regs.h | 1 + > > include/standard-headers/linux/vhost_types.h | 2 + > > include/standard-headers/linux/virtio_blk.h | 105 +++++ > > linux-headers/asm-arm64/kvm.h | 1 + > > linux-headers/asm-x86/kvm.h | 34 +- > > linux-headers/linux/kvm.h | 9 + > > linux-headers/linux/vfio.h | 15 +- > > linux-headers/linux/vhost.h | 8 + > > qapi/block-core.json | 62 ++- > > qapi/block.json | 4 + > > 19 files changed, 769 insertions(+), 21 deletions(-) > > > > > Hi Sam, > > I applied your patches and can report that they work with both SMR HDDs > and ZNS SSDs. Very nice work! > > Regarding the documentation (docs/system/qemu-block-drivers.rst.inc). Is > it possible to expose the host's zoned block device through something > else than virtio-blk? If not, I wouldn't mind seeing the documentation > updated to show a case when using the virtio-blk driver. > > For example (this also includes the device part): > > -device virtio-blk-pci,drive=drive0,id=virtblk0 \ > -blockdev > host_device,node-name=drive0,filename=/dev/nullb0,cache.direct=on`` > > It might also be nice to describe the shorthand for those that likes to > pass in the parameters using only the -drive parameter. > > -drive driver=host_device,file=/dev/nullb0,if=virtio,cache.direct=on Hi Matias, I'm glad it works. Thanks for your feedback! For the question, this patch is exposing the zoned interface through virtio-blk only. It's a good suggestion to put a use case inside documentation. I will add it in the subsequent patch. Thanks, Sam
On Thu, Mar 23, 2023 at 09:38:03PM +0800, Sam Li wrote: > Matias Bjørling <m@bjorling.me> 于2023年3月23日周四 21:26写道: > > On 23/03/2023 06.28, Sam Li wrote: > For the question, this patch is exposing the zoned interface through > virtio-blk only. It's a good suggestion to put a use case inside > documentation. I will add it in the subsequent patch. Regarding the state of other zoned devices: --device scsi-block should be able to pass through SCSI ZBC devices. QEMU supports NVMe ZNS emulation for testing, but cannot pass through zoned devices from the host yet. If you have an NVMe ZNS device you can use VFIO PCI pass the entire NVMe PCI adapter through to the guest. Stefan
On Thu, Mar 23, 2023 at 01:28:24PM +0800, Sam Li wrote: > This patch adds zoned storage emulation to the virtio-blk driver. > > The patch implements the virtio-blk ZBD support standardization that is > recently accepted by virtio-spec. The link to related commit is at > > https://github.com/oasis-tcs/virtio-spec/commit/b4e8efa0fa6c8d844328090ad15db65af8d7d981 > > The Linux zoned device code that implemented by Dmitry Fomichev has been > released at the latest Linux version v6.3-rc1. > > Aside: adding zoned=on alike options to virtio-blk device will be > considered in following-up plan. > > v7: > - address Stefan's review comments > * rm aio_context_acquire/release in handle_req > * rename function return type > * rename BLOCK_ACCT_APPEND to BLOCK_ACCT_ZONE_APPEND for clarity > > v6: > - update headers to v6.3-rc1 > > v5: > - address Stefan's review comments > * restore the way writing zone append result to buffer > * fix error checking case and other errands > > v4: > - change the way writing zone append request result to buffer > - change zone state, zone type value of virtio_blk_zone_descriptor > - add trace events for new zone APIs > > v3: > - use qemuio_from_buffer to write status bit [Stefan] > - avoid using req->elem directly [Stefan] > - fix error checkings and memory leak [Stefan] > > v2: > - change units of emulated zone op coresponding to block layer APIs > - modify error checking cases [Stefan, Damien] > > v1: > - add zoned storage emulation > > Sam Li (4): > include: update virtio_blk headers to v6.3-rc1 > virtio-blk: add zoned storage emulation for zoned devices > block: add accounting for zone append operation > virtio-blk: add some trace events for zoned emulation > > block/qapi-sysemu.c | 11 + > block/qapi.c | 18 + > hw/block/trace-events | 7 + > hw/block/virtio-blk-common.c | 2 + > hw/block/virtio-blk.c | 405 +++++++++++++++++++ > include/block/accounting.h | 1 + > include/standard-headers/drm/drm_fourcc.h | 12 + > include/standard-headers/linux/ethtool.h | 48 ++- > include/standard-headers/linux/fuse.h | 45 ++- > include/standard-headers/linux/pci_regs.h | 1 + > include/standard-headers/linux/vhost_types.h | 2 + > include/standard-headers/linux/virtio_blk.h | 105 +++++ > linux-headers/asm-arm64/kvm.h | 1 + > linux-headers/asm-x86/kvm.h | 34 +- > linux-headers/linux/kvm.h | 9 + > linux-headers/linux/vfio.h | 15 +- > linux-headers/linux/vhost.h | 8 + > qapi/block-core.json | 62 ++- > qapi/block.json | 4 + > 19 files changed, 769 insertions(+), 21 deletions(-) > > -- > 2.39.2 > I'll wait for the next version that addresses the comments before merging, but I'm happy now: Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>