]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: fix vcpu pinning when not all vcpus are enabled
authorYi Wang <wang.yi59@zte.com.cn>
Tue, 26 Feb 2019 02:01:28 +0000 (10:01 +0800)
committerJán Tomko <jtomko@redhat.com>
Tue, 26 Feb 2019 12:40:35 +0000 (13:40 +0100)
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:
...
<vcpu current="3" placement="static">8</vcpu>
...

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 <wang.yi59@zte.com.cn>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c

index 55bb0ab5aa2242207ab319c52e146145233d60d0..59fe1eb401bcacde0c056294309e3c7b6a80414e 100644 (file)
@@ -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;