Re: [PATCH] x86/mtrr: Expedite cache init if MTRRs change on resume
From: Jürgen Groß
Date: Wed Feb 04 2026 - 11:24:47 EST
On 04.02.26 17:15, Chris Paulson-Ellis wrote:
An Apple MacBook Pro mid-2015 almost always takes ~20s to resume from
suspend, measured from lid open to display of the desktop lock screen.
This is due to the MTRRs being different between suspend and resume on 4
out of the 8 CPUs, including the boot CPU. The CPUs execute very slowly
until arch_thaw_secondary_cpus_end() calls cache_aps_init(), which
restores the MTRR settings to their pre-suspend values.
To obtain a reasonable resume time, we need to minimise the time the
CPUs execute with inconsistent MTRR settings.
We do this by detecting the unexpected restore of the MTRRs on the boot
CPU in cache_bp_restore(), and use this to override the delay of cache
initialisation in the cache_ap_online() CPU hotplug handler, and
skip the delayed cache initialisation in cache_aps_init().
With this fix, the system in question resumes in ~3s.
Does it get even better with my still pending series [1] applied?
[1]: https://lore.kernel.org/lkml/20260130113625.599305-1-jgross@xxxxxxxx/
Juergen
Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature