mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu: Move cpuset preference evaluation into a separate function
The set of if()-s that determines the preference in cpumask used for setting things like emulatorpin, vcpupin, etc. is going to be re-used. Separate it out into a function. You may think that this changes behaviour, but qemuProcessPrepareDomainNUMAPlacement() ensures that priv->autoCpuset is set for VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Kristina Hanicova <khanicov@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
95ae91fdd4
commit
b4ccb0dc41
@ -12454,3 +12454,21 @@ qemuDomainStartupCleanup(virDomainObj *vm)
|
|||||||
for (i = 0; i < vm->def->ndisks; i++)
|
for (i = 0; i < vm->def->ndisks; i++)
|
||||||
qemuDomainCleanupStorageSourceFD(vm->def->disks[i]->src);
|
qemuDomainCleanupStorageSourceFD(vm->def->disks[i]->src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virBitmap *
|
||||||
|
qemuDomainEvaluateCPUMask(const virDomainDef *def,
|
||||||
|
virBitmap *cpumask,
|
||||||
|
virBitmap *autoCpuset)
|
||||||
|
{
|
||||||
|
if (cpumask) {
|
||||||
|
return cpumask;
|
||||||
|
} else if (autoCpuset &&
|
||||||
|
def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
|
||||||
|
return autoCpuset;
|
||||||
|
} else if (def->cpumask) {
|
||||||
|
return def->cpumask;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
@ -1133,3 +1133,8 @@ qemuDomainSchedCoreStart(virQEMUDriverConfig *cfg,
|
|||||||
|
|
||||||
void
|
void
|
||||||
qemuDomainSchedCoreStop(qemuDomainObjPrivate *priv);
|
qemuDomainSchedCoreStop(qemuDomainObjPrivate *priv);
|
||||||
|
|
||||||
|
virBitmap *
|
||||||
|
qemuDomainEvaluateCPUMask(const virDomainDef *def,
|
||||||
|
virBitmap *cpumask,
|
||||||
|
virBitmap *autoCpuset);
|
||||||
|
@ -2571,13 +2571,8 @@ qemuProcessSetupPid(virDomainObj *vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Infer which cpumask shall be used. */
|
/* Infer which cpumask shall be used. */
|
||||||
if (cpumask) {
|
if (!(use_cpumask = qemuDomainEvaluateCPUMask(vm->def,
|
||||||
use_cpumask = cpumask;
|
cpumask, priv->autoCpuset))) {
|
||||||
} else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
|
|
||||||
use_cpumask = priv->autoCpuset;
|
|
||||||
} else if (vm->def->cpumask) {
|
|
||||||
use_cpumask = vm->def->cpumask;
|
|
||||||
} else {
|
|
||||||
/* You may think this is redundant, but we can't assume libvirtd
|
/* You may think this is redundant, but we can't assume libvirtd
|
||||||
* itself is running on all pCPUs, so we need to explicitly set
|
* itself is running on all pCPUs, so we need to explicitly set
|
||||||
* the spawned QEMU instance to all pCPUs if no map is given in
|
* the spawned QEMU instance to all pCPUs if no map is given in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user