[PATCH 09/14] qemu: Fix qemuDomainGetEmulatorPinInfo()

Michal Privoznik posted 14 patches 2 years, 9 months ago
There is a newer version of this series
[PATCH 09/14] qemu: Fix qemuDomainGetEmulatorPinInfo()
Posted by Michal Privoznik 2 years, 9 months ago
The order of pinning priority (at least for emulator thread) was
set by v1.2.15-rc1~58 (for cgroup code). But later, when
automatic placement was implemented into
qemuDomainGetEmulatorPinInfo(), the priority was not honored.

Now that we have this priority code in a separate function, we
can just call that and avoid this type of error.

Fixes: 776924e37649f2d47acd805746d5fd9325212ea5
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_driver.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c546e35953..0a6f96e68c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4574,14 +4574,9 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
     if (live)
         autoCpuset = QEMU_DOMAIN_PRIVATE(vm)->autoCpuset;
 
-    if (def->cputune.emulatorpin) {
-        cpumask = def->cputune.emulatorpin;
-    } else if (def->cpumask) {
-        cpumask = def->cpumask;
-    } else if (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO &&
-               autoCpuset) {
-        cpumask = autoCpuset;
-    } else {
+    if (!(cpumask = qemuDomainEvaluateCPUMask(def,
+                                              def->cputune.emulatorpin,
+                                              autoCpuset))) {
         if (!(bitmap = virHostCPUGetAvailableCPUsBitmap()))
             goto cleanup;
         cpumask = bitmap;
-- 
2.39.2
Re: [PATCH 09/14] qemu: Fix qemuDomainGetEmulatorPinInfo()
Posted by Andrea Bolognani 2 years, 9 months ago
On Wed, Mar 08, 2023 at 12:14:36PM +0100, Michal Privoznik wrote:
> The order of pinning priority (at least for emulator thread) was
> set by v1.2.15-rc1~58 (for cgroup code). But later, when
> automatic placement was implemented into
> qemuDomainGetEmulatorPinInfo(), the priority was not honored.
>
> Now that we have this priority code in a separate function, we
> can just call that and avoid this type of error.
>
> Fixes: 776924e37649f2d47acd805746d5fd9325212ea5
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_driver.c | 11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization