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

[Xen-devel] [PATCH] libxl: vcpu_avail is a bitmask, use it as such



vcpu_avail is a bitmask of available cpus but we are currently using it
as the number of cpus available. This patch fixes it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

diff -r 6580ff415189 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Wed Sep 07 13:29:15 2011 +0000
+++ b/tools/libxl/libxl_dm.c    Wed Sep 07 15:39:46 2011 +0000
@@ -360,8 +360,13 @@ static char ** libxl__build_device_model
         }
         if (info->vcpus > 1) {
             flexarray_append(dm_args, "-smp");
+            /* vcpu_avail is actually a bit mask, the new qemu doesn't
+             * support a bitmask of available cpus but it supports a
+             * number of available cpus lower than the maximum number of
+             * cpus. Let's do that for now. */
             if (info->vcpu_avail)
-                flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d", 
info->vcpus, info->vcpu_avail));
+                flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d",
+                            __builtin_popcount(info->vcpu_avail), 
info->vcpus));
             else
                 flexarray_append(dm_args, libxl__sprintf(gc, "%d", 
info->vcpus));
         }

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


 


Rackspace

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