x86_cstates: Call arch_cpu_pause() if wait is disabled.

This wait() routine is called by cpu_wait(), which is what spinlocks
use in their critical loops. If there is no CPU idle module, then
cpu_wait() just calls arch_cpu_pause(). As "wait" is only enabled in
power-saving mode, we should do the same here to retain the same
behavior (and potentially save some power even in "high-performance" mode.)

Tested on bare metal; performance difference for a compile job
(while on battery) may be 5% lower, or that could just be noise.
This commit is contained in:
Augustin Cavalier 2024-10-17 14:56:31 -04:00
parent 724227e017
commit aa49539d5f

View File

@ -109,8 +109,10 @@ cstates_idle(void)
static void
cstates_wait(int32* variable, int32 test)
{
if (!sEnableWait)
if (!sEnableWait) {
arch_cpu_pause();
return;
}
InterruptsLocker _;
x86_monitor(variable, 0, 0);