summaryrefslogtreecommitdiffstats
path: root/hw/virtio
diff options
context:
space:
mode:
authorStefan Hajnoczi2020-08-18 16:33:48 +0200
committerMichael S. Tsirkin2020-08-27 14:29:13 +0200
commita4eef0711b2cf7a7476c3e2c202a414b68a1baa0 (patch)
treefaab55d185ae4aff1ce2d2dd9ba31b2b77ee5722 /hw/virtio
parentvirtio-blk-pci: default num_queues to -smp N (diff)
downloadqemu-a4eef0711b2cf7a7476c3e2c202a414b68a1baa0.tar.gz
qemu-a4eef0711b2cf7a7476c3e2c202a414b68a1baa0.tar.xz
qemu-a4eef0711b2cf7a7476c3e2c202a414b68a1baa0.zip
vhost-user-blk-pci: default num_queues to -smp N
Automatically size the number of request virtqueues to match the number of vCPUs. This ensures that completion interrupts are handled on the same vCPU that submitted the request. No IPI is necessary to complete an I/O request and performance is improved. The maximum number of MSI-X vectors and virtqueues limit are respected. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <20200818143348.310613-8-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost-user-blk-pci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/virtio/vhost-user-blk-pci.c b/hw/virtio/vhost-user-blk-pci.c
index 4f5d5cbf44..a62a71e067 100644
--- a/hw/virtio/vhost-user-blk-pci.c
+++ b/hw/virtio/vhost-user-blk-pci.c
@@ -54,6 +54,10 @@ static void vhost_user_blk_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VHostUserBlkPCI *dev = VHOST_USER_BLK_PCI(vpci_dev);
DeviceState *vdev = DEVICE(&dev->vdev);
+ if (dev->vdev.num_queues == VHOST_USER_BLK_AUTO_NUM_QUEUES) {
+ dev->vdev.num_queues = virtio_pci_optimal_num_queues(0);
+ }
+
if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) {
vpci_dev->nvectors = dev->vdev.num_queues + 1;
}