All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 5] support of NUMA topology in xl
@ 2010-12-09 12:39   ` Juergen Gross
  2010-12-09 12:39     ` [PATCH 1 of 5] Support getting topology info in libxl Juergen Gross
                       ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Juergen Gross @ 2010-12-09 12:39 UTC (permalink / raw)
  To: xen-devel

This is V3 of my patch series to support NUMA in xl with cpupools.

Patch 1 adds a libxl function to retireve topology information from hypervisor
Patch 2 adds support of -n option to xl info
Patch 3 adds possibility to specify complete nodes instead of cpus for cpupools
Patch 4 adds possibility to rename a cpupool (libxl and xl command)
Patch 5 adds a new xl command cpupool-numa-split to create one cpupool per numa node

Changes since last version:
- added Py_INCREF when appending Py_None to list
- added libxl__free_all(&gc) in libxl_cpupool_rename()

9 files changed, 540 insertions(+), 21 deletions(-)
tools/libxl/libxl.c               |  170 ++++++++++++++++++++
tools/libxl/libxl.h               |   11 +
tools/libxl/libxl.idl             |    7 
tools/libxl/libxl_utils.c         |   28 +++
tools/libxl/libxl_utils.h         |    2 
tools/libxl/xl.h                  |    2 
tools/libxl/xl_cmdimpl.c          |  300 +++++++++++++++++++++++++++++++++++--
tools/libxl/xl_cmdtable.c         |   16 +
tools/python/xen/lowlevel/xl/xl.c |   25 +++

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1 of 5] Support getting topology info in libxl
  2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
@ 2010-12-09 12:39     ` Juergen Gross
  2010-12-09 13:11       ` Gianni Tedesco
  2010-12-09 12:39     ` [PATCH 2 of 5] support topolgy info in xl info Juergen Gross
                       ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Juergen Gross @ 2010-12-09 12:39 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

Added new function libxl_get_topologyinfo() to obtain this information from
hypervisor.

Signed-off-by: juergen.gross@ts.fujitsu.com


6 files changed, 119 insertions(+)
tools/libxl/libxl.c               |   53 +++++++++++++++++++++++++++++++++++++
tools/libxl/libxl.h               |    8 +++++
tools/libxl/libxl.idl             |    7 ++++
tools/libxl/libxl_utils.c         |   24 ++++++++++++++++
tools/libxl/libxl_utils.h         |    2 +
tools/python/xen/lowlevel/xl/xl.c |   25 +++++++++++++++++



[-- Attachment #2: xen-work-5.patch --]
[-- Type: text/x-patch, Size: 7684 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1291897979 -3600
# Node ID a1eb18bec4690b6687bcf4eed0d077019f965b5e
# Parent  0c97247c64d61511acff37d1903cb304b387f397
Support getting topology info in libxl

Added new function libxl_get_topologyinfo() to obtain this information from
hypervisor.

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Dec 09 08:34:59 2010 +0000
+++ b/tools/libxl/libxl.c	Thu Dec 09 13:32:59 2010 +0100
@@ -3156,6 +3156,59 @@ int libxl_get_physinfo(libxl_ctx *ctx, l
     return 0;
 }
 
+int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info)
+{
+    xc_topologyinfo_t tinfo;
+    DECLARE_HYPERCALL_BUFFER(xc_cpu_to_core_t, coremap);
+    DECLARE_HYPERCALL_BUFFER(xc_cpu_to_socket_t, socketmap);
+    DECLARE_HYPERCALL_BUFFER(xc_cpu_to_node_t, nodemap);
+    int i;
+    int rc = 0;
+
+    rc += libxl_cpuarray_alloc(ctx, &info->coremap);
+    rc += libxl_cpuarray_alloc(ctx, &info->socketmap);
+    rc += libxl_cpuarray_alloc(ctx, &info->nodemap);
+    if (rc)
+        goto fail;
+
+    coremap = xc_hypercall_buffer_alloc(ctx->xch, coremap, sizeof(*coremap) * info->coremap.entries);
+    socketmap = xc_hypercall_buffer_alloc(ctx->xch, socketmap, sizeof(*socketmap) * info->socketmap.entries);
+    nodemap = xc_hypercall_buffer_alloc(ctx->xch, nodemap, sizeof(*nodemap) * info->nodemap.entries);
+    if ((coremap == NULL) || (socketmap == NULL) || (nodemap == NULL))
+        goto fail;
+
+    set_xen_guest_handle(tinfo.cpu_to_core, coremap);
+    set_xen_guest_handle(tinfo.cpu_to_socket, socketmap);
+    set_xen_guest_handle(tinfo.cpu_to_node, nodemap);
+    tinfo.max_cpu_index = info->coremap.entries - 1;
+    if (xc_topologyinfo(ctx->xch, &tinfo) != 0)
+        goto fail;
+
+    for (i = 0; i <= tinfo.max_cpu_index; i++) {
+        if (i < info->coremap.entries)
+            info->coremap.array[i] = (coremap[i] == INVALID_TOPOLOGY_ID) ?
+                LIBXL_CPUARRAY_INVALID_ENTRY : coremap[i];
+        if (i < info->socketmap.entries)
+            info->socketmap.array[i] = (socketmap[i] == INVALID_TOPOLOGY_ID) ?
+                LIBXL_CPUARRAY_INVALID_ENTRY : socketmap[i];
+        if (i < info->nodemap.entries)
+            info->nodemap.array[i] = (nodemap[i] == INVALID_TOPOLOGY_ID) ?
+                LIBXL_CPUARRAY_INVALID_ENTRY : nodemap[i];
+    }
+
+    xc_hypercall_buffer_free(ctx->xch, coremap);
+    xc_hypercall_buffer_free(ctx->xch, socketmap);
+    xc_hypercall_buffer_free(ctx->xch, nodemap);
+    return 0;
+
+fail:
+    xc_hypercall_buffer_free(ctx->xch, coremap);
+    xc_hypercall_buffer_free(ctx->xch, socketmap);
+    xc_hypercall_buffer_free(ctx->xch, nodemap);
+    libxl_topologyinfo_destroy(info);
+    return ERROR_FAIL;
+}
+
 const libxl_version_info* libxl_get_version_info(libxl_ctx *ctx)
 {
     union {
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Thu Dec 09 08:34:59 2010 +0000
+++ b/tools/libxl/libxl.h	Thu Dec 09 13:32:59 2010 +0100
@@ -148,6 +148,13 @@ typedef struct {
     uint8_t *map;
 } libxl_cpumap;
 void libxl_cpumap_destroy(libxl_cpumap *map);
+
+typedef struct {
+    uint32_t entries;
+    uint32_t *array;
+} libxl_cpuarray;
+#define LIBXL_CPUARRAY_INVALID_ENTRY  ~0
+void libxl_cpuarray_destroy(libxl_cpuarray *array);
 
 typedef enum {
     XENFV = 1,
@@ -464,6 +471,7 @@ int libxl_button_press(libxl_ctx *ctx, u
 int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button);
 
 int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo);
+int libxl_get_topologyinfo(libxl_ctx *ctx, libxl_topologyinfo *info);
 libxl_vcpuinfo *libxl_list_vcpu(libxl_ctx *ctx, uint32_t domid,
                                        int *nb_vcpu, int *nrcpus);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl.idl
--- a/tools/libxl/libxl.idl	Thu Dec 09 08:34:59 2010 +0000
+++ b/tools/libxl/libxl.idl	Thu Dec 09 13:32:59 2010 +0100
@@ -7,6 +7,7 @@ libxl_uuid = Builtin("uuid")
 libxl_uuid = Builtin("uuid")
 libxl_mac = Builtin("mac")
 libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE)
+libxl_cpuarray = Builtin("cpuarray", destructor_fn="libxl_cpuarray_destroy", passby=PASS_BY_REFERENCE)
 libxl_qemu_machine_type = Number("qemu_machine_type", namespace="libxl_")
 libxl_console_consback = Number("console_consback", namespace="libxl_")
 libxl_console_constype = Number("console_constype", namespace="libxl_")
@@ -302,6 +303,12 @@ libxl_physinfo = Struct("physinfo", [
     ("phys_cap", uint32),
     ], destructor_fn=None)
 
+libxl_topologyinfo = Struct("topologyinfo", [
+    ("coremap", libxl_cpuarray,   False, "cpu to core map"),
+    ("socketmap", libxl_cpuarray, False, "cpu to socket map"),
+    ("nodemap", libxl_cpuarray,   False, "cpu to node map"),
+    ])
+
 libxl_sched_credit = Struct("sched_credit", [
     ("weight", integer),
     ("cap", integer),
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Thu Dec 09 08:34:59 2010 +0000
+++ b/tools/libxl/libxl_utils.c	Thu Dec 09 13:32:59 2010 +0100
@@ -751,6 +751,30 @@ void libxl_cpumap_reset(libxl_cpumap *cp
     cpumap->map[cpu / 8] &= ~(1 << (cpu & 7));
 }
 
+int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray)
+{
+    int max_cpus;
+    int i;
+
+    max_cpus = libxl_get_max_cpus(ctx);
+    if (max_cpus == 0)
+        return ERROR_FAIL;
+
+    cpuarray->array = calloc(max_cpus, sizeof(*cpuarray->array));
+    if (!cpuarray->array)
+        return ERROR_NOMEM;
+    cpuarray->entries = max_cpus;
+    for (i = 0; i < max_cpus; i++)
+        cpuarray->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
+
+    return 0;
+}
+
+void libxl_cpuarray_destroy(libxl_cpuarray *array)
+{
+    free(array->array);
+}
+
 int libxl_get_max_cpus(libxl_ctx *ctx)
 {
     return xc_get_max_cpus(ctx->xch);
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Thu Dec 09 08:34:59 2010 +0000
+++ b/tools/libxl/libxl_utils.h	Thu Dec 09 13:32:59 2010 +0100
@@ -82,5 +82,7 @@ void libxl_cpumap_reset(libxl_cpumap *cp
 void libxl_cpumap_reset(libxl_cpumap *cpumap, int cpu);
 #define libxl_for_each_cpu(var, map) for (var = 0; var < (map).size * 8; var++)
 
+int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
+
 #endif
 
diff -r 0c97247c64d6 -r a1eb18bec469 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Thu Dec 09 08:34:59 2010 +0000
+++ b/tools/python/xen/lowlevel/xl/xl.c	Thu Dec 09 13:32:59 2010 +0100
@@ -224,6 +224,11 @@ int attrib__libxl_cpumap_set(PyObject *v
     return 0;
 }
 
+int attrib__libxl_cpuarray_set(PyObject *v, libxl_cpuarray *pptr)
+{
+    return -1;
+}
+
 int attrib__libxl_domain_build_state_ptr_set(PyObject *v, libxl_domain_build_state **pptr)
 {
     return -1;
@@ -284,6 +289,26 @@ PyObject *attrib__libxl_cpumap_get(libxl
         }
     }
     return cpulist;
+}
+
+PyObject *attrib__libxl_cpuarray_get(libxl_cpuarray *pptr)
+{
+    PyObject *list = NULL;
+    int i;
+
+    list = PyList_New(0);
+    for (i = 0; i < pptr->entries; i++) {
+        if (pptr->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY) {
+            PyList_Append(list, Py_None);
+            Py_INCREF(Py_None);
+        } else {
+            PyObject* pyint = PyInt_FromLong(pptr->array[i]);
+
+            PyList_Append(list, pyint);
+            Py_DECREF(pyint);
+        }
+    }
+    return list;
 }
 
 PyObject *attrib__libxl_domain_build_state_ptr_get(libxl_domain_build_state **pptr)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2 of 5] support topolgy info in xl info
  2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
  2010-12-09 12:39     ` [PATCH 1 of 5] Support getting topology info in libxl Juergen Gross
