ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel systems
PATCH 1/1 ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel systems
From: Dave Hansen <[email protected]>
commit e400ad8b7e6a1b9102123c6240289a811501f7d9 upstream.
Old, circa 2002 chipsets have a bug: they don't go idle when they are supposed to. So, a workaround was added to slow the CPU down and ensure that the CPU waits a bit for the chipset to actually go idle. This workaround is ancient and has been in place in some form since the original kernel ACPI implementation.
But, this workaround is very painful on modern systems. The "inl()" can take thousands of cycles (see Link: for some more detailed numbers and some fun kernel archaeology).
First and foremost, modern systems should not be using this code. Typical Intel systems have not used it in over a decade because it is horribly inferior to MWAIT-based idle.
Despite this, people do seem to be tripping over this workaround on AMD system today.
Limit the "dummy wait" workaround to Intel systems. Keep Modern AMD systems from tripping over the workaround. Remotely modern Intel systems use intel_idle instead of this code and will, in practice, remain unaffected by the dummy wait.
---
Hi folks, seems the intention was to send this to stable [0], so here it is, lemme know if you see any issues with that - build tested in 5.10/5.15, also it has been running for a while on Steam Deck's kernel.
Thanks,
Guilherme
[0] https://lore.kernel.org/stable/[email protected]/
drivers/acpi/processor_idle.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)
drivers/acpi/processor_idle.c +20 -3
@@ -536,10 +536,27 @@ static void wait_for_freeze(void)/* No delay is needed if we are in guest */ if (boot_cpu_has (X86_FEATURE_HYPERVISOR ))return ; +/* +* Modern (>=Nehalem) Intel systems use ACPI via intel_idle, +* not this code. Assume that any Intel systems using this +* are ancient and may need the dummy wait. This also assumes +* that the motivating chipset issue was Intel-only. +*/ +if (boot_cpu_data.x86_vendor !=X86_VENDOR_INTEL ) +return ;#endif -/* Dummy wait op - must do something useless after P_LVL2 read -because chipsets cannot guarantee that STPCLK# signal -gets asserted in time to freeze execution properly. */ +/* +* Dummy wait op - must do something useless after P_LVL2 read +* because chipsets cannot guarantee that STPCLK# signal gets +* asserted in time to freeze execution properly +* +* This workaround has been in place since the original ACPI +* implementation was merged, circa 2002. +* +* If a profile is pointing to this instruction, please first +* consider moving your system to a more modern idle +* mechanism. +*/ inl (acpi_gbl_FADT.xpm_timer_block.address); }
Signature · 1 line
2.39.0
Greg KH
maintainerQuoted 34 lines · Guilherme G. Piccoli
From: Dave Hansen <[email protected]>
commit
e400ad8b7e6a1b9102123c6240289a811501f7d9upstream.Old, circa 2002 chipsets have a bug: they don't go idle when they are supposed to. So, a workaround was added to slow the CPU down and ensure that the CPU waits a bit for the chipset to actually go idle. This workaround is ancient and has been in place in some form since the original kernel ACPI implementation.
But, this workaround is very painful on modern systems. The "
inl()" can take thousands of cycles (see Link: for some more detailed numbers and some fun kernel archaeology).First and foremost, modern systems should not be using this code. Typical Intel systems have not used it in over a decade because it is horribly inferior to MWAIT-based idle.
Despite this, people do seem to be tripping over this workaround on AMD system today.
Limit the "dummy wait" workaround to Intel systems. Keep Modern AMD systems from tripping over the workaround. Remotely modern Intel systems use
intel_idleinstead of this code and will, in practice, remain unaffected by the dummy wait.Reported-by K Prateek Nayak <[email protected]>Suggested-by Rafael J. Wysocki <[email protected]>Signed-off-by Dave Hansen <[email protected]>Reviewed-by Mario Limonciello <[email protected]>Tested-by K Prateek Nayak <[email protected]>Signed-off-by Guilherme G. Piccoli <[email protected]>
Quoted 6 lines
---
Hi folks, seems the intention was to send this to stable [0], so here it is, lemme know if you see any issues with that - build tested in 5.10/5.15, also it has been running for a while on Steam Deck's kernel.
Now queued up, thanks.
greg k-h