Sending second version of this patchset as @stefanha requested.
The main difference from the previous version is added vhost
multithreading support.
Also I must note currently there are several problems which
I intend to reconsider/fix later:
- vmsd is present but migration is not supported
- BlockConf is used but block layer is actually bypassed
- posix BlockDriver internal state guessing
---
Although QEMU virtio-blk is quite fast, there is still some room for
improvements. Disk latency can be reduced if we handle virito-blk requests
in host kernel so we avoid a lot of syscalls and context switches.
The biggest disadvantage of this vhost-blk flavor is raw format.
Luckily Kirill Thai proposed device mapper driver for QCOW2 format to attach
files as block devices: https://www.spinics.net/lists/kernel/msg4292965.html
Also by using kernel modules we can bypass iothread limitation and finaly scale
block requests with cpus for high-performance devices. This is planned to be
implemented in next version.
Linux kernel module part:
v2: https://lore.kernel.org/kvm/20221013151839.689700-1-andrey.zhadchenko@virtuozzo.com/
test setups and results:
fio --direct=1 --rw=randread --bs=4k --ioengine=libaio --iodepth=128
QEMU options: cache=none, iothread, aio=threads
filesystem: xfs
SSD:
| randread, IOPS | randwrite, IOPS |
Host | 95.8k | 85.3k |
QEMU virtio | 61.5k | 79.9k |
QEMU vhost-blk | 95.6k | 84.3k |
RAMDISK (vq == vcpu == numjobs):
| randread, IOPS | randwrite, IOPS |
virtio, 1vcpu | 133k | 133k |
virtio, 2vcpu | 305k | 306k |
virtio, 4vcpu | 310k | 298k |
virtio, 8vcpu | 271k | 252k |
vhost-blk, 1vcpu | 110k | 113k |
vhost-blk, 2vcpu | 247k | 252k |
vhost-blk, 4vcpu | 558k | 556k |
vhost-blk, 8vcpu | 576k | 575k | *single kernel thread
vhost-blk, 8vcpu | 803k | 779k | *two kernel threads
Andrey Zhadchenko (1):
block: add vhost-blk backend
hw/block/Kconfig | 5 +
hw/block/meson.build | 4 +
hw/block/vhost-blk.c | 403 ++++++++++++++++++++++++++++++++++
hw/virtio/meson.build | 3 +
hw/virtio/vhost-blk-pci.c | 102 +++++++++
include/hw/virtio/vhost-blk.h | 52 +++++
meson.build | 6 +
meson_options.txt | 2 +
scripts/meson-buildoptions.sh | 3 +
9 files changed, 580 insertions(+)
create mode 100644 hw/block/vhost-blk.c
create mode 100644 hw/virtio/vhost-blk-pci.c
create mode 100644 include/hw/virtio/vhost-blk.h
--
2.31.1