From ab4c36c83498a9ef921adfd50ad71fc7d02bfc6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Thu, 31 Aug 2023 17:08:51 +0200 Subject: [PATCH] virtualbox6: wait at least 1 ms during halt When the wait value is too small the HALT attempt turnes into busy-polling in the VMM. To prevent that always wait a minimal amount of time. Issue #4990. --- repos/ports/src/virtualbox6/sup_vcpu.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/repos/ports/src/virtualbox6/sup_vcpu.cc b/repos/ports/src/virtualbox6/sup_vcpu.cc index e7f782d648..f1196b3b27 100644 --- a/repos/ports/src/virtualbox6/sup_vcpu.cc +++ b/repos/ports/src/virtualbox6/sup_vcpu.cc @@ -721,7 +721,10 @@ template VBOXSTRICTRC Sup::Vcpu_impl::_switch_to_hw() template void Sup::Vcpu_impl::halt(Genode::uint64_t const wait_ns) { - RTSemEventMultiWait(_halt_semevent, wait_ns/RT_NS_1MS); + /* always wait for at least 1 ms */ + Genode::uint64_t const v = wait_ns / RT_NS_1MS ? : 1; + + RTSemEventMultiWait(_halt_semevent, v); RTSemEventMultiReset(_halt_semevent); }