[PATCH 0/5] virtio: enable blk and scsi multi-queue by default

Stefan Hajnoczi posted 5 patches 4 years, 3 months ago
Test docker-mingw@fedora passed
Test checkpatch passed
Test docker-quick@centos7 passed
Test FreeBSD passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200116105842.271179-1-stefanha@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Fam Zheng <fam@euphon.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
hw/block/vhost-user-blk.c          | 15 +++++++++++++++
hw/block/virtio-blk.c              | 17 +++++++++++++++++
hw/core/machine.c                  |  5 +++++
hw/scsi/vhost-scsi.c               |  2 ++
hw/scsi/vhost-user-scsi.c          |  4 +++-
hw/scsi/virtio-scsi.c              | 25 ++++++++++++++++++++++---
hw/virtio/vhost-scsi-pci.c         |  4 ++--
hw/virtio/vhost-user-blk-pci.c     |  3 ++-
hw/virtio/vhost-user-scsi-pci.c    |  4 ++--
hw/virtio/virtio-blk-pci.c         |  3 ++-
hw/virtio/virtio-scsi-pci.c        |  4 ++--
include/hw/virtio/vhost-user-blk.h |  1 +
include/hw/virtio/virtio-blk.h     |  1 +
include/hw/virtio/virtio-scsi.h    |  4 ++++
include/hw/virtio/virtio.h         |  7 +++++++
15 files changed, 87 insertions(+), 12 deletions(-)
[PATCH 0/5] virtio: enable blk and scsi multi-queue by default
Posted by Stefan Hajnoczi 4 years, 3 months ago
Enabling multi-queue helps performance on SMP guests because the completion
interrupt is handled on the vCPU that submitted the I/O request.  This avoids
IPIs inside the guest.

Note that performance is unchanged in these cases:
1. Uniprocessor guests.  They don't have IPIs.
2. Application threads might be scheduled on the sole vCPU that handles
   completion interrupts purely by chance.  (This is one reason why benchmark
   results can vary noticably between runs.)
3. Users may bind the application to the vCPU that handles completion
   interrupts.

Set the number of queues to the number of vCPUs by default.  Older machine
types continue to default to 1 queue for live migration compatibility.

This patch improves IOPS by 1-4% on an Intel Optane SSD with 4 vCPUs, -drive
aio=native, and fio bs=4k direct=1 rw=randread.

Stefan Hajnoczi (5):
  virtio-scsi: introduce a constant for fixed virtqueues
  virtio: add VirtioDeviceClass->get_num_virtqueues()
  virtio-scsi: default num_queues to -smp N
  virtio-blk: default num_queues to -smp N
  vhost-user-blk: default num_queues to -smp N

 hw/block/vhost-user-blk.c          | 15 +++++++++++++++
 hw/block/virtio-blk.c              | 17 +++++++++++++++++
 hw/core/machine.c                  |  5 +++++
 hw/scsi/vhost-scsi.c               |  2 ++
 hw/scsi/vhost-user-scsi.c          |  4 +++-
 hw/scsi/virtio-scsi.c              | 25 ++++++++++++++++++++++---
 hw/virtio/vhost-scsi-pci.c         |  4 ++--
 hw/virtio/vhost-user-blk-pci.c     |  3 ++-
 hw/virtio/vhost-user-scsi-pci.c    |  4 ++--
 hw/virtio/virtio-blk-pci.c         |  3 ++-
 hw/virtio/virtio-scsi-pci.c        |  4 ++--
 include/hw/virtio/vhost-user-blk.h |  1 +
 include/hw/virtio/virtio-blk.h     |  1 +
 include/hw/virtio/virtio-scsi.h    |  4 ++++
 include/hw/virtio/virtio.h         |  7 +++++++
 15 files changed, 87 insertions(+), 12 deletions(-)

-- 
2.24.1