[PATCH v4 0/3] cpufreq: CPPC: Update FIE arch_freq_scale in ticks for non-PCC regs
zhenglifeng (A)
zhenglifeng1 at huawei.com
Tue Dec 2 23:55:34 PST 2025
Reviewed-by: Lifeng Zheng <zhenglifeng1 at huawei.com>
On 2025/12/3 11:24, Jie Zhan wrote:
> Currently, the CPPC Frequency Invariance Engine (FIE) is invoked from the
> scheduler tick but defers the update of arch_freq_scale to a separate
> thread because cppc_get_perf_ctrs() would sleep if the CPC regs are in PCC.
>
> However, this deferred update mechanism is unnecessary and introduces extra
> overhead for non-PCC register spaces (e.g. System Memory or FFH), where
> accessing the regs won't sleep and can be safely performed from the tick
> context.
>
> Furthermore, with the CPPC FIE registered, it throws repeated warnings of
> "cppc_scale_freq_workfn: failed to read perf counters" on our platform with
> the CPC regs in System Memory and a power-down idle state enabled. That's
> because the remote CPU can be in a power-down idle state, and reading its
> perf counters returns 0. Moving the FIE handling back to the scheduler
> tick process makes the CPU handle its own perf counters, so it won't be
> idle and the issue would be inherently solved.
>
> To address the above issues, update arch_freq_scale directly in ticks for
> non-PCC regs and keep the deferred update mechanism for PCC regs.
>
> We have tested this on Kunpeng SoCs with the CPC regs both in System Memory
> and FFH. More tests on other platforms are welcome (typically with the
> regs in PCC).
>
> Changelog:
> v4:
> - Allow either non-PCC or PCC scale_freq_tick callbacks to be registered
> for each cpufreq policy.
> - Factor out cppc_perf_ctrs_in_pcc_cpu() and cppc_fie_kworker_init() for
> the above change.
>
> v3:
> https://lore.kernel.org/linux-pm/20251104065039.1675549-1-zhanjie9@hisilicon.com/
> - Stash the state of 'cppc_perf_ctrs_in_pcc' so it won't have to check the
> CPC regs of all CPUs everywhere (Thanks to the suggestion from Beata
> Michalska).
> - Update the commit log, explaining more on the warning issue caused by
> accessing perf counters on remote CPUs.
> - Drop Patch 1 that has been accepted, and rebase Patch 2 on that.
>
> v2:
> https://lore.kernel.org/linux-pm/20250828110212.2108653-1-zhanjie9@hisilicon.com/
> - Update the cover letter and the commit log based on v1 discussion
> - Update FIE arch_freq_scale in ticks for non-PCC regs
>
> v1:
> https://lore.kernel.org/linux-pm/20250730032312.167062-1-yubowen8@huawei.com/
>
> Jie Zhan (3):
> ACPI: CPPC: Factor out and export per-cpu cppc_perf_ctrs_in_pcc_cpu()
> cpufreq: CPPC: Factor out cppc_fie_kworker_init()
> cpufreq: CPPC: Update FIE arch_freq_scale in ticks for non-PCC regs
>
> drivers/acpi/cppc_acpi.c | 45 ++++++++--------
> drivers/cpufreq/cppc_cpufreq.c | 96 ++++++++++++++++++++++------------
> include/acpi/cppc_acpi.h | 5 ++
> 3 files changed, 93 insertions(+), 53 deletions(-)
>
More information about the linux-arm-kernel
mailing list