[libvirt] Add hyperthreaded sibling info to virsh capabilities

Dusty Mabe dustymabe at gmail.com
Wed Oct 17 21:06:23 UTC 2012


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'/>
            <cpu id='3' sibling='11'/>
            <cpu id='5' sibling='13'/>
            <cpu id='7' sibling='15'/>
            <cpu id='9' sibling='`1'/>
            <cpu id='11' sibling='3'/>
            <cpu id='13' sibling='5'/>
            <cpu id='15' sibling='7'/>
          </cpus>
        </cell>
        <cell id='1'>
          <cpus num='8'>
            <cpu id='0' sibling='8'/>
            <cpu id='2' sibling='10'/>
            <cpu id='4' sibling='12'/>
            <cpu id='6' sibling='14'/>
            <cpu id='8' sibling='0'/>
            <cpu id='10' sibling='2'/>
            <cpu id='12' sibling='4'/>
            <cpu id='14' sibling='6'/>
          </cpus>
        </cell>
      </cells>
    </topology>


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)


The output from it looks like so:

[root at hostname ~]# ./a.out
*** PU:  0    Hyperthreaded Sibling:  8
*** PU:  8    Hyperthreaded Sibling:  0
*** PU:  2    Hyperthreaded Sibling: 10
*** PU: 10    Hyperthreaded Sibling:  2
*** PU:  4    Hyperthreaded Sibling: 12
*** PU: 12    Hyperthreaded Sibling:  4
*** PU:  6    Hyperthreaded Sibling: 14
*** PU: 14    Hyperthreaded Sibling:  6
*** PU:  1    Hyperthreaded Sibling:  9
*** PU:  9    Hyperthreaded Sibling:  1
*** PU:  3    Hyperthreaded Sibling: 11
*** PU: 11    Hyperthreaded Sibling:  3
*** PU:  5    Hyperthreaded Sibling: 13
*** PU: 13    Hyperthreaded Sibling:  5
*** PU:  7    Hyperthreaded Sibling: 15
*** PU: 15    Hyperthreaded Sibling:  7

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


Thanks for your time,


Dusty Mabe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file.c
Type: text/x-csrc
Size: 982 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121017/bd46664d/attachment-0001.bin>


More information about the libvir-list mailing list