From: Yi Wang Date: Tue, 26 Feb 2019 02:01:28 +0000 (+0800) Subject: qemu: fix vcpu pinning when not all vcpus are enabled X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=12a5e10f02266d7797a8b19f0fa99285c589948e;p=libvirt.git qemu: fix vcpu pinning when not all vcpus are enabled 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 --- 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;