From 12a5e10f02266d7797a8b19f0fa99285c589948e Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Tue, 26 Feb 2019 10:01:28 +0800 Subject: [PATCH] qemu: fix vcpu pinning when not all vcpus are enabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vcpupin will fail when maxvcpus is larger than current vcpu: virsh vcpupin win7 --vcpu 0 --cpulist 5-6 error: Requested operation is not valid: cpu affinity is not supported win7 xml in the command above is like below: ... 8 ... The reason is vcpu[3] and vcpu[4] have zero tids and should not been compared as valid situation in qemuDomainRefreshVcpuInfo(). This issue is introduced by commit 34f7743, which fix recording of vCPU pids for MTTCG. Signed-off-by: Yi Wang Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/qemu/qemu_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 55bb0ab5aa..59fe1eb401 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10700,7 +10700,7 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver, } for (j = 0; j < i; j++) { - if (info[i].tid == info[j].tid) { + if (info[i].tid != 0 && info[i].tid == info[j].tid) { VIR_DEBUG("vCPU[%zu] PID %llu duplicates vCPU[%zu]", i, (unsigned long long)info[i].tid, j); validTIDs = false;