[libvirt] Add hyperthreaded sibling info to virsh capabilities

Eric Blake eblake at redhat.com
Wed Oct 17 21:34:59 UTC 2012


On 10/17/2012 03:06 PM, Dusty Mabe wrote:
> Hi,
> 
> Would it be possible to augment the output produced in virsh
> capabilities to also provide the hyperthreaded sibling of a processor?
> For example the information would look something like:
> 
> 
>     <topology>
> 
>       <cells num='2'>
>         <cell id='0'>
>           <cpus num='8'>
>             <cpu id='1' sibling='9'/>

Indeed, that sounds useful, and it is strictly additive so there is no
technical reason preventing that addition.

> I notice that you guys are actually using some of the numactl stuff
> (numa.h) to query for the cpus on a given node and I have combed
> through that code to see if it provided any info about hyperthreaded
> siblings but from what I can tell it does not. I have tinkered around
> with the hwloc libraries (http://www.open-mpi.org/projects/hwloc/) and
> have written a short program to print out each logical cpu and its
> hyperthreaded sibling (see attached)

We haven't used hwloc before, but if that is the only way to get at the
sibling information, it sounds like it might be a reasonable additional
requirement for libvirt.

On Fedora 17, I see:

 hwloc               x86_64         1.4.1-2.fc17          updates
  1.1 M
 hwloc-devel         x86_64         1.4.1-2.fc17          updates
  150 k

so it looks like -lhwloc is currently bundled alongside the hwloc
command line executable; the library itself is decently small:

-rwxr-xr-x. 1 root root 163168 Apr 18 16:27 /usr/lib64/libhwloc.so.5.0.1

so I wonder if Fedora packaging should split that up so we only drag in
the library instead of the whole command line utility.  But that's a
concern for Fedora, not this list.

> Would you guys ever consider adding something like this? I would be
> willing to help create a patch if I had some guidance.

Absolutely!  It sounds like there's several major places to touch to add
this in:
configure.ac - check for presence of hwloc
libvirt.spec.in - require hwloc on new-enough Fedora
docs - document the new XML
docs/schemas - accept the new XML during RNG validation
src/nodeinfo.c - use the new library, when availalble, to get at the new
information
tests - add a new xml file that demonstrates the RNG changes accept the
new XML

You may find it helpful to read http://libvirt.org/hacking.html

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121017/c2fa90b3/attachment-0001.sig>


More information about the libvir-list mailing list