1d442bb
From: Stefan Hajnoczi <stefanha@redhat.com>
1d442bb
Date: Mon, 27 Jan 2020 19:00:36 +0000
1d442bb
Subject: [PATCH] virtio-fs: fix MSI-X nvectors calculation
1d442bb
1d442bb
The following MSI-X vectors are required:
1d442bb
 * VIRTIO Configuration Change
1d442bb
 * hiprio virtqueue
1d442bb
 * requests virtqueues
1d442bb
1d442bb
Fix the calculation to reserve enough MSI-X vectors.  Otherwise guest
1d442bb
drivers fall back to a sub-optional configuration where all virtqueues
1d442bb
share a single vector.
1d442bb
1d442bb
This change does not break live migration compatibility since
1d442bb
vhost-user-fs-pci devices are not migratable yet.
1d442bb
1d442bb
Reported-by: Vivek Goyal <vgoyal@redhat.com>
1d442bb
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
1d442bb
Message-Id: <20191209110759.35227-1-stefanha@redhat.com>
1d442bb
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442bb
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
1d442bb
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442bb
(cherry picked from commit 366844f3d1329c6423dd752891a28ccb3ee8fddd)
1d442bb
---
1d442bb
 hw/virtio/vhost-user-fs-pci.c | 3 ++-
1d442bb
 1 file changed, 2 insertions(+), 1 deletion(-)
1d442bb
1d442bb
diff --git a/hw/virtio/vhost-user-fs-pci.c b/hw/virtio/vhost-user-fs-pci.c
1d442bb
index 933a3f265b..e3a649d4a6 100644
1d442bb
--- a/hw/virtio/vhost-user-fs-pci.c
1d442bb
+++ b/hw/virtio/vhost-user-fs-pci.c
1d442bb
@@ -40,7 +40,8 @@ static void vhost_user_fs_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
1d442bb
     DeviceState *vdev = DEVICE(&dev->vdev);
1d442bb
 
1d442bb
     if (vpci_dev->nvectors == DEV_NVECTORS_UNSPECIFIED) {
1d442bb
-        vpci_dev->nvectors = dev->vdev.conf.num_request_queues + 1;
1d442bb
+        /* Also reserve config change and hiprio queue vectors */
1d442bb
+        vpci_dev->nvectors = dev->vdev.conf.num_request_queues + 2;
1d442bb
     }
1d442bb
 
1d442bb
     qdev_set_parent_bus(vdev, BUS(&vpci_dev->bus));