@ 2010-12-09 12:39     ` Juergen Gross
  2010-12-09 12:39     ` [PATCH 3 of 5] Extend cpupools to support numa Juergen Gross
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Juergen Gross @ 2010-12-09 12:39 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

Adds option -n/--numa to xl info command to print topology information.
No numa information up to now, as I've no machine which will give this info
via xm info (could be a bug in xm, however).

Signed-off-by: juergen.gross@ts.fujitsu.com


2 files changed, 50 insertions(+), 11 deletions(-)
tools/libxl/xl_cmdimpl.c  |   59 +++++++++++++++++++++++++++++++++++++--------
tools/libxl/xl_cmdtable.c |    2 -



[-- Attachment #2: xen-work-5.patch --]
[-- Type: text/x-patch, Size: 3005 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1291890200 -3600
# Node ID 823571e65b696b6fb3a00fa2b205ea8248f6d0df
# Parent  a1eb18bec4690b6687bcf4eed0d077019f965b5e
support topolgy info in xl info

Adds option -n/--numa to xl info command to print topology information.
No numa information up to now, as I've no machine which will give this info
via xm info (could be a bug in xm, however).

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r a1eb18bec469 -r 823571e65b69 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Dec 09 13:32:59 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Thu Dec 09 11:23:20 2010 +0100
@@ -3925,12 +3925,41 @@ static void output_physinfo(void)
     return;
 }
 
-static void info(void)
+static void output_topologyinfo(void)
+{
+    libxl_topologyinfo info;
+    int i;
+
+    if (libxl_get_topologyinfo(&ctx, &info)) {
+        fprintf(stderr, "libxl_get_topologyinfo failed.\n");
+        return;
+    }
+
+    printf("cpu_topology           :\n");
+    printf("cpu:    core    socket     node\n");
+
+    for (i = 0; i < info.coremap.entries; i++) {
+        if (info.coremap.array[i] != LIBXL_CPUARRAY_INVALID_ENTRY)
+            printf("%3d:    %4d     %4d     %4d\n", i, info.coremap.array[i],
+                info.socketmap.array[i], info.nodemap.array[i]);
+    }
+
+    printf("numa_info              : none\n");
+
+    libxl_topologyinfo_destroy(&info);
+
+    return;
+}
+
+static void info(int numa)
 {
     output_nodeinfo();
 
     output_physinfo();
 
+    if (numa)
+        output_topologyinfo();
+
     output_xeninfo();
 
     printf("xend_config_format     : 4\n");
@@ -3941,19 +3970,29 @@ int main_info(int argc, char **argv)
 int main_info(int argc, char **argv)
 {
     int opt;
-
-    while ((opt = getopt(argc, argv, "h")) != -1) {
+    int option_index = 0;
+    static struct option long_options[] = {
+        {"help", 0, 0, 'h'},
+        {"numa", 0, 0, 'n'},
+        {0, 0, 0, 0}
+    };
+    int numa = 0;
+
+    while ((opt = getopt_long(argc, argv, "hn", long_options, &option_index)) != -1) {
         switch (opt) {
         case 'h':
             help("info");
             return 0;
-        default:
-            fprintf(stderr, "option `%c' not supported.\n", opt);
-            break;
-        }
-    }
-
-    info();
+        case 'n':
+            numa = 1;
+            break;
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", opt);
+            break;
+        }
+    }
+
+    info(numa);
     return 0;
 }
 
diff -r a1eb18bec469 -r 823571e65b69 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Thu Dec 09 13:32:59 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c	Thu Dec 09 11:23:20 2010 +0100
@@ -185,7 +185,7 @@ struct cmd_spec cmd_table[] = {
     { "info",
       &main_info,
       "Get information about Xen host",
-      "",
+      "-n, --numa         List host NUMA topology information",
     },
     { "sched-credit",
       &main_sched_credit,

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3 of 5] Extend cpupools to support numa
  2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
  2010-12-09 12:39     ` [PATCH 1 of 5] Support getting topology info in libxl Juergen Gross
  2010-12-09 12:39     ` [PATCH 2 of 5] support topolgy info in xl info Juergen Gross
@ 2010-12-09 12:39     ` Juergen Gross
  2010-12-09 12:39     ` [PATCH 4 of 5] Support renaming of cpupools Juergen Gross
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Juergen Gross @ 2010-12-09 12:39 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 1081 bytes --]

The user interfaces for cpupools are extended to support numa machines:
- xl cpupool-create supports now specifying a node list instead of a cpu list.
  The new cpupool will be created with all free cpus of the specified numa
  nodes.
- xl cpupool-cpu-remove and xl cpupool-cpu-add can take a node number instead
  of a cpu number. Using 'node:1' for the cpu parameter will, depending on
  the operation, either remove all cpus of node 1 in the specified cpupool,
  or add all free cpus of node 1 to the cpupool.

libxl is extended with the following functions to support this feature:
int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)
int libxl_cpupool_cpuremove_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)

