[PATCH 5/5] qemu: add virtio-blk queue-size option

Peter Krempa pkrempa at redhat.com
Tue Sep 21 08:23:13 UTC 2021


On Thu, Sep 09, 2021 at 12:34:48 +0900, Hiroki Narukawa wrote:
> The option "queue-size" in virtio-blk was added in qemu-2.12.0, and default value increased from qemu-5.0.0.
> 
> However, increasing this value may lead to drop of random access performance.
> 
> This is configurable value, so we want to use it via libvirt.
> 
> Signed-off-by: Hiroki Narukawa <hnarukaw at yahoo-corp.jp>
> ---

I'll line-break the very long lines in the commit message.

>  src/qemu/qemu_command.c                       |  3 ++
>  src/qemu/qemu_validate.c                      |  7 ++++
>  .../disk-virtio-queue-size.args               | 35 +++++++++++++++++
>  .../disk-virtio-queue-size.x86_64-latest.args | 35 +++++++++++++++++
>  .../disk-virtio-queue-size.xml                | 38 +++++++++++++++++++
>  tests/qemuxml2argvtest.c                      |  1 +
>  .../disk-virtio-queue-size.x86_64-latest.xml  | 38 +++++++++++++++++++
>  .../disk-virtio-queue-size.xml                | 35 +++++++++++++++++
>  tests/qemuxml2xmltest.c                       |  1 +
>  9 files changed, 193 insertions(+)
>  create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.args
>  create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.x86_64-latest.args
>  create mode 100644 tests/qemuxml2argvdata/disk-virtio-queue-size.xml
>  create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-queue-size.x86_64-latest.xml
>  create mode 100644 tests/qemuxml2xmloutdata/disk-virtio-queue-size.xml

There's no need to add all of this files, we can simply reuse
'disk-virtio-queues' and add additional disks testing the queue_size too
as they are related:

The following diff is enough instead of the 5 files above.

diff --git a/tests/qemuxml2argvdata/disk-virtio-queues.x86_64-latest.args b/tests/qemuxml2argvdata/disk-virtio-queues.x86_64-late
st.args
index 6637088a35..b1ff6de857 100644
--- a/tests/qemuxml2argvdata/disk-virtio-queues.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-virtio-queues.x86_64-latest.args
@@ -27,9 +27,15 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
 -no-acpi \
 -boot strict=on \
 -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
--blockdev '{"driver":"file","filename":"/tmp/data.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev '{"driver":"file","filename":"/tmp/data.img","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
 \
+-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"raw","file":"libvirt-3-storage"}' \
+-device virtio-blk-pci,num-queues=4,bus=pci.0,addr=0x3,drive=libvirt-3-format,id=virtio-disk0,bootindex=1 \
+-blockdev '{"driver":"file","filename":"/tmp/data1.img","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}
' \
+-blockdev '{"node-name":"libvirt-2-format","read-only":false,"driver":"raw","file":"libvirt-2-storage"}' \
+-device virtio-blk-pci,queue-size=256,bus=pci.0,addr=0x4,drive=libvirt-2-format,id=virtio-disk1 \
+-blockdev '{"driver":"file","filename":"/tmp/data2.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' \
 -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"raw","file":"libvirt-1-storage"}' \
--device virtio-blk-pci,num-queues=4,bus=pci.0,addr=0x3,drive=libvirt-1-format,id=virtio-disk0,bootindex=1 \
+-device virtio-blk-pci,num-queues=4,queue-size=256,bus=pci.0,addr=0x5,drive=libvirt-1-format,id=virtio-disk2 \
 -audiodev id=audio1,driver=none \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-virtio-queues.xml b/tests/qemuxml2argvdata/disk-virtio-queues.xml
index ea1001bdd4..3cfa958c97 100644
--- a/tests/qemuxml2argvdata/disk-virtio-queues.xml
+++ b/tests/qemuxml2argvdata/disk-virtio-queues.xml
@@ -23,6 +23,18 @@
       <target dev='vda' bus='virtio'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw' queue_size='256'/>
+      <source file='/tmp/data1.img'/>
+      <target dev='vdb' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='raw' queues='4' queue_size='256'/>
+      <source file='/tmp/data2.img'/>
+      <target dev='vdc' bus='virtio'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
     <controller type='usb' index='0' model='piix3-uhci'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
     </controller>

The rest looks good.

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list