[libvirt] [PATCH v2 1/3] libxl: implement NUMA capabilities reporting
Jim Fehlig
jfehlig at suse.com
Tue Jul 9 22:21:08 UTC 2013
Dario Faggioli wrote:
> Starting from Xen 4.2, libxl has all the bits and pieces in place
> for retrieving an adequate amount of information about the host
> NUMA topology. It is therefore possible, after a bit of shuffling,
> to arrange those information in the way libvirt wants to present
> them to the outside world.
>
> Therefore, with this patch, the <topology> section of the host
> capabilities is properly populated, when running on Xen, so that
> we can figure out whether or not we're running on a NUMA host,
> and what its characteristics are.
>
> [raistlin at Zhaman ~]$ sudo virsh --connect xen:/// capabilities
> <capabilities>
> <host>
> <cpu>
> ....
> <topology>
> <cells num='2'>
> <cell id='0'>
> <memory unit='KiB'>6291456</memory>
> <cpus num='8'>
> <cpu id='0' socket_id='1' core_id='0' siblings='0-1'/>
> <cpu id='1' socket_id='1' core_id='0' siblings='0-1'/>
> <cpu id='2' socket_id='1' core_id='1' siblings='2-3'/>
> <cpu id='3' socket_id='1' core_id='1' siblings='2-3'/>
> <cpu id='4' socket_id='1' core_id='9' siblings='4-5'/>
> <cpu id='5' socket_id='1' core_id='9' siblings='4-5'/>
> <cpu id='6' socket_id='1' core_id='10' siblings='6-7'/>
> <cpu id='7' socket_id='1' core_id='10' siblings='6-7'/>
> </cpus>
> </cell>
> <cell id='1'>
> <memory unit='KiB'>6881280</memory>
> <cpus num='8'>
> <cpu id='8' socket_id='0' core_id='0' siblings='8-9'/>
> <cpu id='9' socket_id='0' core_id='0' siblings='8-9'/>
> <cpu id='10' socket_id='0' core_id='1' siblings='10-11'/>
> <cpu id='11' socket_id='0' core_id='1' siblings='10-11'/>
> <cpu id='12' socket_id='0' core_id='9' siblings='12-13'/>
> <cpu id='13' socket_id='0' core_id='9' siblings='12-13'/>
> <cpu id='14' socket_id='0' core_id='10' siblings='14-15'/>
> <cpu id='15' socket_id='0' core_id='10' siblings='14-15'/>
> </cpus>
> </cell>
> </cells>
> </topology>
> </host>
> ....
>
> Signed-off-by: Dario Faggioli <dario.faggioli at citrix.com>
> ---
> Changes from v1:
> * fixed a typo in the commit message, as requested during review;
> * fixed coding style (one function parameters per line and no spaces
> between variable definitions), as requested during review;
> * avoid zero-filling memory after VIR_ALLOC_N(), since it does that
> already, as requested during review;
> * improved out of memory error reporting, as requested during review;
> * libxlMakeNumaCapabilities() created, accommodating all the NUMA
> related additions, instead of having them within
> libxlMakeCapabilitiesInternal(), as suggested during review.
> ---
> src/libxl/libxl_conf.c | 141 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 140 insertions(+), 1 deletion(-)
>
> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
> index e170357..7515995 100644
> --- a/src/libxl/libxl_conf.c
> +++ b/src/libxl/libxl_conf.c
> @@ -161,6 +161,115 @@ libxlBuildCapabilities(virArch hostarch,
> }
>
> static virCapsPtr
> +libxlMakeNumaCapabilities(libxl_numainfo *numa_info,
> + int nr_nodes,
> + libxl_cputopology *cpu_topo,
> + int nr_cpus,
> + virCapsPtr caps)
> +{
> + virCapsHostNUMACellCPUPtr *cpus = NULL;
> + int *nr_cpus_node = NULL;
> + bool numa_failed = false;
> + int i;
>
BTW, the 'i' and 'j' iterators should be changed to size_t. danpb has a
patchset to sanitize iterators that will be committed any time now, so
might as well make this change in your next version
https://www.redhat.com/archives/libvir-list/2013-July/msg00397.html
Regards,
Jim
More information about the libvir-list
mailing list