Signed-off-by: juergen.gross@ts.fujitsu.com


4 files changed, 155 insertions(+), 8 deletions(-)
tools/libxl/libxl.c       |   74 ++++++++++++++++++++++++++++++++++++++++
tools/libxl/libxl.h       |    2 +
tools/libxl/xl_cmdimpl.c  |   83 +++++++++++++++++++++++++++++++++++++++++----
tools/libxl/xl_cmdtable.c |    4 +-



[-- Attachment #2: xen-work-5.patch --]
[-- Type: text/x-patch, Size: 9259 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1291890397 -3600
# Node ID 34367a3d42f7f8145bdc74c464f6822144aeab70
# Parent  823571e65b696b6fb3a00fa2b205ea8248f6d0df
Extend cpupools to support numa

The user interfaces for cpupools are extended to support numa machines:
- xl cpupool-create supports now specifying a node list instead of a cpu list.
  The new cpupool will be created with all free cpus of the specified numa
  nodes.
- xl cpupool-cpu-remove and xl cpupool-cpu-add can take a node number instead
  of a cpu number. Using 'node:1' for the cpu parameter will, depending on
  the operation, either remove all cpus of node 1 in the specified cpupool,
  or add all free cpus of node 1 to the cpupool.

libxl is extended with the following functions to support this feature:
int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)
int libxl_cpupool_cpuremove_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r 823571e65b69 -r 34367a3d42f7 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Dec 09 11:23:20 2010 +0100
+++ b/tools/libxl/libxl.c	Thu Dec 09 11:26:37 2010 +0100
@@ -3822,6 +3822,38 @@ int libxl_cpupool_cpuadd(libxl_ctx *ctx,
     return 0;
 }
 
+int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)
+{
+    int rc = 0;
+    int cpu;
+    libxl_cpumap freemap;
+    libxl_topologyinfo topology;
+
+    if (libxl_get_freecpus(ctx, &freemap)) {
+        return ERROR_FAIL;
+    }
+
+    if (libxl_get_topologyinfo(ctx, &topology)) {
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    *cpus = 0;
+    for (cpu = 0; cpu < topology.nodemap.entries; cpu++) {
+        if (libxl_cpumap_test(&freemap, cpu) &&
+            (topology.nodemap.array[cpu] == node) &&
+            !libxl_cpupool_cpuadd(ctx, poolid, cpu)) {
+                (*cpus)++;
+        }
+    }
+
+    libxl_topologyinfo_destroy(&topology);
+
+out:
+    libxl_cpumap_destroy(&freemap);
+    return rc;
+}
+
 int libxl_cpupool_cpuremove(libxl_ctx *ctx, uint32_t poolid, int cpu)
 {
     int rc;
@@ -3833,6 +3865,48 @@ int libxl_cpupool_cpuremove(libxl_ctx *c
         return ERROR_FAIL;
     }
     return 0;
+}
+
+int libxl_cpupool_cpuremove_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus)
+{
+    int ret = 0;
+    int n_pools;
+    int p;
+    int cpu;
+    libxl_topologyinfo topology;
+    libxl_cpupoolinfo *poolinfo;
+
+    poolinfo = libxl_list_cpupool(ctx, &n_pools);
+    if (!poolinfo) {
+        return ERROR_NOMEM;
+    }
+
+    if (libxl_get_topologyinfo(ctx, &topology)) {
+        ret = ERROR_FAIL;
+        goto out;
+    }
+
+    *cpus = 0;
+    for (p = 0; p < n_pools; p++) {
+        if (poolinfo[p].poolid == poolid) {
+            for (cpu = 0; cpu < topology.nodemap.entries; cpu++) {
+                if ((topology.nodemap.array[cpu] == node) &&
+                    libxl_cpumap_test(&poolinfo[p].cpumap, cpu) &&
+                    !libxl_cpupool_cpuremove(ctx, poolid, cpu)) {
+                        (*cpus)++;
+                }
+            }
+        }
+    }
+
+    libxl_topologyinfo_destroy(&topology);
+
+out:
+    for (p = 0; p < n_pools; p++) {
+        libxl_cpupoolinfo_destroy(poolinfo + p);
+    }
+
+    return ret;
 }
 
 int libxl_cpupool_movedomain(libxl_ctx *ctx, uint32_t poolid, uint32_t domid)
diff -r 823571e65b69 -r 34367a3d42f7 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Thu Dec 09 11:23:20 2010 +0100
+++ b/tools/libxl/libxl.h	Thu Dec 09 11:26:37 2010 +0100
@@ -525,7 +525,9 @@ int libxl_create_cpupool(libxl_ctx *ctx,
                          uint32_t *poolid);
 int libxl_destroy_cpupool(libxl_ctx *ctx, uint32_t poolid);
 int libxl_cpupool_cpuadd(libxl_ctx *ctx, uint32_t poolid, int cpu);
+int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus);
 int libxl_cpupool_cpuremove(libxl_ctx *ctx, uint32_t poolid, int cpu);
