X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fpalacios%2Fvmm_barrier.c;h=f7b863da01e1d9e43f19d9d00598ce7a69e18999;hb=603f73496c7025fc3929f209fd4185627370751c;hp=ab0aae42a4bb2704a3368c2c5e0fbd620ccf8ac6;hpb=9a9c14099c09e9ed86d8ac2f73f7406d0ac8a90b;p=palacios.releases.git diff --git a/palacios/src/palacios/vmm_barrier.c b/palacios/src/palacios/vmm_barrier.c index ab0aae4..f7b863d 100644 --- a/palacios/src/palacios/vmm_barrier.c +++ b/palacios/src/palacios/vmm_barrier.c @@ -104,6 +104,14 @@ int v3_raise_barrier(struct v3_vm_info * vm_info, struct guest_info * local_core all_blocked = 1; for (i = 0; i < vm_info->num_cores; i++) { + + // Tricky: If a core is not running then it is safe to ignore it. + // Whenever we transition a core to the RUNNING state we MUST immediately wait on the barrier. + // TODO: Wrap the state transitions in functions that do this automatically + if (vm_info->cores[i].core_run_state != CORE_RUNNING) { + continue; + } + if (v3_bitmap_check(&(barrier->cpu_map), i) == 0) { // There is still a core that is not waiting at the barrier all_blocked = 0; @@ -157,6 +165,8 @@ int v3_wait_at_barrier(struct guest_info * core) { return 0; } + V3_Print("Core %d waiting at barrier\n", core->vcpu_id); + /* Barrier has been activated. * Wait here until it's lowered */ @@ -164,9 +174,10 @@ int v3_wait_at_barrier(struct guest_info * core) { // set cpu bit in barrier bitmap v3_bitmap_set(&(barrier->cpu_map), core->vcpu_id); + V3_Print("Core %d bit set as waiting\n", core->vcpu_id); // wait for cpu bit to clear - while (v3_bitmap_check(&(barrier->cpu_map), core->vcpu_id) == 1) { + while (v3_bitmap_check(&(barrier->cpu_map), core->vcpu_id)) { v3_yield(core); }