* [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume
@ 2026-11-11 12:37 Andre Eikmeyer
2026-11-27 15:00 ` Andre Eikmeyer
2026-12-01 23:48 ` Dave Hansen
0 siblings, 2 replies; 5+ messages in thread
From: Andre Eikmeyer @ 2026-11-11 12:37 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen, x86
Cc: hpa, linux-kernel, rafael, linux-pm, lukas, yu.c.chen, Andre Eikmeyer
Some platform firmware, including that of Intel Macs, leaves the APs
with an invalid MTRR state after resume. x86 delays the AP cache
initialization until all APs are online, so an affected AP runs
uncached through its bring-up. On a Core i9 MacBook Pro a resume can
take up to a minute.
Drop the x86 thaw hooks so that cache_ap_online() restores the MTRR and
PAT state of each AP as it comes online, as on CPU hotplug. The APs then
come online right away. Boot keeps the delayed initialization.
Tested on a MacBookAir9,1, MacBookPro15,1 and MacBookPro16,1.
Link: https://lore.kernel.org/all/20180319041843.28218-1-yu.c.chen@intel.com/
Link: https://lore.kernel.org/all/aoCJGj8HixmJ9oaZ@wunner.de/
Suggested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Andre Eikmeyer <dev@deq.rocks>
---
arch/x86/kernel/smpboot.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index dcbaf3f27..bb3fc9a7c 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1251,16 +1251,6 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
snp_set_wakeup_secondary_cpu();
}
-void arch_thaw_secondary_cpus_begin(void)
-{
- set_cache_aps_delayed_init(true);
-}
-
-void arch_thaw_secondary_cpus_end(void)
-{
- cache_aps_init();
-}
-
/*
* Early setup to make printk work.
*/
base-commit: c6279551a44c06f4cb1f7b1df2fb8e0d6d6e54cd
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume
2026-11-11 12:37 [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume Andre Eikmeyer
@ 2026-11-27 15:00 ` Andre Eikmeyer
2026-11-28 1:18 ` Borislav Petkov
2026-12-01 23:48 ` Dave Hansen
1 sibling, 1 reply; 5+ messages in thread
From: Andre Eikmeyer @ 2026-11-27 15:00 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen, x86
Cc: hpa, linux-kernel, rafael, linux-pm, lukas, yu.c.chen
Hi,
gentle ping on this patch. Is there anything you would like me to
change?
Andre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume
2026-11-27 15:00 ` Andre Eikmeyer
@ 2026-11-28 1:18 ` Borislav Petkov
2026-11-28 9:25 ` André Eikmeyer
0 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2026-11-28 1:18 UTC (permalink / raw)
To: Andre Eikmeyer
Cc: tglx, mingo, dave.hansen, x86, hpa, linux-kernel, rafael,
linux-pm, lukas, yu.c.chen
On Fri, Nov 27, 2026 at 04:00:14PM +0100, Andre Eikmeyer wrote:
> gentle ping on this patch. Is there anything you would like me to
> change?
Yes, why is your change correct for all x86 out there?
Yu Chen in his original patch at least tried to do some git archeology, you're
simply axing them off because works-for-me.
Sorry.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume
2026-11-28 1:18 ` Borislav Petkov
@ 2026-11-28 9:25 ` André Eikmeyer
0 siblings, 0 replies; 5+ messages in thread
From: André Eikmeyer @ 2026-11-28 9:25 UTC (permalink / raw)
To: Borislav Petkov
Cc: tglx, mingo, dave.hansen, x86, hpa, linux-kernel, rafael,
linux-pm, lukas, yu.c.chen
On Fri, 27 Nov 2026 17:18:42 -0800
Borislav Petkov <bp@alien8.de> wrote:
> Yes, why is your change correct for all x86 out there?
>
> Yu Chen in his original patch at least tried to do some git
> archeology, you're simply axing them off because works-for-me.
>
> Sorry.
Hi Boris,
No worries, I get you. I should have provided more background info. I am
not trying to axe them off. I could simply use your help.
The patch refers to this discussion with Lukas and Chen Yu on a patch I
sent for early CPU offlining on T2 Macs
https://lore.kernel.org/all/aoCJGj8HixmJ9oaZ@wunner.de/
This is what I found in the history
- d0af9eed5aa9 made each AP init a stop_machine() rendezvous as the SDM
requires. Boot and resume delay the AP init until all APs are up. So
one rendezvous covers all of them.
- The delay assumes that the APs come back from S3 with usable MTRRs.
Some firmware leaves them uncached and each AP then runs uncached
until thaw_secondary_cpus() ends. Lukas saw this on his older
Macbook Pro 9,1, I see it on the T2 Macs.
- Chen Yu's v4 from 2018 did one rendezvous per AP on resume and
reprogrammed only the incoming CPU. It slipped through the cracks.
- Since 0b9a6a8bedb, a rendezvous outside the delayed phase
reprograms only the incoming CPU. Without the thaw hooks resume
takes the same path as CPU hotplug.
You will agree that a resume from S3 taking longer than rebooting is
annoying. Especially on a portable device. It's getting worse the more
cores a CPU has. Like exponentially worse. We see 30 seconds on a 10th
gen I5 and around 3 minutes on a Coffee Lake I9.
However, the only drawback I see is one rendezvous per AP instead of one
for all. I can only test what the T2 community and I have. If this has a
downside on systems that are not affected, please point me to it. As
is, the patch is small and fixes our stuff, from what I thought was a
good thing to begin with. And we could go from here.
Best,
Andre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume
2026-11-11 12:37 [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume Andre Eikmeyer
2026-11-27 15:00 ` Andre Eikmeyer
@ 2026-12-01 23:48 ` Dave Hansen
1 sibling, 0 replies; 5+ messages in thread
From: Dave Hansen @ 2026-12-01 23:48 UTC (permalink / raw)
To: Andre Eikmeyer, tglx, mingo, bp, dave.hansen, x86
Cc: hpa, linux-kernel, rafael, linux-pm, lukas, yu.c.chen
On 11/11/26 04:37, Andre Eikmeyer wrote:
> Some platform firmware, including that of Intel Macs, leaves the APs
> with an invalid MTRR state after resume. x86 delays the AP cache
> initialization until all APs are online, so an affected AP runs
> uncached through its bring-up. On a Core i9 MacBook Pro a resume can
> take up to a minute.
>
> Drop the x86 thaw hooks so that cache_ap_online() restores the MTRR and
> PAT state of each AP as it comes online, as on CPU hotplug. The APs then
> come online right away. Boot keeps the delayed initialization.
This changelog is insufficient to apply the patch. It does not
demonstrate an understanding of the existing code. It just bulldozes the
existing hooks and claims victory for the hardware in the submitter's hands.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-01 23:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 12:37 [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume Andre Eikmeyer
2026-11-27 15:00 ` Andre Eikmeyer
2026-11-28 1:18 ` Borislav Petkov
2026-11-28 9:25 ` André Eikmeyer
2026-12-01 23:48 ` Dave Hansen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®