+int libxl_cpupool_cpuremove_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus);
 int libxl_cpupool_movedomain(libxl_ctx *ctx, uint32_t poolid, uint32_t domid);
 
 /* common paths */
diff -r 823571e65b69 -r 34367a3d42f7 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Dec 09 11:23:20 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Thu Dec 09 11:26:37 2010 +0100
@@ -5402,10 +5402,12 @@ int main_cpupoolcreate(int argc, char **
     uint32_t poolid;
     int schedid = -1;
     XLU_ConfigList *cpus;
-    int n_cpus, i, n;
+    XLU_ConfigList *nodes;
+    int n_cpus, n_nodes, i, n;
     libxl_cpumap freemap;
     libxl_cpumap cpumap;
     libxl_uuid uuid;
+    libxl_topologyinfo topology;
 
     while (1) {
         opt = getopt_long(argc, argv, "hnf:", long_options, &option_index);
@@ -5514,7 +5516,32 @@ int main_cpupoolcreate(int argc, char **
         fprintf(stderr, "Failed to allocate cpumap\n");
         return -ERROR_FAIL;
     }
-    if (!xlu_cfg_get_list(config, "cpus", &cpus, 0, 0)) {
+    if (!xlu_cfg_get_list(config, "nodes", &nodes, 0, 0)) {
+        n_cpus = 0;
+        n_nodes = 0;
+        if (libxl_get_topologyinfo(&ctx, &topology)) {
+            fprintf(stderr, "libxl_get_topologyinfo failed\n");
+            return -ERROR_FAIL;
+        }
+        while ((buf = xlu_cfg_get_listitem(nodes, n_nodes)) != NULL) {
+            n = atoi(buf);
+            for (i = 0; i < topology.nodemap.entries; i++) {
+                if ((topology.nodemap.array[i] == n) &&
+                    libxl_cpumap_test(&freemap, i)) {
+                    libxl_cpumap_set(&cpumap, i);
+                    n_cpus++;
+                }
+            }
+            n_nodes++;
+        }
+
+        libxl_topologyinfo_destroy(&topology);
+
+        if (n_cpus == 0) {
+            fprintf(stderr, "no free cpu found\n");
+            return -ERROR_FAIL;
+        }
+    } else if (!xlu_cfg_get_list(config, "cpus", &cpus, 0, 0)) {
         n_cpus = 0;
         while ((buf = xlu_cfg_get_listitem(cpus, n_cpus)) != NULL) {
             i = atoi(buf);
@@ -5698,6 +5725,8 @@ int main_cpupoolcpuadd(int argc, char **
     const char *pool;
     uint32_t poolid;
     int cpu;
+    int node;
+    int n;
 
     while ((opt = getopt(argc, argv, "h")) != -1) {
         switch (opt) {
@@ -5722,7 +5751,13 @@ int main_cpupoolcpuadd(int argc, char **
         help("cpupool-cpu-add");
         return -ERROR_FAIL;
     }
-    cpu = atoi(argv[optind]);
+    node = -1;
+    cpu = -1;
+    if (strncmp(argv[optind], "node:", 5) == 0) {
+        node = atoi(argv[optind] + 5);
+    } else {
+        cpu = atoi(argv[optind]);
+    }
 
     if (cpupool_qualifier_to_cpupoolid(pool, &poolid, NULL) ||
         !libxl_cpupoolid_to_name(&ctx, poolid)) {
@@ -5730,7 +5765,21 @@ int main_cpupoolcpuadd(int argc, char **
         return -ERROR_FAIL;
     }
 
-    return -libxl_cpupool_cpuadd(&ctx, poolid, cpu);
+    if (cpu >= 0) {
+        return -libxl_cpupool_cpuadd(&ctx, poolid, cpu);
+    }
+
+    if (libxl_cpupool_cpuadd_node(&ctx, poolid, node, &n)) {
+        fprintf(stderr, "libxl_cpupool_cpuadd_node failed\n");
+        return -ERROR_FAIL;
+    }
+
+    if (n > 0) {
+        return 0;
+    }
+
+    fprintf(stderr, "no free cpu found\n");
+    return -ERROR_FAIL;
 }
 
 int main_cpupoolcpuremove(int argc, char **argv)
@@ -5739,6 +5788,8 @@ int main_cpupoolcpuremove(int argc, char
     const char *pool;
     uint32_t poolid;
     int cpu;
+    int node;
+    int n;
 
     while ((opt = getopt(argc, argv, "h")) != -1) {
         switch (opt) {
@@ -5763,7 +5814,13 @@ int main_cpupoolcpuremove(int argc, char
         help("cpupool-cpu-remove");
         return -ERROR_FAIL;
     }
-    cpu = atoi(argv[optind]);
+    node = -1;
+    cpu = -1;
+    if (strncmp(argv[optind], "node:", 5) == 0) {
+        node = atoi(argv[optind] + 5);
+    } else {
+        cpu = atoi(argv[optind]);
+    }
 
     if (cpupool_qualifier_to_cpupoolid(pool, &poolid, NULL) ||
         !libxl_cpupoolid_to_name(&ctx, poolid)) {
@@ -5771,7 +5828,21 @@ int main_cpupoolcpuremove(int argc, char
         return -ERROR_FAIL;
     }
 
-    return -libxl_cpupool_cpuremove(&ctx, poolid, cpu);
+    if (cpu >= 0) {
+        return -libxl_cpupool_cpuremove(&ctx, poolid, cpu);
+    }
+
+    if (libxl_cpupool_cpuremove_node(&ctx, poolid, node, &n)) {
+        fprintf(stderr, "libxl_cpupool_cpuremove_node failed\n");
+        return -ERROR_FAIL;
+    }
+
+    if (n == 0) {
+        fprintf(stderr, "no cpu of node found in cpupool\n");
+        return -ERROR_FAIL;
+    }
+
+    return 0;
 }
 
 int main_cpupoolmigrate(int argc, char **argv)
diff -r 823571e65b69 -r 34367a3d42f7 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Thu Dec 09 11:23:20 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c	Thu Dec 09 11:26:37 2010 +0100
@@ -361,12 +361,12 @@ struct cmd_spec cmd_table[] = {
     { "cpupool-cpu-add",
       &main_cpupoolcpuadd,
       "Adds a CPU to a CPU pool",
-      "<CPU Pool> <CPU nr>",
+      "<CPU Pool> <CPU nr>|node:<node nr>",
     },
     { "cpupool-cpu-remove",
       &main_cpupoolcpuremove,
       "Removes a CPU from a CPU pool",
-      "<CPU Pool> <CPU nr>",
+      "<CPU Pool> <CPU nr>|node:<node nr>",
     },
     { "cpupool-migrate",
       &main_cpupoolmigrate,

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 4 of 5] Support renaming of cpupools
  2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
                       ` (2 preceding siblings ...)
  2010-12-09 12:39     ` [PATCH 3 of 5] Extend cpupools to support numa Juergen Gross
@ 2010-12-09 12:39     ` Juergen Gross
  2010-12-09 12:39     ` [PATCH 5 of 5] Support new xl command cpupool-numa-split Juergen Gross
  2010-12-17  6:09     ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
  5 siblings, 0 replies; 16+ messages in thread
From: Juergen Gross @ 2010-12-09 12:39 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]

Add a new library function libxl_cpupool_rename() and a new xl command
xl cpupool-rename to support renaming of cpupools.

Signed-off-by: juergen.gross@ts.fujitsu.com


6 files changed, 93 insertions(+), 2 deletions(-)
tools/libxl/libxl.c       |   43 +++++++++++++++++++++++++++++++++++++++++++
tools/libxl/libxl.h       |    1 +
tools/libxl/libxl_utils.c |    4 ++--
tools/libxl/xl.h          |    1 +
tools/libxl/xl_cmdimpl.c  |   41 +++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c |    5 +++++



[-- Attachment #2: xen-work-5.patch --]
[-- Type: text/x-patch, Size: 5370 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1291898252 -3600
# Node ID 0a2df9e227c678d3dfcd04b19925ced8714a2524
# Parent  34367a3d42f7f8145bdc74c464f6822144aeab70
Support renaming of cpupools

Add a new library function libxl_cpupool_rename() and a new xl command
xl cpupool-rename to support renaming of cpupools.

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Thu Dec 09 11:26:37 2010 +0100
+++ b/tools/libxl/libxl.c	Thu Dec 09 13:37:32 2010 +0100
@@ -3809,6 +3809,49 @@ out:
     return rc;
 }
 
+int libxl_cpupool_rename(libxl_ctx *ctx, const char *name, uint32_t poolid)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    xs_transaction_t t;
+    xc_cpupoolinfo_t *info;
+    int rc;
+
+    info = xc_cpupool_getinfo(ctx->xch, poolid);
+    if (info == NULL) {
+        libxl__free_all(&gc);
+        return ERROR_NOMEM;
+    }
+
+    rc = ERROR_INVAL;
+    if (info->cpupool_id != poolid)
+        goto out;
+
+    rc = 0;
+
+    for (;;) {
+        t = xs_transaction_start(ctx->xsh);
+
+        libxl__xs_write(&gc, t,
+                        libxl__sprintf(&gc, "/local/pool/%d/name", poolid),
+                        "%s", name);
+
+        if (xs_transaction_end(ctx->xsh, t, 0))
+            break;
+
+        if (errno == EAGAIN)
+            continue;
+
+        rc = ERROR_FAIL;
+        break;
+    }
+
+out:
+    xc_cpupool_infofree(ctx->xch, info);
+    libxl__free_all(&gc);
+
+    return rc;
+}
+
 int libxl_cpupool_cpuadd(libxl_ctx *ctx, uint32_t poolid, int cpu)
 {
     int rc;
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Thu Dec 09 11:26:37 2010 +0100
+++ b/tools/libxl/libxl.h	Thu Dec 09 13:37:32 2010 +0100
@@ -524,6 +524,7 @@ int libxl_create_cpupool(libxl_ctx *ctx,
                          libxl_cpumap cpumap, libxl_uuid *uuid,
                          uint32_t *poolid);
 int libxl_destroy_cpupool(libxl_ctx *ctx, uint32_t poolid);
+int libxl_cpupool_rename(libxl_ctx *ctx, const char *name, uint32_t poolid);
 int libxl_cpupool_cpuadd(libxl_ctx *ctx, uint32_t poolid, int cpu);
 int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus);
 int libxl_cpupool_cpuremove(libxl_ctx *ctx, uint32_t poolid, int cpu);
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Thu Dec 09 11:26:37 2010 +0100
+++ b/tools/libxl/libxl_utils.c	Thu Dec 09 13:37:32 2010 +0100
@@ -107,10 +107,10 @@ char *libxl_cpupoolid_to_name(libxl_ctx 
     char path[strlen("/local/pool") + 12];
     char *s;
 
-    if (poolid == 0)
-        return strdup("Pool-0");
     snprintf(path, sizeof(path), "/local/pool/%d/name", poolid);
     s = xs_read(ctx->xsh, XBT_NULL, path, &len);
+    if (!s && (poolid == 0))
+        return strdup("Pool-0");
     return s;
 }
 
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/xl.h
--- a/tools/libxl/xl.h	Thu Dec 09 11:26:37 2010 +0100
+++ b/tools/libxl/xl.h	Thu Dec 09 13:37:32 2010 +0100
@@ -82,6 +82,7 @@ int main_cpupoolcreate(int argc, char **
 int main_cpupoolcreate(int argc, char **argv);
 int main_cpupoollist(int argc, char **argv);
 int main_cpupooldestroy(int argc, char **argv);
+int main_cpupoolrename(int argc, char **argv);
 int main_cpupoolcpuadd(int argc, char **argv);
 int main_cpupoolcpuremove(int argc, char **argv);
 int main_cpupoolmigrate(int argc, char **argv);
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Dec 09 11:26:37 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Thu Dec 09 13:37:32 2010 +0100
@@ -5719,6 +5719,47 @@ int main_cpupooldestroy(int argc, char *
     return -libxl_destroy_cpupool(&ctx, poolid);
 }
 
+int main_cpupoolrename(int argc, char **argv)
+{
+    int opt;
+    const char *pool;
+    const char *new_name;
+    uint32_t poolid;
+
+    while ((opt = getopt(argc, argv, "h")) != -1) {
+        switch (opt) {
+        case 'h':
+            help("cpupool-rename");
+            return 0;
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", opt);
+            break;
+        }
+    }
+
+    pool = argv[optind++];
+    if (!pool || !argv[optind]) {
+        fprintf(stderr, "'xl cpupool-rename' requires 2 arguments.\n\n");
+        help("cpupool-rename");
+        return 1;
+    }
+
+    if (cpupool_qualifier_to_cpupoolid(pool, &poolid, NULL) ||
+        !libxl_cpupoolid_to_name(&ctx, poolid)) {
+        fprintf(stderr, "unknown cpupool \'%s\'\n", pool);
+        return -ERROR_FAIL;
+    }
+
+    new_name = argv[optind];
+
+    if (libxl_cpupool_rename(&ctx, new_name, poolid)) {
+        fprintf(stderr, "Can't rename cpupool '%s'.\n", pool);
+        return 1;
+    }
+
+    return 0;
+}
+
 int main_cpupoolcpuadd(int argc, char **argv)
 {
     int opt;
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Thu Dec 09 11:26:37 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c	Thu Dec 09 13:37:32 2010 +0100
@@ -358,6 +358,11 @@ struct cmd_spec cmd_table[] = {
       "Deactivates a CPU pool",
       "<CPU Pool>",
     },
+    { "cpupool-rename",
+      &main_cpupoolrename,
+      "Renames a CPU pool",
+      "<CPU Pool> <new name>",
+    },
     { "cpupool-cpu-add",
       &main_cpupoolcpuadd,
       "Adds a CPU to a CPU pool",

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 5 of 5] Support new xl command cpupool-numa-split
  2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
                       ` (3 preceding siblings ...)
  2010-12-09 12:39     ` [PATCH 4 of 5] Support renaming of cpupools Juergen Gross
@ 2010-12-09 12:39     ` Juergen Gross
  2010-12-17  6:09     ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
  5 siblings, 0 replies; 16+ messages in thread
From: Juergen Gross @ 2010-12-09 12:39 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 449 bytes --]

New xl command cpupool-numa-split which will create one cpupool for each
numa node of the machine. Can be called only if no other cpupools than Pool 0
are defined. After creation the cpupools can be managed as usual.

Signed-off-by: juergen.gross@ts.fujitsu.com


3 files changed, 123 insertions(+)
tools/libxl/xl.h          |    1 
tools/libxl/xl_cmdimpl.c  |  117 +++++++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c |    5 +



[-- Attachment #2: xen-work-5.patch --]
[-- Type: text/x-patch, Size: 5162 bytes --]

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1291891853 -3600
# Node ID ec1ba7d9f2fe7af83df5bae80e461beed6c43972
# Parent  0a2df9e227c678d3dfcd04b19925ced8714a2524
Support new xl command cpupool-numa-split

New xl command cpupool-numa-split which will create one cpupool for each
numa node of the machine. Can be called only if no other cpupools than Pool 0
are defined. After creation the cpupools can be managed as usual.

Signed-off-by: juergen.gross@ts.fujitsu.com

diff -r 0a2df9e227c6 -r ec1ba7d9f2fe tools/libxl/xl.h
--- a/tools/libxl/xl.h	Thu Dec 09 13:37:32 2010 +0100
+++ b/tools/libxl/xl.h	Thu Dec 09 11:50:53 2010 +0100
@@ -86,6 +86,7 @@ int main_cpupoolcpuadd(int argc, char **
 int main_cpupoolcpuadd(int argc, char **argv);
 int main_cpupoolcpuremove(int argc, char **argv);
 int main_cpupoolmigrate(int argc, char **argv);
+int main_cpupoolnumasplit(int argc, char **argv);
 
 void help(const char *command);
 
diff -r 0a2df9e227c6 -r ec1ba7d9f2fe tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Thu Dec 09 13:37:32 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Thu Dec 09 11:50:53 2010 +0100
@@ -5933,3 +5933,120 @@ int main_cpupoolmigrate(int argc, char *
 
     return -libxl_cpupool_movedomain(&ctx, poolid, domid);
 }
+
+int main_cpupoolnumasplit(int argc, char **argv)
+{
+    int ret;
+    int opt;
+    int p;
+    int c;
+    int n;
+    uint32_t poolid;
+    int schedid;
+    int n_pools;
+    int node;
+    char name[16];
+    libxl_uuid uuid;
+    libxl_cpumap cpumap;
+    libxl_cpupoolinfo *poolinfo;
+    libxl_topologyinfo topology;
+
+    while ((opt = getopt(argc, argv, "h")) != -1) {
+        switch (opt) {
+        case 'h':
+            help("cpupool-numa-split");
+            return 0;
+        default:
+            fprintf(stderr, "option `%c' not supported.\n", opt);
+            break;
+        }
+    }
+    ret = 0;
+
+    poolinfo = libxl_list_cpupool(&ctx, &n_pools);
+    if (!poolinfo) {
+        fprintf(stderr, "error getting cpupool info\n");
+        return -ERROR_NOMEM;
+    }
+    poolid = poolinfo[0].poolid;
+    schedid = poolinfo[0].sched_id;
+    for (p = 0; p < n_pools; p++) {
+        libxl_cpupoolinfo_destroy(poolinfo + p);
+    }
+    if (n_pools > 1) {
+        fprintf(stderr, "splitting not possible, already cpupools in use\n");
+        return -ERROR_FAIL;
+    }
+
+    if (libxl_get_topologyinfo(&ctx, &topology)) {
+        fprintf(stderr, "libxl_get_topologyinfo failed\n");
+        return -ERROR_FAIL;
+    }
+
+    if (libxl_cpumap_alloc(&ctx, &cpumap)) {
+        fprintf(stderr, "Failed to allocate cpumap\n");
+        libxl_topologyinfo_destroy(&topology);
+        return -ERROR_FAIL;
+    }
+
+    /* Reset Pool-0 to 1st node: first add cpus, then remove cpus to avoid
+       a cpupool without cpus in between */
+
+    node = topology.nodemap.array[0];
+    if (libxl_cpupool_cpuadd_node(&ctx, 0, node, &n)) {
+        fprintf(stderr, "error on adding cpu to Pool 0\n");
+        return -ERROR_FAIL;
+    }
+
+    snprintf(name, 15, "Pool-node%d", node);
+    ret = -libxl_cpupool_rename(&ctx, name, 0);
+    if (ret) {
+        fprintf(stderr, "error on renaming Pool 0\n");
+        goto out;
+    }
+
+    for (c = 0; c < topology.nodemap.entries; c++) {
+        if (topology.nodemap.array[c] == node) {
+            topology.nodemap.array[c] = LIBXL_CPUARRAY_INVALID_ENTRY;
+        }
+    }
+
+    for (c = 0; c < topology.nodemap.entries; c++) {
+        if (topology.nodemap.array[c] == LIBXL_CPUARRAY_INVALID_ENTRY) {
+            continue;
+        }
+
+        node = topology.nodemap.array[c];
+        ret = -libxl_cpupool_cpuremove_node(&ctx, 0, node, &n);
+        if (ret) {
+            fprintf(stderr, "error on removing cpu from Pool 0\n");
+            goto out;
+        }
+
+        snprintf(name, 15, "Pool-node%d", node);
+        libxl_uuid_generate(&uuid);
+        ret = -libxl_create_cpupool(&ctx, name, schedid, cpumap, &uuid, &poolid);
+        if (ret) {
+            fprintf(stderr, "error on creating cpupool\n");
+            goto out;
+        }
+
+        ret = -libxl_cpupool_cpuadd_node(&ctx, 0, node, &n);
+        if (ret) {
+            fprintf(stderr, "error on adding cpus to cpupool\n");
+            goto out;
+        }
+
+        for (p = c; p < topology.nodemap.entries; p++) {
+            if (topology.nodemap.array[p] == node) {
+                topology.nodemap.array[p] = LIBXL_CPUARRAY_INVALID_ENTRY;
+            }
+        }
+    }
+
+out:
+    libxl_topologyinfo_destroy(&topology);
+    libxl_cpumap_destroy(&cpumap);
+
+    return ret;
+}
diff -r 0a2df9e227c6 -r ec1ba7d9f2fe tools/libxl/xl_cmdtable.c
--- a/tools/libxl/xl_cmdtable.c	Thu Dec 09 13:37:32 2010 +0100
+++ b/tools/libxl/xl_cmdtable.c	Thu Dec 09 11:50:53 2010 +0100
@@ -378,6 +378,11 @@ struct cmd_spec cmd_table[] = {
       "Moves a domain into a CPU pool",
       "<Domain> <CPU Pool>",
     },
+    { "cpupool-numa-split",
+      &main_cpupoolnumasplit,
+      "Splits up the machine into one CPU pool per NUMA node",
+      "",
+    },
 };
 
 int cmdtable_len = sizeof(cmd_table)/sizeof(struct cmd_spec);

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1 of 5] Support getting topology info in libxl
  2010-12-09 12:39     ` [PATCH 1 of 5] Support getting topology info in libxl Juergen Gross
@ 2010-12-09 13:11       ` Gianni Tedesco
  2010-12-09 13:19         ` Juergen Gross
  0 siblings, 1 reply; 16+ messages in thread
From: Gianni Tedesco @ 2010-12-09 13:11 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel

On Thu, 2010-12-09 at 12:39 +0000, Juergen Gross wrote:
> 
> +PyObject *attrib__libxl_cpuarray_get(libxl_cpuarray *pptr)
> +{
> +    PyObject *list = NULL;
> +    int i;
> +
> +    list = PyList_New(0);
> +    for (i = 0; i < pptr->entries; i++) {
> +        if (pptr->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY) {
> +            PyList_Append(list, Py_None);
> +            Py_INCREF(Py_None); 


Actually I think I am the one who is confused. It is the other way
around. I need to fix other places that leak references due to this.

IOW, this was good to go first time around, tried to respond earlier but
my mail client barfed the message.

Sorry for the noise! :(

Gianni

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1 of 5] Support getting topology info in libxl
  2010-12-09 13:11       ` Gianni Tedesco
@ 2010-12-09 13:19         ` Juergen Gross
  2010-12-10 17:30           ` Ian Jackson
  0 siblings, 1 reply; 16+ messages in thread
From: Juergen Gross @ 2010-12-09 13:19 UTC (permalink / raw)
  To: Gianni Tedesco; +Cc: xen-devel, Ian Jackson

Ian,

could you take my previous version of this patch (1 of 5), or would you like
me to send another complete patch series?


Juergen

On 12/09/10 14:11, Gianni Tedesco wrote:
> On Thu, 2010-12-09 at 12:39 +0000, Juergen Gross wrote:
>>
>> +PyObject *attrib__libxl_cpuarray_get(libxl_cpuarray *pptr)
>> +{
>> +    PyObject *list = NULL;
>> +    int i;
>> +
>> +    list = PyList_New(0);
>> +    for (i = 0; i<  pptr->entries; i++) {
>> +        if (pptr->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY) {
>> +            PyList_Append(list, Py_None);
>> +            Py_INCREF(Py_None);
>
>
> Actually I think I am the one who is confused. It is the other way
> around. I need to fix other places that leak references due to this.
>
> IOW, this was good to go first time around, tried to respond earlier but
> my mail client barfed the message.
>
> Sorry for the noise! :(

-- 
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1 of 5] Support getting topology info in libxl
  2010-12-09 13:19         ` Juergen Gross
@ 2010-12-10 17:30           ` Ian Jackson
  0 siblings, 0 replies; 16+ messages in thread
From: Ian Jackson @ 2010-12-10 17:30 UTC (permalink / raw)
  To: Juergen Gross; +Cc: xen-devel, Ian Jackson, Gianni Tedesco

Juergen Gross writes ("Re: [Xen-devel] [PATCH 1 of 5] Support getting topology info in libxl"):
> could you take my previous version of this patch (1 of 5), or would you like
> me to send another complete patch series?

I'll take the previous version, thanks.

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0 of 5] support of NUMA topology in xl
  2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
                       ` (4 preceding siblings ...)
  2010-12-09 12:39     ` [PATCH 5 of 5] Support new xl command cpupool-numa-split Juergen Gross
@ 2010-12-17  6:09     ` Juergen Gross
  2010-12-17 17:46       ` Ian Jackson
  5 siblings, 1 reply; 16+ messages in thread
From: Juergen Gross @ 2010-12-17  6:09 UTC (permalink / raw)
  To: xen-devel, Ian Jackson

Ian,

any reason you didn't apply my series up to now?
Did I miss any objection?


Juergen

On 12/09/10 13:39, Juergen Gross wrote:
> This is V3 of my patch series to support NUMA in xl with cpupools.
>
> Patch 1 adds a libxl function to retireve topology information from hypervisor
> Patch 2 adds support of -n option to xl info
> Patch 3 adds possibility to specify complete nodes instead of cpus for cpupools
> Patch 4 adds possibility to rename a cpupool (libxl and xl command)
> Patch 5 adds a new xl command cpupool-numa-split to create one cpupool per numa node
>
> Changes since last version:
> - added Py_INCREF when appending Py_None to list
> - added libxl__free_all(&gc) in libxl_cpupool_rename()
>
> 9 files changed, 540 insertions(+), 21 deletions(-)
> tools/libxl/libxl.c               |  170 ++++++++++++++++++++
> tools/libxl/libxl.h               |   11 +
> tools/libxl/libxl.idl             |    7
> tools/libxl/libxl_utils.c         |   28 +++
> tools/libxl/libxl_utils.h         |    2
> tools/libxl/xl.h                  |    2
> tools/libxl/xl_cmdimpl.c          |  300 +++++++++++++++++++++++++++++++++++--
> tools/libxl/xl_cmdtable.c         |   16 +
> tools/python/xen/lowlevel/xl/xl.c |   25 +++

-- 
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: juergen.gross@ts.fujitsu.com
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0 of 5] support of NUMA topology in xl
  2010-12-17  6:09     ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
@ 2010-12-17 17:46       ` Ian Jackson
  2010-12-17 17:50         ` Keir Fraser
  2010-12-17 21:42         ` [PATCH] xl: fix compilation warning on libxl.c Wei Huang
  0 siblings, 2 replies; 16+ messages in thread
From: Ian Jackson @ 2010-12-17 17:46 UTC (permalink / raw)
  To: Juergen Gross, Keir Fraser; +Cc: xen-devel

Juergen Gross writes ("Re: [Xen-devel] [PATCH 0 of 5] support of NUMA topology in xl"):
> any reason you didn't apply my series up to now?
> Did I miss any objection?

No, there is no problem with your series.  However, our tests are
failing a lot and I wanted to wait until we have a test pass and a
push before dumping a lot more stuff into xen-unstable.

So I'm holding off on your series as well as a few others.

Keir, it would be nice if we could try to restrict stuff going into
xen-unstable to obvious bugfixes, for a bit.

I suggest that our rule for the end-of-December freeze should be that
patches which were posted in their final form or something very like
it by (say) Christmas Eve should go into 4.1, even if we have held off
actually committing them until early January.

Alternatively I can throw everything in now and try to fix it up later
but it does make it harder to pin down what went wrong when things
break.

Ian.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0 of 5] support of NUMA topology in xl
  2010-12-17 17:46       ` Ian Jackson
@ 2010-12-17 17:50         ` Keir Fraser
  2010-12-17 21:42         ` [PATCH] xl: fix compilation warning on libxl.c Wei Huang
  1 sibling, 0 replies; 16+ messages in thread
From: Keir Fraser @ 2010-12-17 17:50 UTC (permalink / raw)
  To: Ian Jackson, Juergen Gross; +Cc: xen-devel

On 17/12/2010 17:46, "Ian Jackson" <Ian.Jackson@eu.citrix.com> wrote:

> Juergen Gross writes ("Re: [Xen-devel] [PATCH 0 of 5] support of NUMA topology
> in xl"):
>> any reason you didn't apply my series up to now?
>> Did I miss any objection?
> 
> No, there is no problem with your series.  However, our tests are
> failing a lot and I wanted to wait until we have a test pass and a
> push before dumping a lot more stuff into xen-unstable.
> 
> So I'm holding off on your series as well as a few others.
> 
> Keir, it would be nice if we could try to restrict stuff going into
> xen-unstable to obvious bugfixes, for a bit.
> 
> I suggest that our rule for the end-of-December freeze should be that
> patches which were posted in their final form or something very like
> it by (say) Christmas Eve should go into 4.1, even if we have held off
> actually committing them until early January.
> 
> Alternatively I can throw everything in now and try to fix it up later
> but it does make it harder to pin down what went wrong when things
> break.

That sounds okay. I have nothing in my queue to be applied now anyway.

 -- Keir

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] xl: fix compilation warning on libxl.c
  2010-12-17 17:46       ` Ian Jackson
  2010-12-17 17:50         ` Keir Fraser
@ 2010-12-17 21:42         ` Wei Huang
  2011-01-05 23:39           ` [PATCH] xl: fix compilation warning on libxl.c [and 2 more messages] Ian Jackson
  1 sibling, 1 reply; 16+ messages in thread
From: Wei Huang @ 2010-12-17 21:42 UTC (permalink / raw)
  To: xen-devel, Ian Jackson

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

This patch fixes a compilation warning (uninitialized parameter before 
use) on libxl.c. Xen failed to compile without it. The warning was 
reported on gcc 4.1.2.

Signed-off-by: Wei Huang <wei.huang2@amd.com>



[-- Attachment #2: libxl_compilation_warning_patch.txt --]
[-- Type: text/plain, Size: 366 bytes --]

diff -r ff1b80ccecd9 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Dec 17 16:12:37 2010 +0000
+++ b/tools/libxl/libxl.c	Fri Dec 17 15:40:35 2010 -0600
@@ -1256,7 +1256,7 @@
     int num = 0, i;
     flexarray_t *dm_args;
     int nb;
-    libxl_device_disk *disks;
+    libxl_device_disk *disks = NULL;
 
     dm_args = flexarray_make(16, 1);
     if (!dm_args)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] fix build error in libxl
@ 2010-12-23  2:08 Zhang, Yang Z
  2011-01-03 13:40 ` Christoph Egger
  0 siblings, 1 reply; 16+ messages in thread
From: Zhang, Yang Z @ 2010-12-23  2:08 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

Move free(disks) into the bracket, or it will show error 'disks' used uninitialized when build libxl.

best regards
yang

diff -r f69037cc4674 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Wed Dec 22 17:48:31 2010 +0000
+++ b/tools/libxl/libxl.c       Thu Dec 23 10:03:35 2010 +0800
@@ -1402,8 +1402,8 @@
             }
             libxl_device_disk_destroy(&disks[i]);
         }
+        free(disks);
     }
-    free(disks);
     flexarray_set(dm_args, num++, NULL);
     return (char **) flexarray_contents(dm_args);
 }

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] fix build error in libxl
  2010-12-23  2:08 [PATCH] fix build error in libxl Zhang, Yang Z
@ 2011-01-03 13:40 ` Christoph Egger
  2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
  0 siblings, 1 reply; 16+ messages in thread
From: Christoph Egger @ 2011-01-03 13:40 UTC (permalink / raw)
  To: xen-devel; +Cc: Zhang, Yang Z, Keir Fraser

On Thursday 23 December 2010 03:08:38 Zhang, Yang Z wrote:
> Move free(disks) into the bracket, or it will show error 'disks' used
> uninitialized when build libxl.

I have the same build problem. My patch is very similar:
http://lists.xensource.com/archives/html/xen-devel/2010-12/msg01011.html

Christoph


>
> best regards
> yang
>
> diff -r f69037cc4674 tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c       Wed Dec 22 17:48:31 2010 +0000
> +++ b/tools/libxl/libxl.c       Thu Dec 23 10:03:35 2010 +0800
> @@ -1402,8 +1402,8 @@
>              }
>              libxl_device_disk_destroy(&disks[i]);
>          }
> +        free(disks);
>      }
> -    free(disks);
>      flexarray_set(dm_args, num++, NULL);
>      return (char **) flexarray_contents(dm_args);
>  }
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel



-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] xl: fix compilation warning on libxl.c [and 2 more messages]
  2010-12-17 21:42         ` [PATCH] xl: fix compilation warning on libxl.c Wei Huang
@ 2011-01-05 23:39           ` Ian Jackson
  0 siblings, 0 replies; 16+ messages in thread
From: Ian Jackson @ 2011-01-05 23:39 UTC (permalink / raw)
  To: Christoph Egger, Zhang, Yang Z, Wei Huang; +Cc: xen-devel, Keir Fraser

Wei Huang writes ("[Xen-devel] [PATCH] xl: fix compilation warning on libxl.c"):
> This patch fixes a compilation warning (uninitialized parameter before 
> use) on libxl.c. Xen failed to compile without it. The warning was 
> reported on gcc 4.1.2.

Zhang, Yang Z writes ("[Xen-devel] [PATCH] fix build error in libxl"):
> Move free(disks) into the bracket, or it will show error 'disks' used uninitialized when build libxl.

Thanks.  I have applied Yang Z Zhang's patch.

Yang, since your patch was only one line I applied it anyway, but in
future could you please provide a Signed-Off-By, confirming the
copyright status according to the Developer's Certificate of Origin ?

Thanks,
Ian.

>From Documentation/SubmittingPatches in the Linux kernel tree:

       Developer's Certificate of Origin 1.1

       By making a contribution to this project, I certify that:

       (a) The contribution was created in whole or in part by me and I
           have the right to submit it under the open source license
           indicated in the file; or

       (b) The contribution is based upon previous work that, to the best
           of my knowledge, is covered under an appropriate open source
           license and I have the right under that license to submit that
           work with modifications, whether created in whole or in part
           by me, under the same open source license (unless I am
           permitted to submit under a different license), as indicated
           in the file; or

       (c) The contribution was provided directly to me by some other
           person who certified (a), (b) or (c) and I have not modified
           it.

       (d) I understand and agree that this project and the contribution
           are public and that a record of the contribution (including all
           personal information I submit with it, including my sign-off) is
           maintained indefinitely and may be redistributed consistent with
           this project or the open source license(s) involved.

--

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-01-05 23:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-23  2:08 [PATCH] fix build error in libxl Zhang, Yang Z
2011-01-03 13:40 ` Christoph Egger
2010-12-09 12:39   ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
2010-12-09 12:39     ` [PATCH 1 of 5] Support getting topology info in libxl Juergen Gross
2010-12-09 13:11       ` Gianni Tedesco
2010-12-09 13:19         ` Juergen Gross
2010-12-10 17:30           ` Ian Jackson
2010-12-09 12:39     ` [PATCH 2 of 5] support topolgy info in xl info Juergen Gross
2010-12-09 12:39     ` [PATCH 3 of 5] Extend cpupools to support numa Juergen Gross
2010-12-09 12:39     ` [PATCH 4 of 5] Support renaming of cpupools Juergen Gross
2010-12-09 12:39     ` [PATCH 5 of 5] Support new xl command cpupool-numa-split Juergen Gross
2010-12-17  6:09     ` [PATCH 0 of 5] support of NUMA topology in xl Juergen Gross
2010-12-17 17:46       ` Ian Jackson
2010-12-17 17:50         ` Keir Fraser
2010-12-17 21:42         ` [PATCH] xl: fix compilation warning on libxl.c Wei Huang
2011-01-05 23:39           ` [PATCH] xl: fix compilation warning on libxl.c [and 2 more messages] Ian Jackson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.