[patch 00/10] x86/cpu: Consolidate APERF/MPERF code

From: Thomas Gleixner
Date: Fri Apr 15 2022 - 15:19:58 EST


APERF/MPERF is utilized in two ways:

1) Ad hoc readout of CPU frequency which requires IPIs

2) Frequency scale calculation for frequency invariant scheduling which
reads APERF/MPERF on every tick.

These are completely independent code parts. Eric observed long latencies
when reading /proc/cpuinfo which reads out CPU frequency via #1 and
proposed to replace the per CPU single IPI with a broadcast IPI.

While this makes the latency smaller, it is not necessary at all because #2
samples APERF/MPERF periodically, except on idle or isolated NOHZ full CPUs
which are excluded from IPI already.

It could be argued that not all APERF/MPERF capable systems have the
required BIOS information to enable frequency invariance support, but in
practice most of them do. So the APERF/MPERF sampling can be made
unconditional and just the frequency scale calculation for the scheduler
excluded.

The following series consolidates that.

Thanks,

tglx
---
arch/x86/include/asm/cpu.h | 2
arch/x86/include/asm/topology.h | 17 -
arch/x86/kernel/acpi/cppc.c | 28 --
arch/x86/kernel/cpu/aperfmperf.c | 474 +++++++++++++++++++++++++++++++--------
arch/x86/kernel/cpu/proc.c | 2
arch/x86/kernel/smpboot.c | 358 -----------------------------
fs/proc/cpuinfo.c | 6
include/linux/cpufreq.h | 1
8 files changed, 405 insertions(+), 483 deletions(-)