Re: [PATCH] x86/cache: Restore AP cache state while bringing CPUs online on resume

From: André Eikmeyer

Date: Sat Nov 28 2026 - 04:25:34 EST


On Fri, 27 Nov 2026 17:18:42 -0800
Borislav Petkov <bp@xxxxxxxxx> 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@xxxxxxxxx/

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