From 26924c9bcde98dcccc9b095d4ae7df34bebad89d Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Wed, 26 Aug 2015 17:15:11 +0200 Subject: [PATCH] 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 --- repos/ports/ports/virtualbox.hash | 2 +- repos/ports/src/virtualbox/patches/tm_smp.patch | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index 1b9d6aa57..e2ea8adcb 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -2f7963b7ff44a4351e1d16c56445b9823a5b5314 +b4d19845319becd64b6daeb3da2c0b88a07c25a8 diff --git a/repos/ports/src/virtualbox/patches/tm_smp.patch b/repos/ports/src/virtualbox/patches/tm_smp.patch index 2208e4eb2..6e8edb642 100644 --- a/repos/ports/src/virtualbox/patches/tm_smp.patch +++ b/repos/ports/src/virtualbox/patches/tm_smp.patch @@ -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);