[PATCH] conf: check vhost-user queues with vcpus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With kernel without the ref patch, if queues > vcpus, interrupts
will be centralized on one vcpu affecting guest performance. After
the ref patch merged, the queues whose number is greater than the
number of vcpus will not be used.

Considering the above, it's better to check the counts of vhost-user
queues and vcpus.

ref:
https://patchwork.kernel.org/project/linux-scsi/cover/1553682995-5682-1-git-send-email-dongli.zhang@xxxxxxxxxx/

Signed-off-by: Jiang Jiacheng <jiangjiacheng@xxxxxxxxxx>
---
 src/conf/domain_validate.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 95b8d9b419..6106e79999 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -308,7 +308,7 @@ virSecurityDeviceLabelDefValidate(virSecurityDeviceLabelDef **seclabels,
 
 
 static int
-virDomainDiskVhostUserValidate(const virDomainDiskDef *disk)
+virDomainDiskVhostUserValidate(const virDomainDef *def, const virDomainDiskDef *disk)
 {
     if (disk->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -465,6 +465,12 @@ virDomainDiskVhostUserValidate(const virDomainDiskDef *disk)
         return -1;
     }
 
+    if (disk->queues > virDomainDefGetVcpus(def)) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("vhost-user disk queues must <= vcpus"));
+        return -1;
+    }
+
     return 0;
 }
 
@@ -807,7 +813,7 @@ virDomainDiskDefValidate(const virDomainDef *def,
     }
 
     if (disk->src->type == VIR_STORAGE_TYPE_VHOST_USER &&
-        virDomainDiskVhostUserValidate(disk) < 0) {
+        virDomainDiskVhostUserValidate(def, disk) < 0) {
         return -1;
     }
 
-- 
2.33.0





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux