[PATCH V3 0/4] cpufreq: cppc: Add support for frequency invariance
From: Viresh Kumar
Date: Mon Jun 21 2021 - 05:20:16 EST
Changes since V2:
- We don't need start_cpu() and stop_cpu() callbacks anymore, we can make it
work using policy ->init() and exit() alone.
- Two new cleanup patches 1/4 and 2/4.
- Improved commit log of 3/4.
- Dropped WARN_ON(local_freq_scale > 1024), since this can occur on counter's
overlap (seen with Vincent's setup).
- Handle stuff from init/exit() callbacks only.
Changes since V1:
- Few of the patches migrating users to ->exit() callback are posted separately.
- The CPPC patch was completely reverted and so the support for FIE is again
added here from scratch.
- The start_cpu() and stop_cpu() interface is reworked a little so stop_cpu() is
only ever called for a CPU if start_cpu() was called for it earlier.
- A new patch to implement RCU locking in arch_topology core to avoid some
- Some cleanup and very clear/separate paths for FIE in cppc driver now.
CPPC cpufreq driver is used for ARM servers and this patch series tries to
provide counter-based frequency invariance support for them in the absence for
architecture specific counters (like AMUs).
This was reverted earlier for the 5.13 kernel after Qian Cai reported kernel
oops during suspend/resume.
This is based of v5.13-rc7 + a cleanup patchset:
All the patches are pushed here together for people to run.
This is tested on my Hikey platform (without the actual read/write to
performance counters), with this script for over an hour:
while true; do
for i in `seq 1 7`;
echo 0 > /sys/devices/system/cpu/cpu$i/online;
for i in `seq 1 7`;
echo 1 > /sys/devices/system/cpu/cpu$i/online;
The same is done by Vincent on ThunderX2 and no issues were seen.
I would like to get this merged for 5.14, since it was recently reverted from
5.13. And that it is still an independent change to a single driver and topology
APIs that no one is using apart from arm64 topology stuff.
Viresh Kumar (4):
cpufreq: cppc: Fix potential memleak in cppc_cpufreq_cpu_init
cpufreq: cppc: Pass structure instance by reference
arch_topology: Avoid use-after-free for scale_freq_data
cpufreq: CPPC: Add support for frequency invariance
drivers/base/arch_topology.c | 27 +++-
drivers/cpufreq/Kconfig.arm | 10 ++
drivers/cpufreq/cppc_cpufreq.c | 287 +++++++++++++++++++++++++++++----
include/linux/arch_topology.h | 1 +
kernel/sched/core.c | 1 +
5 files changed, 292 insertions(+), 34 deletions(-)