diff options
author | Mark Johnston <markj@FreeBSD.org> | 2024-07-29 13:18:10 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2024-07-29 23:57:11 +0000 |
commit | 53bede4bcb3acee01ef26086c9cb5561fb7a20f1 (patch) | |
tree | a05113e950ab58469fdf987bd1a9458f4b6506e6 /emulators | |
parent | 906a11b6b7de2a786c2c6b9c7a9bfbbe95cd934c (diff) | |
download | ports-53bede4bcb3acee01ef26086c9cb5561fb7a20f1.tar.gz ports-53bede4bcb3acee01ef26086c9cb5561fb7a20f1.zip |
emulators/virtualbox-ose-kmod: Catch up with FreeBSD KPI changes
After 1500021, kick_proc0() doesn't exist.
PR: 280495
Approved by: vvd (maintainer)
Reported by: Michael Butler <imb@protected-networks.net>
Diffstat (limited to 'emulators')
-rw-r--r-- | emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h index e647f328a36d..c18492ebdf9b 100644 --- a/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h +++ b/emulators/virtualbox-ose/files/patch-src-VBox-Runtime-r0drv-freebsd-sleepqueue-r0drv-freebsd.h @@ -1,13 +1,15 @@ -Without this patch any waits for periods shorter than a single tick return -immediately leading to a lot of unnecessary spinning. For example, I observe that -my guest's idle loop does a lot of sleeps with periods slightly shorter than 1 ms -(1/hz), e.g. 900us. All that waiting turns into pure spinning and VirtualBox eats -100% of a core. -The patch improves the situation significantly. Also, it (approximately) follows -what tvtohz does. +Without the first part of this patch, any waits for periods shorter than a +single tick return immediately leading to a lot of unnecessary spinning. For +example, I observe that my guest's idle loop does a lot of sleeps with periods +slightly shorter than 1 ms (1/hz), e.g. 900us. All that waiting turns into pure +spinning and VirtualBox eats 100% of a core. + +The clamping improves the situation significantly. Also, it (approximately) +follows what tvtohz does. The rest of the patch just chases an upstream +KPI change. Submitted by: Andriy Gapon <avg@FreeBSD.org> ---- src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h.orig 2021-01-07 15:42:09 UTC +--- src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h.orig 2024-07-29 13:10:32 UTC +++ src/VBox/Runtime/r0drv/freebsd/sleepqueue-r0drv-freebsd.h @@ -84,6 +84,8 @@ DECLINLINE(uint32_t) rtR0SemBsdWaitUpdateTimeout(PRTR0 uint64_t cTicks = ASMMultU64ByU32DivByU32(uTimeout, hz, UINT32_C(1000000000)); @@ -18,3 +20,20 @@ Submitted by: Andriy Gapon <avg@FreeBSD.org> else pWait->iTimeout = (int)cTicks; #endif +@@ -300,10 +302,16 @@ DECLINLINE(void) rtR0SemBsdSignal(void *pvWaitChan) + DECLINLINE(void) rtR0SemBsdSignal(void *pvWaitChan) + { + sleepq_lock(pvWaitChan); ++#if __FreeBSD_version < 1500022 + int fWakeupSwapProc = sleepq_signal(pvWaitChan, SLEEPQ_CONDVAR, 0, 0); ++#else ++ sleepq_signal(pvWaitChan, SLEEPQ_CONDVAR, 0, 0); ++#endif + sleepq_release(pvWaitChan); ++#if __FreeBSD_version < 1500022 + if (fWakeupSwapProc) + kick_proc0(); ++#endif + } + + /** |