From 07ee9654e49988fb92cdfffbccc75e29f341d53b Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 15 May 2019 13:23:36 +0200 Subject: [PATCH] vm_session: consume spurious wakeups on nova Issue #3111 --- repos/base-nova/src/lib/base/vm_session.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/repos/base-nova/src/lib/base/vm_session.cc b/repos/base-nova/src/lib/base/vm_session.cc index 273f816873..0abeccdf3b 100644 --- a/repos/base-nova/src/lib/base/vm_session.cc +++ b/repos/base-nova/src/lib/base/vm_session.cc @@ -459,16 +459,15 @@ struct Vcpu { Vm_state &state = *reinterpret_cast(vcpu->_state); /* transform state from NOVA to Genode */ - if (exit_reason != VM_EXIT_RECALL) + if (exit_reason != VM_EXIT_RECALL || !previous_blocked) _read_nova_state(utcb, state, exit_reason); - else { - /* consume potential multiple sem ups */ - Nova::sm_ctrl(vcpu->_sm_sel(), Nova::SEMAPHORE_UP); - Nova::sm_ctrl(vcpu->_sm_sel(), Nova::SEMAPHORE_DOWNZERO); - if (!previous_blocked) - _read_nova_state(utcb, state, exit_reason); - else + /* consume potential multiple sem ups */ + Nova::sm_ctrl(vcpu->_sm_sel(), Nova::SEMAPHORE_UP); + Nova::sm_ctrl(vcpu->_sm_sel(), Nova::SEMAPHORE_DOWNZERO); + + if (exit_reason == VM_EXIT_RECALL) { + if (previous_blocked) state.exit_reason = exit_reason; if (vcpu->_remote == PAUSE) {