From: Oscar Mondragon Date: Mon, 25 Aug 2014 01:34:36 +0000 (-0600) Subject: v3_cpu_mapper_admit_vm function call moved from start_thread to create_thread X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=8e4b89f4bc2e252e0c1bc7cbc52bf1f4ae2e538c v3_cpu_mapper_admit_vm function call moved from start_thread to create_thread --- diff --git a/linux_module/vm.c b/linux_module/vm.c index 2ff482b..d352c36 100644 --- a/linux_module/vm.c +++ b/linux_module/vm.c @@ -408,7 +408,7 @@ int create_palacios_vm(struct v3_guest * guest) { return -1; } - guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name); + guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name, (0x1 << num_online_cpus()) - 1); if (guest->v3_ctx == NULL) { WARNING("palacios: failed to create vm\n"); diff --git a/palacios/include/palacios/vmm.h b/palacios/include/palacios/vmm.h index 9071fb7..1f6228e 100644 --- a/palacios/include/palacios/vmm.h +++ b/palacios/include/palacios/vmm.h @@ -433,7 +433,7 @@ void Init_V3(struct v3_os_hooks * hooks, char * cpus, int num_cpus, char *option void Shutdown_V3( void ); -struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name); +struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name, unsigned int cpu_mask); int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask); int v3_stop_vm(struct v3_vm_info * vm); int v3_pause_vm(struct v3_vm_info * vm); diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index b5740a6..b291ada 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -298,7 +298,7 @@ static int start_core(void * p) return 0; } -struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name) { +struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name, unsigned int cpu_mask) { struct v3_vm_info * vm = v3_config_guest(cfg, priv_data); int vcore_id = 0; @@ -332,7 +332,11 @@ struct v3_vm_info * v3_create_vm(void * cfg, void * priv_data, char * name) { PrintError(vm, VCORE_NONE,"Error registering VM with scheduler\n"); } - for (vcore_id = 0; vcore_id < vm->num_cores; vcore_id++) { + if (v3_cpu_mapper_admit_vm(vm,cpu_mask) != 0){ + PrintError(vm, VCORE_NONE,"Error admitting VM %s for mapping", vm->name); + } + + for (vcore_id = 0; vcore_id < vm->num_cores; vcore_id++) { struct guest_info * core = &(vm->cores[vcore_id]); @@ -395,10 +399,6 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { } vm->avail_cores = avail_cores; - - if (v3_cpu_mapper_admit_vm(vm,cpu_mask) != 0){ - PrintError(vm, VCORE_NONE,"Error admitting VM %s for mapping", vm->name); - } if (v3_scheduler_admit_vm(vm) != 0){ PrintError(vm, VCORE_NONE,"Error admitting VM %s for scheduling", vm->name);