On ven, 2013-12-20 at 09:09 +0000, Wangyufei (James) wrote:
hi , I am confused by pinvcpu before migration.
I have two physical machine. One has 12 CPUs (E5645 2*6 ) as src and the other has 8 CPUs
(2*4) as des.
Step 1 : VM is running on src host (E5645 2*6 CPUs) with its VCPUs pinned on some PCPUs
Step 2 :Because PCPU count is different between src and des , I should pin VCPUs to all
PCPUs .
virsh vcpupin vmname 0 0-11 --config --live
Step 3: Do migrate ,and it failed with error in des libvirt log "Unable to set
cpuset.cpus: Invalid argument"
I find that VM's cpu bitmap on src turns to <vcpupin vcpu='0'
cpuset='0-11'/> . vm start fails on des due to its pin info
cpuset='0-11' in vm->def.
In usual case, after I pin VCPU to all PCPU, vcpupin info will be deleted in vm->def.
Is that the case? AFAICT, reset happens upon explicit request, e.g.,
something like:
# virsh vcpupin vmname 0 r --config --live
This is at least what works for me with both QEMU and libxl drivers.
-- qemuDomainPinVcpuFlags
-- if (virBitmapIsAllSet(pcpumap, pCpuCount))
doReset = true;
-- if (doReset)
if (virDomainVcpuPinDel(vm->def, vcpu) < 0)
Exactly, and that virBitmapIsAllSet() is true when you pass 'r' as
cpulist to the `virsh vcpupin' command, rather than some actual set of
pcpus, even if the latter spans all the pcpus on your host.
I debug libvirt and find that on src which PCPU count is 12 (2*6)
virBitmapIsAllSet(pcpumap, pCpuCount) return false
Probably because the bitmap is not 12 bits wide! ;-P
pcpumap->max_bit is 16. pcpumap = virBitmapNewData(cpumap,
maplen) --> bitmap = virBitmapNew(len * CHAR_BIT); //here len is 2.
Although my physical machine only has 12 PCPUs , but here pcpumap->max_bit is
len*CHAR_BIT . So bitmap is 0000 1111 1111 1111 ,and it's not ALL SET (ALL SET is 1111
1111 1111 1111).
Exactly.
I tried to fix the bug in this case , but I have not found a good
solution.
That's because it's not wrong. I do agree that there may be tricky
cases, but this one of yours doesn't look like one. Just use 'r'.
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D,
http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)