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

[Xen-changelog] [xen-unstable] xl: Support more than 32 vcpus for xl vcpu-set



# HG changeset patch
# User Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
# Date 1297702580 0
# Node ID f8097fe3cf0541e5e251c83051899aa261cf1e66
# Parent  0e7a10dc76170b0ffabd7e0df7ce26ec4c5612f4
xl: Support more than 32 vcpus for xl vcpu-set

xl vcpu-set currently uses a 32 bit mask for specifying which cpus are to be
set online. This restricts the number of cpus supported by this command.

The patch switches to libxl_cpumap, the interface of libxl_set_vcpuonline()
is changed accordingly.

Signed-off-by: Juergen Gross <juergen.gross@xxxxxxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c      |    4 ++--
 tools/libxl/libxl.h      |    2 +-
 tools/libxl/xl_cmdimpl.c |   16 +++++++++++-----
 3 files changed, 14 insertions(+), 8 deletions(-)

diff -r 0e7a10dc7617 -r f8097fe3cf05 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Feb 14 16:55:00 2011 +0000
+++ b/tools/libxl/libxl.c       Mon Feb 14 16:56:20 2011 +0000
@@ -2463,7 +2463,7 @@ int libxl_set_vcpuaffinity(libxl_ctx *ct
     return 0;
 }
 
-int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, uint32_t bitmask)
+int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_cpumap *cpumap)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     libxl_dominfo info;
@@ -2483,7 +2483,7 @@ retry_transaction:
     for (i = 0; i <= info.vcpu_max_id; i++)
         libxl__xs_write(&gc, t,
                        libxl__sprintf(&gc, "%s/cpu/%u/availability", dompath, 
i),
-                       "%s", ((1 << i) & bitmask) ? "online" : "offline");
+                       "%s", libxl_cpumap_test(cpumap, i) ? "online" : 
"offline");
     if (!xs_transaction_end(ctx->xsh, t, 0)) {
         if (errno == EAGAIN)
             goto retry_transaction;
diff -r 0e7a10dc7617 -r f8097fe3cf05 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Mon Feb 14 16:55:00 2011 +0000
+++ b/tools/libxl/libxl.h       Mon Feb 14 16:56:20 2011 +0000
@@ -499,7 +499,7 @@ libxl_vcpuinfo *libxl_list_vcpu(libxl_ct
                                        int *nb_vcpu, int *nrcpus);
 int libxl_set_vcpuaffinity(libxl_ctx *ctx, uint32_t domid, uint32_t vcpuid,
                            libxl_cpumap *cpumap);
-int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, uint32_t bitmask);
+int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_cpumap *cpumap);
 
 int libxl_get_sched_id(libxl_ctx *ctx);
 
diff -r 0e7a10dc7617 -r f8097fe3cf05 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Mon Feb 14 16:55:00 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Mon Feb 14 16:56:20 2011 +0000
@@ -3607,7 +3607,7 @@ static void vcpuset(const char *d, const
 {
     char *endptr;
     unsigned int max_vcpus, i;
-    uint32_t bitmask = 0;
+    libxl_cpumap cpumap;
 
     max_vcpus = strtoul(nr_vcpus, &endptr, 10);
     if (nr_vcpus == endptr) {
@@ -3617,11 +3617,17 @@ static void vcpuset(const char *d, const
 
     find_domain(d);
 
+    if (libxl_cpumap_alloc(&ctx, &cpumap)) {
+        fprintf(stderr, "libxl_cpumap_alloc failed\n");
+        return;
+    }
     for (i = 0; i < max_vcpus; i++)
-        bitmask |= 1 << i;
-
-    if (libxl_set_vcpuonline(&ctx, domid, bitmask) < 0)
-        fprintf(stderr, "libxl_set_vcpuonline failed domid=%d bitmask=%x\n", 
domid, bitmask);
+        libxl_cpumap_set(&cpumap, i);
+
+    if (libxl_set_vcpuonline(&ctx, domid, &cpumap) < 0)
+        fprintf(stderr, "libxl_set_vcpuonline failed domid=%d max_vcpus=%d\n", 
domid, max_vcpus);
+
+    libxl_cpumap_destroy(&cpumap);
 }
 
 int main_vcpuset(int argc, char **argv)

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.