[libvirt] PATCH: Support vCPU pinning in QEMU driver
Daniel Veillard
veillard at redhat.com
Wed May 21 14:59:28 UTC 2008
On Fri, May 16, 2008 at 10:47:40PM +0100, Daniel P. Berrange wrote:
> KVM added ability to get the thread ID for vCPUs via the monitor
>
> (qemu) info cpus
> * CPU #0: pc=0x00000000000ffff0 thread_id=11463
> CPU #1: pc=0x00000000fffffff0 thread_id=11464
> CPU #2: pc=0x00000000fffffff0 thread_id=11465
>
> With this we have enough information to be able to support vCPU pinning in
> the QEMU driver for KVM. For QEMU/KQEMU it is trivial, since they have a
> single thread.
>
> The following patch implements CPU pinning and fetching of CPU affinity
> information. In this example I pin one of the 2 cpus in a guest:
[...]
> This is implemented using sched_setaffinity/sched_getaffinity which are
> Linux specific. There doesn't appear to be a portable process affinity
> API in POSIX.
looks fine to me. I guess the main use will be for KVM which is Linux
specific, so that should not be a big deal IMHO (if we could just make sure
the code doesn't bomb at compile time on say Solaris).
> If the KVM instance does not support the 'thread_id' data in 'info cpus',
> we simply print out a suitable error message. We detect the mapping at
> startup and cache it thereafter.
Hum, okay, seems that should work just fine even if one migrates or
save/restore.
Is the error reported each time one starts a new VM ?
In any case looks fine, +1
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list
mailing list