aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_dm.c
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@Intel.com>2012-06-28 17:51:56 +0100
committerYang Zhang <yang.z.zhang@Intel.com>2012-06-28 17:51:56 +0100
commite1e1e98cacd82fa054ac3c6b381d9833236110e0 (patch)
tree77708e08b3f5c559b3c74d0323d7d33155e00aaa /tools/libxl/libxl_dm.c
parent928c75ce59fc11c707b8bfd0b99ce0c07ab89926 (diff)
downloadxen-e1e1e98cacd82fa054ac3c6b381d9833236110e0.tar.gz
xen-e1e1e98cacd82fa054ac3c6b381d9833236110e0.tar.bz2
xen-e1e1e98cacd82fa054ac3c6b381d9833236110e0.zip
libxl: allow setting more than 31 vcpus
In current implementation, it uses integer to record current avail cpus and this only allows user to specify 31 vcpus. In following patch, it uses cpumap instead integer which make more sense than before. Also there is no limit to the max vcpus. Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl/libxl_dm.c')
-rw-r--r--tools/libxl/libxl_dm.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 340fcfa846..2edc734cff 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -160,6 +160,8 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
}
if (b_info->type == LIBXL_DOMAIN_TYPE_HVM) {
int ioemu_vifs = 0;
+ int nr_set_cpus = 0;
+ char *s;
if (b_info->u.hvm.serial) {
flexarray_vappend(dm_args, "-serial", b_info->u.hvm.serial, NULL);
@@ -200,11 +202,13 @@ static char ** libxl__build_device_model_args_old(libxl__gc *gc,
libxl__sprintf(gc, "%d", b_info->max_vcpus),
NULL);
}
- if (b_info->cur_vcpus) {
- flexarray_vappend(dm_args, "-vcpu_avail",
- libxl__sprintf(gc, "0x%x", b_info->cur_vcpus),
- NULL);
- }
+
+ nr_set_cpus = libxl_cpumap_count_set(&b_info->avail_vcpus);
+ s = libxl_cpumap_to_hex_string(&b_info->avail_vcpus);
+ flexarray_vappend(dm_args, "-vcpu_avail",
+ libxl__sprintf(gc, "%s", s), NULL);
+ free(s);
+
for (i = 0; i < num_vifs; i++) {
if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) {
char *smac = libxl__sprintf(gc,
@@ -443,11 +447,14 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc,
}
if (b_info->max_vcpus > 1) {
flexarray_append(dm_args, "-smp");
- if (b_info->cur_vcpus)
+ if (b_info->avail_vcpus.size) {
+ int nr_set_cpus = 0;
+ nr_set_cpus = libxl_cpumap_count_set(&b_info->avail_vcpus);
+
flexarray_append(dm_args, libxl__sprintf(gc, "%d,maxcpus=%d",
b_info->max_vcpus,
- b_info->cur_vcpus));
- else
+ nr_set_cpus));
+ } else
flexarray_append(dm_args, libxl__sprintf(gc, "%d",
b_info->max_vcpus));
}