From: Jack Lange Date: Thu, 26 Jul 2012 20:34:40 +0000 (-0400) Subject: added runstate checks in barrier to allow locking operations to proceed when VM is... X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=3848474666fa030031e14b9fdea4caf886e034ca;p=palacios.git added runstate checks in barrier to allow locking operations to proceed when VM is not running --- diff --git a/palacios/src/palacios/vmm_barrier.c b/palacios/src/palacios/vmm_barrier.c index e6f1221..19b2db2 100644 --- a/palacios/src/palacios/vmm_barrier.c +++ b/palacios/src/palacios/vmm_barrier.c @@ -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;