Re: [PATCH 4/5] capabilities: Switch CPU data in NUMA topology to a struct

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

 



On Sat, Jan 19, 2013 at 12:06:41AM +0100, Peter Krempa wrote:
> This will allow storing additional topology data in the NUMA topology
> definition.
> 
> This patch changes the storage type and fixes fallback of the change

s/fallback/fallout/

> across the drivers using it.
> 
> This patch also changes semantics of adding new NUMA cell information.
> Until now the data were re-allocated and copied to the topology
> definition. This patch changes the addition function to steal the
> pointer to a pre-allocated structure to simplify the code.
> ---
>  src/conf/capabilities.c | 29 ++++++++++++++++++-----------
>  src/conf/capabilities.h | 14 ++++++++++++--
>  src/nodeinfo.c          | 22 ++++++++++++----------
>  src/qemu/qemu_process.c |  2 +-
>  src/test/test_driver.c  | 15 ++++++++++++---
>  src/xen/xend_internal.c | 24 +++++++++++++-----------
>  6 files changed, 68 insertions(+), 38 deletions(-)
> 
> diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
> index 0d2512e..814c4d6 100644
> --- a/src/conf/capabilities.c
> +++ b/src/conf/capabilities.c
> @@ -65,12 +65,26 @@ virCapabilitiesNew(virArch hostarch,
>      return caps;
>  }
> 
> +void
> +virCapabilitiesFreeHostNUMACellCPU(virCapsHostNUMACellCPUPtr cpu)
> +{
> +    if (!cpu)
> +        return;
> +
> +    VIR_FREE(cpu->siblings_list);
> +}
> +
>  static void
>  virCapabilitiesFreeHostNUMACell(virCapsHostNUMACellPtr cell)
>  {
> +    int i;

s/int/size_t/

> +
>      if (cell == NULL)
>          return;
> 
> +    for (i = 0; i < cell->ncpus; i++)
> +        virCapabilitiesFreeHostNUMACellCPU(cell->cpus + i);
> +
>      VIR_FREE(cell->cpus);
>      VIR_FREE(cell);
>  }

> diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
> index 19b99c6..124d8c1 100644
> --- a/src/conf/capabilities.h
> +++ b/src/conf/capabilities.h
> @@ -84,12 +84,21 @@ struct _virCapsGuest {
>      virCapsGuestFeaturePtr *features;
>  };
> 
> +typedef struct _virCapsHostNUMACellCPU virCapsHostNUMACellCPU;
> +typedef virCapsHostNUMACellCPU *virCapsHostNUMACellCPUPtr;
> +struct _virCapsHostNUMACellCPU {
> +    int id;
> +    int socket_id;
> +    int core_id;

s/int/unsigned/ since we don't need to store -ve numbers

> +    char *siblings_list;

Agree that this would be nicer as a virBitmap


> diff --git a/src/nodeinfo.c b/src/nodeinfo.c
> index 477104f..dffe7d1 100644
> --- a/src/nodeinfo.c
> +++ b/src/nodeinfo.c
> @@ -79,9 +79,11 @@ freebsdNodeGetCPUCount(void)
>  #ifdef __linux__
>  # define CPUINFO_PATH "/proc/cpuinfo"
>  # define SYSFS_SYSTEM_PATH "/sys/devices/system"
> +# define SYSFS_CPU_PATH SYSFS_SYSTEM_PATH"/cpu"
>  # define PROCSTAT_PATH "/proc/stat"
>  # define MEMINFO_PATH "/proc/meminfo"
>  # define SYSFS_MEMORY_SHARED_PATH "/sys/kernel/mm/ksm"
> +# define SYSFS_THREAD_SIBLINGS_LIST_LENGHT_MAX 1024

I think these two additions were meant for the next patch


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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