Re: [PATCH v2] libxl: report numa sibling distances on host capabilities

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

 



On 05/09/2017 07:06 PM, Wim Ten Have wrote:
> From: Wim ten Have <wim.ten.have@xxxxxxxxxx>
> 
> When running on a NUMA machine, populate the sibling node
> and distance information using data supplied by Xen.
> 
> With locality distances information, under Xen, new host
> capabilities would like:
> 
>     <topology>
>       <cells num='4'>
>         <cell id='0'>
>           <memory unit='KiB'>263902380</memory>
>           <distances>
>             <sibling id='0' value='10'/>
>             <sibling id='1' value='21'/>
>           </distances>
>           ...
>         </cell>
>         ...
>       </cells>
>       ...
>     </topology>
> 
> Signed-off-by: Wim ten Have <wim.ten.have@xxxxxxxxxx>

I had reviewed this internally so FWIW,

Reviewed-by: Joao Martins <joao.m.martins@xxxxxxxxxx>

>  src/libxl/libxl_capabilities.c | 19 +++++++++++++++++--
>  1 file changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libxl/libxl_capabilities.c b/src/libxl/libxl_capabilities.c
> index 839a2ee..e095920 100644
> --- a/src/libxl/libxl_capabilities.c
> +++ b/src/libxl/libxl_capabilities.c
> @@ -247,8 +247,9 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
>  {
>      libxl_numainfo *numa_info = NULL;
>      libxl_cputopology *cpu_topo = NULL;
> -    int nr_nodes = 0, nr_cpus = 0;
> +    int nr_nodes = 0, nr_cpus = 0, nr_siblings = 0;
>      virCapsHostNUMACellCPUPtr *cpus = NULL;
> +    virCapsHostNUMACellSiblingInfoPtr siblings = NULL;
>      int *nr_cpus_node = NULL;
>      size_t i;
>      int ret = -1;
> @@ -322,10 +323,23 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
>          if (numa_info[i].size == LIBXL_NUMAINFO_INVALID_ENTRY)
>              continue;
>  
> +        nr_siblings = numa_info[i].num_dists;
> +        if (nr_siblings) {
> +            size_t j;
> +
> +            if (VIR_ALLOC_N(siblings, nr_siblings) < 0)
> +                goto cleanup;
> +
> +            for (j = 0; j < nr_siblings; j++) {
> +                siblings[j].node = j;
> +                siblings[j].distance = numa_info[i].dists[j];
> +            }
> +        }
> +
>          if (virCapabilitiesAddHostNUMACell(caps, i,
>                                             numa_info[i].size / 1024,
>                                             nr_cpus_node[i], cpus[i],
> -                                           0, NULL,
> +                                           nr_siblings, siblings,
>                                             0, NULL) < 0) {
>              virCapabilitiesClearHostNUMACellCPUTopology(cpus[i],
>                                                          nr_cpus_node[i]);
> @@ -343,6 +357,7 @@ libxlCapsInitNuma(libxl_ctx *ctx, virCapsPtr caps)
>          for (i = 0; cpus && i < nr_nodes; i++)
>              VIR_FREE(cpus[i]);
>          virCapabilitiesFreeNUMAInfo(caps);
> +        VIR_FREE(siblings);
>      }
>  
>      VIR_FREE(cpus);
> 

--
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]
  Powered by Linux