Skip to contentSkip to conversation

support of NUMA topology in xl

PATCH In review Juergen Gross 7 participants 16 messages Dec 9, 2010 – Jan 5, 2011 Arm/actions semi architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support of NUMA topology in xl

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 +++
#1 lore raw

PATCH 1/1 Support getting topology info in libxl

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

Signed-off-by [email protected]
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 +++++++++++++++++

# HG changeset patch
# User Juergen Gross <[email protected]> # 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 [email protected]
tools/libxl/libxl.c +53 -0
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl.c
@@ -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 {
tools/libxl/libxl.h +8 -0
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl.h
@@ -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,
tools/libxl/libxl.idl +7 -0
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl.idl
@@ -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),
tools/libxl/libxl_utils.c +24 -0
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl_utils.c
@@ -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);
tools/libxl/libxl_utils.h +2 -0
diff -r 0c97247c64d6 -r a1eb18bec469 tools/libxl/libxl_utils.h
@@ -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
 
tools/python/xen/lowlevel/xl/xl.c +25 -0
diff -r 0c97247c64d6 -r a1eb18bec469 tools/python/xen/lowlevel/xl/xl.c
@@ -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)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw

PATCH 1/1 support topolgy info in xl info

In reply to Juergen Gross

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 [email protected]
2 files changed, 50 insertions(+), 11 deletions(-)

tools/libxl/xl_cmdimpl.c | 59 +++++++++++++++++++++++++++++++++++++--------
tools/libxl/xl_cmdtable.c | 2 -

# HG changeset patch
# User Juergen Gross <[email protected]> # 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 [email protected]
tools/libxl/xl_cmdimpl.c +49 -10
diff -r a1eb18bec469 -r 823571e65b69 tools/libxl/xl_cmdimpl.c
@@ -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;
 }
 
tools/libxl/xl_cmdtable.c +1 -1
diff -r a1eb18bec469 -r 823571e65b69 tools/libxl/xl_cmdtable.c
@@ -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,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw

PATCH 1/1 Extend cpupools to support numa

In reply to Juergen Gross

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 [email protected]
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 +-

# HG changeset patch
# User Juergen Gross <[email protected]> # 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 [email protected]
tools/libxl/libxl.c +74 -0
diff -r 823571e65b69 -r 34367a3d42f7 tools/libxl/libxl.c
@@ -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)
tools/libxl/libxl.h +2 -0
diff -r 823571e65b69 -r 34367a3d42f7 tools/libxl/libxl.h
@@ -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 */
tools/libxl/xl_cmdimpl.c +77 -6

134 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +2 -2
diff -r 823571e65b69 -r 34367a3d42f7 tools/libxl/xl_cmdtable.c
@@ -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,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#7 lore raw

PATCH 1/1 Support renaming of cpupools

In reply to Juergen Gross

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

Signed-off-by [email protected]
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 +++++

# HG changeset patch
# User Juergen Gross <[email protected]> # 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 [email protected]
tools/libxl/libxl.c +43 -0
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/libxl.c
@@ -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;
tools/libxl/libxl.h +1 -0
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/libxl.h
@@ -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);
tools/libxl/libxl_utils.c +2 -2
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/libxl_utils.c
@@ -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;
 }
 
tools/libxl/xl.h +1 -0
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/xl.h
@@ -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);
tools/libxl/xl_cmdimpl.c +41 -0

47 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +5 -0
diff -r 34367a3d42f7 -r 0a2df9e227c6 tools/libxl/xl_cmdtable.c
@@ -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",

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw

PATCH 1/1 Support new xl command cpupool-numa-split

In reply to Juergen Gross

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 [email protected]
3 files changed, 123 insertions(+)
tools/libxl/xl.h          |    1 
tools/libxl/xl_cmdimpl.c  |  117 +++++++++++++++++++++++++++++++++++++++++++++
tools/libxl/xl_cmdtable.c |    5 +

# HG changeset patch
# User Juergen Gross <[email protected]> # 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 [email protected]
tools/libxl/xl.h +1 -0
diff -r 0a2df9e227c6 -r ec1ba7d9f2fe tools/libxl/xl.h
@@ -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);
 
tools/libxl/xl_cmdimpl.c +117 -0

120 lines not on this page · raw message

tools/libxl/xl_cmdtable.c +5 -0
diff -r 0a2df9e227c6 -r ec1ba7d9f2fe tools/libxl/xl_cmdtable.c
@@ -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);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

Re: [PATCH 1 of 5] Support getting topology info in libxl

In reply to Juergen Gross

tools/python/xen/lowlevel/xl/xl.c PyObject *attrib__libxl_cpumap_get(libxl · line 303

Quoted 11 lines · Juergen Gross
tools/python/xen/lowlevel/xl/xl.c +10 -0
+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

#3 lore raw

Re: [PATCH 1 of 5] Support getting topology info in libxl

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

Quoted 21 lines · Gianni Tedesco

tools/python/xen/lowlevel/xl/xl.c PyObject *attrib__libxl_cpumap_get(libxl · line 303

Quoted 11 lines · Juergen Gross
tools/python/xen/lowlevel/xl/xl.c +10 -0
+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! :(

Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: [email protected]
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html
#4 lore raw

Re: [PATCH 1 of 5] Support getting topology info in libxl

Juergen Gross writes ("Re: [Xen-devel] [PATCH 1 of 5] Support getting topology info in libxl"):

Quoted 2 lines

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.

#9 lore raw
In reply to Juergen Gross

Ian,

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

Juergen

Quoted 22 lines · Juergen Gross

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 +++
Signature · 5 lines
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: [email protected]
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html
#10 lore raw

Juergen Gross writes ("Re: [Xen-devel] [PATCH 0 of 5] support of NUMA topology in xl"):

Quoted 2 lines

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.

#11 lore raw
Quoted 14 lines · Ian Jackson

Juergen Gross writes ("Re: [Xen-devel] [PATCH 0 of 5] support of NUMA topology in xl"):

Quoted 2 lines

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.

Quoted 8 lines

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

#12 lore raw

PATCH 1/1 xl: fix compilation warning on libxl.c

In reply to Ian Jackson

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.

tools/libxl/libxl.c +1 -1
diff -r ff1b80ccecd9 tools/libxl/libxl.c
@@ -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)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#14 lore raw

PATCH 1/1 fix build error in libxl

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

best regards
yang

tools/libxl/libxl.c Thu Dec 23 10:03:35 2010 +0800 renamed from tools/libxl/libxl.c Wed Dec 22 17:48:31 2010 +0000 +1 -1
diff -r f69037cc4674 tools/libxl/libxl.c
@@ -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);
 }
#15 lore raw

Re: [PATCH] fix build error in libxl

Quoted 2 lines · Yang Z

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

Quoted 25 lines

best regards
yang

diff -r f69037cc4674 tools/libxl/libxl.c

tools/libxl/libxl.c Thu Dec 23 10:03:35 2010 +0800 renamed from tools/libxl/libxl.c Wed Dec 22 17:48:31 2010 +0000 +1 -1
@@ -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
[email protected]
http://lists.xensource.com/xen-devel

Signature · 6 lines
---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
#13 lore raw

Re: [PATCH] xl: fix compilation warning on libxl.c [and 2 more messages]

In reply to Wei Huang

Wei Huang writes ("[Xen-devel] [PATCH] xl: fix compilation warning on libxl.c"):

Quoted 3 lines

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"):

Quoted 1 line

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.

Quoted 1 line

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.

--