]> git.proxmox.com Git - mirror_qemu.git/commit
block/export: add vhost-user-blk multi-queue support
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 1 Oct 2020 14:46:03 +0000 (15:46 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 23 Oct 2020 12:42:16 +0000 (13:42 +0100)
commitd9b495f9c6a943c9bbd50f7469efb645c23009c3
treed8ca95db872445d606fbe7eaa5577e99fa74d925
parentf51d23c80af73c95e0ce703ad06a300f1b3d63ef
block/export: add vhost-user-blk multi-queue support

Allow the number of queues to be configured using --export
vhost-user-blk,num-queues=N. This setting should match the QEMU --device
vhost-user-blk-pci,num-queues=N setting but QEMU vhost-user-blk.c lowers
its own value if the vhost-user-blk backend offers fewer queues than
QEMU.

The vhost-user-blk-server.c code is already capable of multi-queue. All
virtqueue processing runs in the same AioContext. No new locking is
needed.

Add the num-queues=N option and set the VIRTIO_BLK_F_MQ feature bit.
Note that the feature bit only announces the presence of the num_queues
configuration space field. It does not promise that there is more than 1
virtqueue, so we can set it unconditionally.

I tested multi-queue by running a random read fio test with numjobs=4 on
an -smp 4 guest. After the benchmark finished the guest /proc/interrupts
file showed activity on all 4 virtio-blk MSI-X. The /sys/block/vda/mq/
directory shows that Linux blk-mq has 4 queues configured.

An automated test is included in the next commit.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20201001144604.559733-2-stefanha@redhat.com
[Fixed accidental tab characters as suggested by Markus Armbruster
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/export/vhost-user-blk-server.c
qapi/block-export.json