mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-01 20:05:19 +00:00
qemu: Implement support for iothread <-> virtqueue mapping for 'virtio-scsi' controllers
Similarly to 'virtio-blk' users can map multiple iothreads and pin them appropriately for 'virtio-scsi' controllers to ensure the best performance. Implement the validation and command line generation based on the helpers we have for 'virtio-blk'. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9c4664e8e5
commit
adb812f068
@ -2498,6 +2498,7 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDef *def,
|
||||
virQEMUCaps *qemuCaps)
|
||||
{
|
||||
g_autoptr(virJSONValue) props = NULL;
|
||||
g_autoptr(virJSONValue) iothreadsMapping = NULL;
|
||||
g_autofree char *iothread = NULL;
|
||||
const char *driver = NULL;
|
||||
|
||||
@ -2509,6 +2510,10 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDef *def,
|
||||
qemuCaps)))
|
||||
return NULL;
|
||||
|
||||
if (def->iothreads &&
|
||||
!(iothreadsMapping = qemuBuildIothreadMappingProps(def->iothreads)))
|
||||
return NULL;
|
||||
|
||||
if (def->iothread > 0)
|
||||
iothread = g_strdup_printf("iothread%u", def->iothread);
|
||||
|
||||
@ -2516,6 +2521,7 @@ qemuBuildControllerSCSIDevProps(virDomainControllerDef *def,
|
||||
"S:iothread", iothread,
|
||||
"s:id", def->info.alias,
|
||||
"p:num_queues", def->queues,
|
||||
"A:iothread-vq-mapping", &iothreadsMapping,
|
||||
"p:cmd_per_lun", def->cmd_per_lun,
|
||||
"p:max_sectors", def->max_sectors,
|
||||
"T:ioeventfd", def->ioeventfd,
|
||||
|
@ -3657,9 +3657,10 @@ qemuValidateDomainDeviceDefControllerIDE(const virDomainControllerDef *controlle
|
||||
*/
|
||||
static int
|
||||
qemuValidateCheckSCSIControllerIOThreads(const virDomainControllerDef *controller,
|
||||
const virDomainDef *def)
|
||||
const virDomainDef *def,
|
||||
virQEMUCaps *qemuCaps)
|
||||
{
|
||||
if (!controller->iothread)
|
||||
if (controller->iothread == 0 && !controller->iothreads)
|
||||
return 0;
|
||||
|
||||
if (controller->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
|
||||
@ -3670,8 +3671,20 @@ qemuValidateCheckSCSIControllerIOThreads(const virDomainControllerDef *controlle
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Can we find the controller iothread in the iothreadid list? */
|
||||
if (!virDomainIOThreadIDFind(def, controller->iothread)) {
|
||||
if (controller->iothreads) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_IOTHREAD_MAPPING)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IOThread mapping for virtio-scsi controllers is not available with this QEMU binary"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuDomainValidateIothreadMapping(def, controller->iothreads,
|
||||
controller->queues) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (controller->iothread > 0 &&
|
||||
!virDomainIOThreadIDFind(def, controller->iothread)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("controller iothread '%1$u' not defined in iothreadid"),
|
||||
controller->iothread);
|
||||
@ -3684,13 +3697,15 @@ qemuValidateCheckSCSIControllerIOThreads(const virDomainControllerDef *controlle
|
||||
|
||||
static int
|
||||
qemuValidateDomainDeviceDefControllerSCSI(const virDomainControllerDef *controller,
|
||||
const virDomainDef *def)
|
||||
const virDomainDef *def,
|
||||
virQEMUCaps *qemuCaps)
|
||||
{
|
||||
switch ((virDomainControllerModelSCSI) controller->model) {
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL:
|
||||
if (qemuValidateCheckSCSIControllerIOThreads(controller, def) < 0)
|
||||
if (qemuValidateCheckSCSIControllerIOThreads(controller, def,
|
||||
qemuCaps) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
@ -4364,7 +4379,8 @@ qemuValidateDomainDeviceDefController(const virDomainControllerDef *controller,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
||||
ret = qemuValidateDomainDeviceDefControllerSCSI(controller, def);
|
||||
ret = qemuValidateDomainDeviceDefControllerSCSI(controller, def,
|
||||
qemuCaps);
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
|
||||
|
Loading…
x
Reference in New Issue
Block a user