vbox: let the first EMT thread handle timers

By default, the EMT thread of the last vCPU handles expired timers. When
running VirtualBox with 2 vCPUs, it sporadically happens that the EMT
thread of the second CPU clears an 'interrupt pending' flag for the first
vCPU after changing the state of a timer device model, which is not
expected by our Genode-specific code (failed assertion '!_irq_win' in the
recall handler).

The problem did not occur yet when letting the EMT thread of the first
vCPU handle the expired timers, which is done by this commit as an interim
fix until the problem has been further investigated.

Issue #1660
This commit is contained in:
Christian Prochaska 2015-08-26 17:15:11 +02:00 committed by Christian Helmuth
parent b438181188
commit 26924c9bcd
2 changed files with 11 additions and 2 deletions

View File

@ -1 +1 @@
2f7963b7ff44a4351e1d16c56445b9823a5b5314
b4d19845319becd64b6daeb3da2c0b88a07c25a8

View File

@ -1,9 +1,18 @@
tm_smp.patch
diff --git a/src/app/virtualbox/src/VBox/VMM/VMMR3/TM.cpp b/src/app/virtualbox/src/VBox/VMM/VMMR3/TM.cpp
index a5dc16e..df851a1 100644
index c3bc22d..33d705c 100644
--- a/src/app/virtualbox/src/VBox/VMM/VMMR3/TM.cpp
+++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/TM.cpp
@@ -210,7 +210,7 @@ VMM_INT_DECL(int) TMR3Init(PVM pVM)
pVM->tm.s.paTimerQueuesRC = MMHyperR3ToRC(pVM, pv);
pVM->tm.s.offVM = RT_OFFSETOF(VM, tm.s);
- pVM->tm.s.idTimerCpu = pVM->cCpus - 1; /* The last CPU. */
+ pVM->tm.s.idTimerCpu = 0; /* The first CPU. */
pVM->tm.s.paTimerQueuesR3[TMCLOCK_VIRTUAL].enmClock = TMCLOCK_VIRTUAL;
pVM->tm.s.paTimerQueuesR3[TMCLOCK_VIRTUAL].u64Expire = INT64_MAX;
pVM->tm.s.paTimerQueuesR3[TMCLOCK_VIRTUAL_SYNC].enmClock = TMCLOCK_VIRTUAL_SYNC;
@@ -1901,10 +1901,19 @@ static DECLCALLBACK(void) tmR3TimerCallback(PRTTIMER pTimer, void *pvUser, uint6
NOREF(pTimer);