Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


moved VM runstate settings to avoid race condition
[palacios.git] / palacios / src / palacios / vmx.c
index 73b5af9..5746e93 100644 (file)
@@ -411,6 +411,11 @@ static int init_vmcs_bios(struct guest_info * core, struct vmx_data * vmx_state)
        v3_hook_msr(core->vm_info, SYSENTER_CS_MSR, NULL, NULL, NULL);
        v3_hook_msr(core->vm_info, SYSENTER_ESP_MSR, NULL, NULL, NULL);
        v3_hook_msr(core->vm_info, SYSENTER_EIP_MSR, NULL, NULL, NULL);
+       
+       v3_hook_msr(core->vm_info, FS_BASE_MSR, NULL, NULL, NULL);
+       v3_hook_msr(core->vm_info, GS_BASE_MSR, NULL, NULL, NULL);
+       
+
     }    
 
     /* Sanity check ctrl/reg fields against hw_defaults */
@@ -815,8 +820,6 @@ int v3_vmx_enter(struct guest_info * info) {
 
     if (vmx_info->state == VMX_UNLAUNCHED) {
        vmx_info->state = VMX_LAUNCHED;
-
-       info->vm_info->run_state = VM_RUNNING;
        ret = v3_vmx_launch(&(info->vm_regs), info, &(info->ctrl_regs));
     } else {
        V3_ASSERT(vmx_info->state != VMX_UNLAUNCHED);
@@ -909,12 +912,17 @@ int v3_start_vmx_guest(struct guest_info * info) {
 
     if (info->vcpu_id == 0) {
        info->core_run_state = CORE_RUNNING;
-       info->vm_info->run_state = VM_RUNNING;
     } else {
 
         PrintDebug("VMX core %u: Waiting for core initialization\n", info->vcpu_id);
 
         while (info->core_run_state == CORE_STOPPED) {
+
+           if (info->vm_info->run_state == VM_STOPPED) {
+               // The VM was stopped before this core was initialized. 
+               return 0;
+           }
+
             v3_yield(info);
             //PrintDebug("VMX core %u: still waiting for INIT\n",info->vcpu_id);
         }