drivers/acpi/cppc_acpi.c | 20 +- drivers/cpufreq/amd-pstate.c | 2 +- drivers/cpufreq/cppc_cpufreq.c | 378 ++++++++++++++++++++++++++++++++- include/acpi/cppc_acpi.h | 8 +- 4 files changed, 381 insertions(+), 27 deletions(-)
This series keeps the CPPC cpufreq policy alive across CPU hotplug and
preserves the OSPM-set CPPC registers (Energy Performance Preference,
Autonomous Activity Window, Autonomous Selection - set via sysfs).
Without online()/offline() callbacks, the core tears a policy down when
its last CPU goes offline and rebuilds it on the way back, re-reading the
CPPC capabilities each time. The values written to these registers can
be lost:
- Across CPU hotplug or suspend/resume: the platform may reset them
while the CPU is offline.
- On driver unload: the driver-written value is left in the register
instead of returning to its pre-driver state.
Handle these with:
- Patch 1: adds online()/offline() callbacks so the core keeps policy
alive across CPU hotplug instead of tearing it down and rebuilding it.
- Patch 2: makes the autonomous selection register helpers take a u64.
- Patch 3: adds a table-driven mechanism that captures each register's
firmware value at init(), restores it from offline(), and reapplies
the OSPM-set value from online().
- Patch 4: extends the same save/restore to system suspend/resume.
v4[4] -> v5:
- Patch 1:
- offline() stops the frequency invariance updates and online()
restarts them, replacing the resync that raced with tick. (Sashiko)
- reorder the functions to match cppc_cpufreq_driver. (Jie Zhan)
- Patch 3:
- reapply the OSPM-set registers even when the performance control
write fails. (Sashiko)
- Patch 4:
- suspend() stops the frequency invariance updates too, completing the
patch 1 change for a policy whose CPUs stay online.
Sumit Gupta (4):
cpufreq: CPPC: Keep the policy across CPU hotplug
ACPI: CPPC: Make autonomous selection helpers take a u64
cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload
cpufreq: CPPC: Preserve OSPM-set registers across suspend/resume
drivers/acpi/cppc_acpi.c | 20 +-
drivers/cpufreq/amd-pstate.c | 2 +-
drivers/cpufreq/cppc_cpufreq.c | 378 ++++++++++++++++++++++++++++++++-
include/acpi/cppc_acpi.h | 8 +-
4 files changed, 381 insertions(+), 27 deletions(-)
[1] v1: https://lore.kernel.org/lkml/20260623095403.3407436-1-sumitg@nvidia.com/
[2] v2: https://lore.kernel.org/lkml/20260716153820.2007095-1-sumitg@nvidia.com/
[3] v3: https://lore.kernel.org/lkml/20260724215937.3368276-1-sumitg@nvidia.com/
[4] v4: https://lore.kernel.org/lkml/20260806200857.601152-1-sumitg@nvidia.com/
--
2.34.1
Hello Sumit, On 9/16/2026 4:08 PM, Sumit Gupta wrote: > This series keeps the CPPC cpufreq policy alive across CPU hotplug and > preserves the OSPM-set CPPC registers (Energy Performance Preference, > Autonomous Activity Window, Autonomous Selection - set via sysfs). > > Without online()/offline() callbacks, the core tears a policy down when > its last CPU goes offline and rebuilds it on the way back, re-reading the > CPPC capabilities each time. The values written to these registers can > be lost: > > - Across CPU hotplug or suspend/resume: the platform may reset them > while the CPU is offline. > - On driver unload: the driver-written value is left in the register > instead of returning to its pre-driver state. > > Handle these with: > > - Patch 1: adds online()/offline() callbacks so the core keeps policy > alive across CPU hotplug instead of tearing it down and rebuilding it. > - Patch 2: makes the autonomous selection register helpers take a u64. > - Patch 3: adds a table-driven mechanism that captures each register's > firmware value at init(), restores it from offline(), and reapplies > the OSPM-set value from online(). > - Patch 4: extends the same save/restore to system suspend/resume. > > v4[4] -> v5: > - Patch 1: > - offline() stops the frequency invariance updates and online() > restarts them, replacing the resync that raced with tick. (Sashiko) > - reorder the functions to match cppc_cpufreq_driver. (Jie Zhan) > - Patch 3: > - reapply the OSPM-set registers even when the performance control > write fails. (Sashiko) > - Patch 4: > - suspend() stops the frequency invariance updates too, completing the > patch 1 change for a policy whose CPUs stay online. > > Sumit Gupta (4): > cpufreq: CPPC: Keep the policy across CPU hotplug > ACPI: CPPC: Make autonomous selection helpers take a u64 > cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload > cpufreq: CPPC: Preserve OSPM-set registers across suspend/resume > > drivers/acpi/cppc_acpi.c | 20 +- > drivers/cpufreq/amd-pstate.c | 2 +- > drivers/cpufreq/cppc_cpufreq.c | 378 ++++++++++++++++++++++++++++++++- > include/acpi/cppc_acpi.h | 8 +- > 4 files changed, 381 insertions(+), 27 deletions(-) I was able to hack the Kconfig to build cppc_cpufreq.c for x86 too and test this out on a Zen3 machine that uses shared memory based CPPC control. FWIW, I could verify that "auto_select" and "energy_performance_preference_val" persists correctly across an offline-online cycle on my system so feel free to include: Tested-by: K Prateek Nayak <kprateek.nayak@amd.com> -- Thanks and Regards, Prateek
On 17/09/26 00:34, K Prateek Nayak wrote: > External email: Use caution opening links or attachments > > > Hello Sumit, > > On 9/16/2026 4:08 PM, Sumit Gupta wrote: >> This series keeps the CPPC cpufreq policy alive across CPU hotplug and >> preserves the OSPM-set CPPC registers (Energy Performance Preference, >> Autonomous Activity Window, Autonomous Selection - set via sysfs). >> >> Without online()/offline() callbacks, the core tears a policy down when >> its last CPU goes offline and rebuilds it on the way back, re-reading the >> CPPC capabilities each time. The values written to these registers can >> be lost: >> >> - Across CPU hotplug or suspend/resume: the platform may reset them >> while the CPU is offline. >> - On driver unload: the driver-written value is left in the register >> instead of returning to its pre-driver state. >> >> Handle these with: >> >> - Patch 1: adds online()/offline() callbacks so the core keeps policy >> alive across CPU hotplug instead of tearing it down and rebuilding it. >> - Patch 2: makes the autonomous selection register helpers take a u64. >> - Patch 3: adds a table-driven mechanism that captures each register's >> firmware value at init(), restores it from offline(), and reapplies >> the OSPM-set value from online(). >> - Patch 4: extends the same save/restore to system suspend/resume. >> >> v4[4] -> v5: >> - Patch 1: >> - offline() stops the frequency invariance updates and online() >> restarts them, replacing the resync that raced with tick. (Sashiko) >> - reorder the functions to match cppc_cpufreq_driver. (Jie Zhan) >> - Patch 3: >> - reapply the OSPM-set registers even when the performance control >> write fails. (Sashiko) >> - Patch 4: >> - suspend() stops the frequency invariance updates too, completing the >> patch 1 change for a policy whose CPUs stay online. >> >> Sumit Gupta (4): >> cpufreq: CPPC: Keep the policy across CPU hotplug >> ACPI: CPPC: Make autonomous selection helpers take a u64 >> cpufreq: CPPC: Preserve OSPM-set registers across hotplug and unload >> cpufreq: CPPC: Preserve OSPM-set registers across suspend/resume >> >> drivers/acpi/cppc_acpi.c | 20 +- >> drivers/cpufreq/amd-pstate.c | 2 +- >> drivers/cpufreq/cppc_cpufreq.c | 378 ++++++++++++++++++++++++++++++++- >> include/acpi/cppc_acpi.h | 8 +- >> 4 files changed, 381 insertions(+), 27 deletions(-) > > I was able to hack the Kconfig to build cppc_cpufreq.c for x86 too > and test this out on a Zen3 machine that uses shared memory based > CPPC control. > > FWIW, I could verify that "auto_select" and > "energy_performance_preference_val" persists correctly across an > offline-online cycle on my system so feel free to include: > > Tested-by: K Prateek Nayak <kprateek.nayak@amd.com> > > -- > Thanks and Regards, > Prateek > Hi Prateek, Thanks for testing on x86. I will add your Tested-by to the series, and Reviewed-by to patch 2. Thanks, Sumit
© 2016 - 2026 Red Hat, Inc.