Stefan Hajnoczi <stefa...@redhat.com> writes: > 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 <stefa...@redhat.com> > --- > qapi/block-export.json | 6 +++++- > block/export/vhost-user-blk-server.c | 24 ++++++++++++++++++------ > 2 files changed, 23 insertions(+), 7 deletions(-) > > diff --git a/qapi/block-export.json b/qapi/block-export.json > index a793e34af9..17020de257 100644 > --- a/qapi/block-export.json > +++ b/qapi/block-export.json > @@ -93,11 +93,15 @@ > # SocketAddress types are supported. Passed fds must be UNIX domain > # sockets. > # @logical-block-size: Logical block size in bytes. Defaults to 512 bytes. > +# @num-queues: Number of request virtqueues. Must be greater than 0. Defaults > +# to 1. > # > # Since: 5.2 > ## > { 'struct': 'BlockExportOptionsVhostUserBlk', > - 'data': { 'addr': 'SocketAddress', '*logical-block-size': 'size' } } > + 'data': { 'addr': 'SocketAddress', > + '*logical-block-size': 'size',
Tab damage. > + '*num-queues': 'uint16'} } Out of curiosity: what made you pick 16 bit signed? net.json uses both 32 and 64 bit signed. Odd... > > ## > # @NbdServerAddOptions: Acked-by: Markus Armbruster <arm...@redhat.com>