Re: [libvirt] PATCH: Support vCPU pinning in QEMU driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 21, 2008 at 10:59:28AM -0400, Daniel Veillard wrote:
> 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).

Well I believe the Solaris folks disable QEMU driver entirely, but its
easy enough to add a configure.ac check for sched_setaffinity/sched_getaffinity
and disable them. You can also pin regular QEMU - though its limited to a
single vCPU.

> > 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 ? 

Sorry, was slightly misleading. We detect the mapping at startup and
cache it, but don't print any errors at that point if it is not supported.
Only when someone runs virDomainPinVcpu()/virDomainGetVcpus() will they
get an error message.

Dan.
-- 
|: Red Hat, Engineering, Boston   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]