X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm.c;h=afc8c1ca3c327d3d29e808df5069389f9aac0a8b;hb=f82ccce5ce7629dce6f1a6feee8b47fa13a6756d;hp=ca12fc79db9e712e3fdac68e9271c3d2aff45bb2;hpb=b1128b2a9d269fefc786c60c26878b372d5e39c1;p=palacios.git diff --git a/palacios/src/palacios/vmm.c b/palacios/src/palacios/vmm.c index ca12fc7..afc8c1c 100644 --- a/palacios/src/palacios/vmm.c +++ b/palacios/src/palacios/vmm.c @@ -255,7 +255,11 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { int minor = i % 8; if (core_mask[major] & (0x1 << minor)) { - avail_cores++; + if (v3_cpu_types[i] == V3_INVALID_CPU) { + core_mask[major] &= ~(0x1 << minor); + } else { + avail_cores++; + } } } @@ -323,6 +327,12 @@ int v3_start_vm(struct v3_vm_info * vm, unsigned int cpu_mask) { vcore_id--; } + if (vcore_id >= 0) { + PrintError("Error starting VM: Not enough available CPU cores\n"); + v3_stop_vm(vm); + return -1; + } + return 0; @@ -387,6 +397,20 @@ int v3_move_vm_core(struct v3_vm_info * vm, int vcore_id, int target_cpu) { V3_Print("Moving Core\n"); + +#ifdef V3_CONFIG_VMX + switch (v3_cpu_types[core->pcpu_id]) { + case V3_VMX_CPU: + case V3_VMX_EPT_CPU: + case V3_VMX_EPT_UG_CPU: + PrintDebug("Flushing VMX Guest CPU %d\n", core->vcpu_id); + V3_Call_On_CPU(core->pcpu_id, (void (*)(void *))v3_flush_vmx_vm_core, (void *)core); + break; + default: + break; + } +#endif + if (V3_MOVE_THREAD_TO_CPU(target_cpu, core->core_thread) != 0) { PrintError("Failed to move Vcore %d to CPU %d\n", core->vcpu_id, target_cpu); @@ -400,13 +424,9 @@ int v3_move_vm_core(struct v3_vm_info * vm, int vcore_id, int target_cpu) { */ core->pcpu_id = target_cpu; - V3_Print("core now at %d\n", core->pcpu_id); - + V3_Print("core now at %d\n", core->pcpu_id); } - - - v3_lower_barrier(vm); return 0; @@ -553,11 +573,10 @@ void v3_yield_cond(struct guest_info * info) { cur_cycle = v3_get_host_time(&info->time_state); if (cur_cycle > (info->yield_start_cycle + info->vm_info->yield_cycle_period)) { - - /* - PrintDebug("Conditional Yield (cur_cyle=%p, start_cycle=%p, period=%p)\n", - (void *)cur_cycle, (void *)info->yield_start_cycle, (void *)info->yield_cycle_period); - */ + //PrintDebug("Conditional Yield (cur_cyle=%p, start_cycle=%p, period=%p)\n", + // (void *)cur_cycle, (void *)info->yield_start_cycle, + // (void *)info->yield_cycle_period); + V3_Yield(); info->yield_start_cycle = v3_get_host_time(&info->time_state); }