[libvirt] vcpuinfo returns wrong CPU value for kvm

Gerrit Slomma roadrunner_gs at web.de
Tue Apr 14 19:53:51 UTC 2009


vcpuinfo returns a wrong value for kvm with libvirt 0.6.2:

virsh # nodeinfo
CPU-Modell:          x86_64
CPU(s):              2
CPU-Frequenz:        2333 MHz
CPU-Socket(s):       1
Kern(e) pro Socket:  2
Thread(s) pro Kern:  1
NUMA-Zelle(n):       1
Speichergrösse:     3062956 kB

virsh # dominfo rr019v3
Id:             2
Name:           rr019v3
UUID:           ff1ba599-5801-fca9-ab33-8962c2dfa46c
OS Typ:         hvm
Status:         laufend
CPU(s):         2
CPU-Zeit:       46,5s
Max Speicher:   1572864 kB
Verwendeter Speicher: 1572864 kB
Automatischer Start: deaktiviert

As default a kvm-vm has a affinity on all cpus provided by the node

virsh # vcpuinfo rr019v3
VCPU:           0
CPU:            0
Status:         laufend
CPU-Affinität: yy

VCPU:           1
CPU:            0
Status:         laufend
CPU-Affinität: yy

When i set the affinity of the vCPUs to dedicated CPUs of the node 
vcpuinfo returns CPU 0 as the assigned CPU.

virsh # vcpupin rr019v3 0 0
virsh # vcpupin rr019v3 1 1
virsh # vcpuinfo rr019v3
VCPU:           0
CPU:            0
Status:         laufend
CPU-Affinität: y-

VCPU:           1
CPU:            0
Status:         laufend
CPU-Affinität: -y

Furthermore even when pinning all - in my case both - vCPUs of the 
domain to the second CPU of the node virsh reports the first cpu as the 
assigned cpu.

virsh # vcpupin rr019v3 0 1
virsh # vcpuinfo rr019v3
VCPU:           0
CPU:            0
Status:         laufend
CPU-Affinität: -y

VCPU:           1
CPU:            0
Status:         laufend
CPU-Affinität: -y


Watching at the code in virsh.c i am a little bit on my wits end where 
virVcpuInfoPtr is defined as i am no c-programmer - only some java on my 
side.
On my xen-machine with libvirt 0.3.3 the CPU is shown correctly though:

virsh vcpuinfo rr010v2
VCPU:           0
CPU:            0
Status:         blockiert
CPU-Zeit:       550,4s
CPU-Affinität: y---

VCPU:           1
CPU:            1
Status:         blockiert
CPU-Zeit:       27,9s
CPU-Affinität: -y--

VCPU:           2
CPU:            2
Status:         blockiert
CPU-Zeit:       31,2s
CPU-Affinität: --y-

VCPU:           3
CPU:            3
Status:         blockiert
CPU-Zeit:       49,1s
CPU-Affinität: ---y

Is this only working with the xen-driver?




More information about the libvir-list mailing list