[libvirt] [Question] qemu cpu pinning

Daniel Veillard veillard at redhat.com
Thu Jun 23 01:33:39 UTC 2011


On Tue, Jun 21, 2011 at 12:59:32PM +0900, KAMEZAWA Hiroyuki wrote:
> 
> Hi,
> 
> When I run a VM(qemu-0.13) on my host with the latest libvirt,
> 
> I used following settings.
> ==
> <domain type='kvm' id='1'>
>   <name>RHEL6</name>
>   <uuid>f7ad6bc3-e82a-1254-efb0-9e1a87d83d88</uuid>
>   <memory>2048000</memory>
>   <currentMemory>2048000</currentMemory>
>   <vcpu cpuset='4-7'>2</vcpu>
> ==
> 
> I expected all works for this domain will be tied to cpu 4-7.
> 
> After minites, I checked the VM behavior and it shows
> ==
> [root at bluextal src]# cat /cgroup/cpuacct/libvirt/qemu/RHEL6/cpuacct.usage_percpu
> 0 511342 3027636 94237 657712515 257104928 513463748303 252386161
> ==
> 
> Hmm, cpu 1,2,3 are used for some purpose.
> 
> All threads for this qemu may be following.
> ==
> [root at bluextal src]# cat /cgroup/cpuacct/libvirt/qemu/RHEL6/tasks
> 25707
> 25727
> 25728
> 25729
> ==
> 
> And I found
> ==
> [root at bluextal src]# grep Cpus /proc/25707/status
> Cpus_allowed:   f0
> Cpus_allowed_list:      4-7
> [root at bluextal src]# grep Cpus /proc/25727/status
> Cpus_allowed:   ff
> Cpus_allowed_list:      0-7
> [root at bluextal src]# grep Cpus /proc/25728/status
> Cpus_allowed:   f0
> Cpus_allowed_list:      4-7
> [root at bluextal src]# grep Cpus /proc/25729/status
> Cpus_allowed:   f0
> Cpus_allowed_list:      4-7
> 
> ==
> 
> Thread 25727 has no limitation. 
> 
> Is this an expected behavior and I need more setting in XML definition ?
> 
> Thanks,
> -Kame

  I would understand this as KVM threads used for running the guest
domain are properly pinned (and indeed the CPU usage for those threads
is way way higher than the other ones), but the threads used
internally by KVM for I/O processing are not pinned leading to
what you are seeing. But it's a wild guess... Another possiblility
could be that some kernel I/O or interrupt processing done on behalf
of the KVM process is accounted as such but the kernel doesn't respect
the CPU pinning for those.

 > [root at bluextal src]# grep Cpus /proc/25727/status
 > Cpus_allowed:   ff
 > Cpus_allowed_list:      0-7

would clearly favor the first one for me, but it's a wild guess,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list