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.


added state checks for VM control commands
[palacios.releases.git] / palacios / src / palacios / vmm_barrier.c
index 961b894..19b2db2 100644 (file)
@@ -120,7 +120,7 @@ int v3_wait_for_barrier(struct v3_vm_info * vm_info, struct guest_info * local_c
            break;
        }
 
-       v3_yield(local_core);
+       v3_yield(local_core,-1);
     }
 
     return 0;
@@ -141,6 +141,12 @@ int v3_wait_for_barrier(struct v3_vm_info * vm_info, struct guest_info * local_c
 int v3_raise_barrier(struct v3_vm_info * vm_info, struct guest_info * local_core) {
     int ret = 0;
 
+
+    if ((vm_info->run_state != VM_RUNNING) || 
+       (vm_info->run_state != VM_SIMULATING)) {
+       return 0;
+    }
+
     ret = v3_raise_barrier_nowait(vm_info, local_core);
 
     if (ret != 0) {
@@ -162,6 +168,12 @@ int v3_raise_barrier(struct v3_vm_info * vm_info, struct guest_info * local_core
 int v3_lower_barrier(struct v3_vm_info * vm_info) {
     struct v3_barrier * barrier = &(vm_info->barrier);
 
+    
+    if ((vm_info->run_state != VM_RUNNING) || 
+       (vm_info->run_state != VM_SIMULATING)) {
+       return 0;
+    }
+
     // Clear the active flag, so cores won't wait 
     barrier->active = 0;
 
@@ -199,7 +211,7 @@ int v3_wait_at_barrier(struct guest_info * core) {
 
     // wait for cpu bit to clear
     while (v3_bitmap_check(&(barrier->cpu_map), core->vcpu_id)) {
-       v3_yield(core);
+       v3_yield(core,-1);
     }
 
     return 0;