From 9d49749a49ebb14d1bbb4aafebd6ef678f7f4d95 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Tue, 11 Oct 2016 16:55:54 +0200 Subject: [PATCH] vbox: poke timer emt thread from time to time Fixes #2110 --- repos/ports/ports/virtualbox.hash | 2 +- repos/ports/ports/virtualbox5.hash | 2 +- .../ports/src/virtualbox/patches/tm_tpr.patch | 32 +++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/repos/ports/ports/virtualbox.hash b/repos/ports/ports/virtualbox.hash index eb165e0c1..ae97ba626 100644 --- a/repos/ports/ports/virtualbox.hash +++ b/repos/ports/ports/virtualbox.hash @@ -1 +1 @@ -cfd788e7883eb32d28a8d9504f55e0dfd09421a0 +6efb7a0f12074907d7d1bec973cc47b7ccbb50bf diff --git a/repos/ports/ports/virtualbox5.hash b/repos/ports/ports/virtualbox5.hash index adf194a72..56b7e7891 100644 --- a/repos/ports/ports/virtualbox5.hash +++ b/repos/ports/ports/virtualbox5.hash @@ -1 +1 @@ -3fa7f8218dd03a4752dc8cf34e113cbacc720b98 +7ebd52c12b8c8d332d348cea047c38640cb57c81 diff --git a/repos/ports/src/virtualbox/patches/tm_tpr.patch b/repos/ports/src/virtualbox/patches/tm_tpr.patch index 9ff15c5f1..f214a955f 100644 --- a/repos/ports/src/virtualbox/patches/tm_tpr.patch +++ b/repos/ports/src/virtualbox/patches/tm_tpr.patch @@ -1,5 +1,37 @@ --- a/src/app/virtualbox/src/VBox/VMM/VMMR3/TM.cpp +++ b/src/app/virtualbox/src/VBox/VMM/VMMR3/TM.cpp +@@ -1900,6 +1900,8 @@ + PVMCPU pVCpuDst = &pVM->aCpus[pVM->tm.s.idTimerCpu]; + NOREF(pTimer); + ++ bool ff_scheduled = false; ++ + AssertCompile(TMCLOCK_MAX == 4); + #ifdef DEBUG_Sander /* very annoying, keep it private. */ + if (VMCPU_FF_IS_SET(pVCpuDst, VMCPU_FF_TIMER)) +@@ -1916,6 +1918,7 @@ + && !pVM->tm.s.fRunningQueues + ) + { ++ ff_scheduled = true; + Log5(("TM(%u): FF: 0 -> 1\n", __LINE__)); + VMCPU_FF_SET(pVCpuDst, VMCPU_FF_TIMER); + #ifdef VBOX_WITH_REM +@@ -1924,6 +1927,14 @@ + VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_DONE_REM /** @todo | VMNOTIFYFF_FLAGS_POKE ?*/); + STAM_COUNTER_INC(&pVM->tm.s.StatTimerCallbackSetFF); + } ++ ++ if (!ff_scheduled ++ && VMCPU_FF_IS_PENDING(pVCpuDst, VMCPU_FF_TIMER) ++ && VMCPU_GET_STATE(pVCpuDst) == VMCPUSTATE_STARTED_EXEC ++ ) ++ { ++ VMR3NotifyCpuFFU(pVCpuDst->pUVCpu, VMNOTIFYFF_FLAGS_POKE); ++ } + } + + @@ -1934,6 +1947,7 @@ * * @thread EMT (actually EMT0, but we fend off the others)