From: Jack Lange Date: Fri, 27 Jul 2012 18:55:59 +0000 (-0400) Subject: incorporate changes to intelligent barriers X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2218fcbc6023d380dbf88895fed679a8e14a210;p=palacios.git incorporate changes to intelligent barriers --- diff --git a/palacios/src/palacios/vmm_events.c b/palacios/src/palacios/vmm_events.c index 4f705b2..a001605 100644 --- a/palacios/src/palacios/vmm_events.c +++ b/palacios/src/palacios/vmm_events.c @@ -96,15 +96,9 @@ struct v3_notifier * v3_subscribe_event(struct v3_vm_info * vm, notifier->priv_data = priv_data; notifier->event_type = event_type; - if ((vm->run_state == VM_RUNNING) || - (vm->run_state == VM_SIMULATING)) { - while (v3_raise_barrier(vm, current_core) == -1); - list_add(&(notifier->node), &(map->events[event_type])); - v3_lower_barrier(vm); - } else { - // No need to lock the list - list_add(&(notifier->node), &(map->events[event_type])); - } + while (v3_raise_barrier(vm, current_core) == -1); + list_add(&(notifier->node), &(map->events[event_type])); + v3_lower_barrier(vm); return notifier;; } @@ -126,24 +120,14 @@ int v3_unsubscribe_event(struct v3_vm_info * vm, struct v3_notifier * notifier, return -1; } - if ((vm->run_state == VM_RUNNING) || - (vm->run_state == VM_SIMULATING)) { - while (v3_raise_barrier(vm, current_core) == -1); - } - - + while (v3_raise_barrier(vm, current_core) == -1); list_for_each_entry_safe(tmp_notifier, safe_notifier, &(map->events[notifier->event_type]), node) { if (tmp_notifier == notifier) { list_del(&(tmp_notifier->node)); V3_Free(tmp_notifier); } } - - - if ((vm->run_state == VM_RUNNING) || - (vm->run_state == VM_SIMULATING)) { - v3_lower_barrier(vm); - } + v3_lower_barrier(vm); return 0; } diff --git a/palacios/src/palacios/vmm_exits.c b/palacios/src/palacios/vmm_exits.c index 8093fae..97504bc 100644 --- a/palacios/src/palacios/vmm_exits.c +++ b/palacios/src/palacios/vmm_exits.c @@ -156,8 +156,7 @@ int v3_hook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, hook->handler = handler; hook->priv_data = priv_data; - if ((vm->run_state == VM_RUNNING) || - (vm->run_state == VM_SIMULATING)) { + if (vm->run_state != VM_INVALID) { int i = 0; while (v3_raise_barrier(vm, current_core) == -1); @@ -207,8 +206,7 @@ int v3_unhook_exit(struct v3_vm_info * vm, v3_exit_type_t exit_type, struct gues hook->priv_data = NULL; - if ((vm->run_state == VM_RUNNING) || - (vm->run_state == VM_SIMULATING)) { + if (vm->run_state != VM_INVALID) { int i = 0; while (v3_raise_barrier(vm, current_core) == -1);