The ping for this patch got threaded weirdly, so I just stumbled upon this now. The subject could use s/with/against/ or could be something like "Limit the number of vhost-user queues to the number of vcpus", but a question below. On Thu, Dec 08, 2022 at 08:52:19PM +0800, Jiang Jiacheng wrote:
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/
It makes sense, although even from the kernel patch I am not sure whether this should be checked against maxvcpus (i.e. using virDomainDefGetVcpusMax()) or whether this is more related to the number of physical CPUs on the host. Definitely not the number of online guest vcpus.
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
Attachment:
signature.asc
Description: PGP signature