linux/drivers/cpufreq
Rafael J. Wysocki f341dc4d93 cpufreq: intel_pstate: Fix max_freq fallback in cpufreq_update_pressure()
After commit d2d5c129d0 ("cpufreq: Make cpufreq_update_pressure() fall
back to cpuinfo.max_freq"), cpufreq pressure appears in the CPU load
balancer unexpectedly in some cases in which it was not present before,
leading to confusion and uncertainty.

Clearly, the scheduler assumes that cpufreq pressure will not be set
unless the capacity reference frequency of the CPU is known, and the
commit mentioned above violates that assumption.

However, in some cases the capacity reference frequency of the CPU is
in fact known even though arch_scale_freq_ref() returns 0 and in those
cases it should be possible to set cpufreq pressure as appropriate.

For this purpose, introduce a new cpufreq driver callback returning
the CPU capacity reference frequency, .scale_freq_ref(), and make
cpufreq_update_pressure() invoke it, if present, instead of falling
back to cpuinfo.max_freq unconditionally.

Add that callback to the intel_pstate driver and make it return 0 unless
the scale-invariant capacity of the given CPU has been explicitly set,
in which cases its reference frequency is always cpuinfo.max_freq.

Fixes: d2d5c129d0 ("cpufreq: Make cpufreq_update_pressure() fall back to cpuinfo.max_freq")
Reported-by: Jianyong Wu <wujianyong@hygon.cn>
Closes: https://lore.kernel.org/linux-pm/20260915065747.1671965-1-wujianyong@hygon.cn/
Tested-by: Jianyong Wu <wujianyong@hygon.cn>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> # Intel hybrid parts
Tested-by: Chen Yu <yu.c.chen@intel.com>
[ rjw: Add READ_ONCE() around a capacity_perf read ]
Link: https://patch.msgid.link/12975163.O9o76ZdvQC@rafael.j.wysocki
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-09-29 12:23:20 +02:00
..
acpi-cpufreq.c cpufreq: Stop using 32-bit MSR interfaces 2026-07-17 11:31:25 +02:00
airoha-cpufreq.c cpufreq: airoha: Convert to of_machine_get_match() 2026-03-13 17:00:04 -05:00
amd_freq_sensitivity.c Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
amd-pstate-trace.c
amd-pstate-trace.h amd-pstate: Introduce a tracepoint trace_amd_pstate_cppc_req2() 2026-04-02 11:28:31 -05:00
amd-pstate-ut.c cpufreq/amd-pstate-ut: Add unit test for CPPC Performance Priority 2026-07-27 19:46:51 -05:00
amd-pstate.c treewide: refresh kmalloc_obj() conversions 2026-09-04 21:37:00 -07:00
amd-pstate.h cpufreq/amd-pstate: Document missing kernel-doc members 2026-07-28 11:05:23 -05:00
apple-soc-cpufreq.c cpufreq: apple-soc: Calculate frequency as a 64-bit value 2026-07-23 09:40:57 +05:30
armada-8k-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
armada-37xx-cpufreq.c Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
bmips-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
brcmstb-avs-cpufreq.c cpufreq: brcmstb-avs: Remove redundant dev_err() 2026-07-14 09:40:21 +05:30
cppc_cpufreq.c ACPI: CPPC: Reject desired_perf reads on _CPC revision 4+ 2026-08-05 14:59:01 +02:00
cpufreq_conservative.c cpufreq: conservative: Simplify frequency limit handling 2026-05-22 18:41:24 +02:00
cpufreq_governor_attr_set.c
cpufreq_governor.c Updates for the NOHZ subsystem: 2026-06-15 13:48:52 +05:30
cpufreq_governor.h Merge back earlier cpufreq material for 7.1 2026-03-27 11:57:31 +01:00
cpufreq_ondemand.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cpufreq_ondemand.h cpufreq: ondemand: Update the efficient idle check for Intel extended Families 2025-09-10 12:25:08 +02:00
cpufreq_performance.c
cpufreq_powersave.c
cpufreq_stats.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cpufreq_userspace.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cpufreq-dt-platdev.c soc: devicetree updates for 7.3 2026-08-18 19:36:32 -07:00
cpufreq-dt.c cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency 2025-10-01 13:56:24 +02:00
cpufreq-dt.h cpufreq: dt: Add register helper 2025-07-09 13:41:33 +05:30
cpufreq-nforce2.c cpufreq: Remove driver default policy->min/max init 2026-06-08 18:42:14 +02:00
cpufreq.c cpufreq: intel_pstate: Fix max_freq fallback in cpufreq_update_pressure() 2026-09-29 12:23:20 +02:00
davinci-cpufreq.c cpufreq: davinci: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
e_powersaver.c cpufreq: Stop using 32-bit MSR interfaces 2026-07-17 11:31:25 +02:00
freq_table.c cpufreq: Remove driver default policy->min/max init 2026-06-08 18:42:14 +02:00
gx-suspmod.c cpufreq: Remove driver default policy->min/max init 2026-06-08 18:42:14 +02:00
highbank-cpufreq.c cpufreq: Add __init annotation to module init funcs 2022-09-26 11:15:04 +05:30
imx-cpufreq-dt.c cpufreq: Switch back to struct platform_driver::remove() 2024-10-28 12:24:39 +01:00
imx6q-cpufreq.c cpufreq: imx6q: fix out-of-bounds write when probed more than once 2026-08-06 11:54:41 +05:30
intel_pstate.c cpufreq: intel_pstate: Fix max_freq fallback in cpufreq_update_pressure() 2026-09-29 12:23:20 +02:00
Kconfig cpufreq: clean up dead code in Kconfig 2026-04-01 15:58:01 +02:00
Kconfig.arm cpufreq: qcom: Unify user-visible "Qualcomm" name 2026-05-05 08:15:34 +05:30
Kconfig.powerpc cpufreq: ppc_cbe: Remove powerpc Cell driver 2025-02-26 21:15:09 +05:30
Kconfig.x86 x86/cpu updates for v7.2: 2026-06-15 15:25:17 +05:30
kirkwood-cpufreq.c cpufreq: kirkwood: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
longhaul.c cpufreq: Stop using 32-bit MSR interfaces 2026-07-17 11:31:25 +02:00
longhaul.h
longrun.c cpufreq: Stop using 32-bit MSR interfaces 2026-07-17 11:31:25 +02:00
loongson2_cpufreq.c cpufreq: loongson: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
loongson3_cpufreq.c cpufreq: loongson: Set .set_boost directly 2025-02-07 09:45:15 +05:30
Makefile cpufreq: elanfreq: Drop support for AMD Elan SC4* 2026-05-22 18:42:19 +02:00
mediatek-cpufreq-hw.c cpufreq: Make drivers using CPUFREQ_ETERNAL specify transition latency 2025-10-01 13:56:24 +02:00
mediatek-cpufreq.c cpufreq: mediatek: Simplify with of_machine_get_match_data() 2025-11-26 19:42:21 -06:00
mvebu-cpufreq.c cpufreq: Init cpufreq only for present CPUs 2025-03-17 11:29:18 +05:30
p4-clockmod.c x86/msr: Switch wrmsr_on_cpu() users to wrmsrq_on_cpu() 2026-06-08 10:01:49 +02:00
pasemi-cpufreq.c cpufreq: pasemi: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:12 +05:30
pcc-cpufreq.c cpufreq: Remove driver default policy->min/max init 2026-06-08 18:42:14 +02:00
pmac32-cpufreq.c cpufreq: pmac: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
pmac64-cpufreq.c cpufreq: pmac: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:13 +05:30
powernow-k6.c cpufreq: Stop using 32-bit MSR interfaces 2026-07-17 11:31:25 +02:00
powernow-k7.c treewide: Explicitly include the x86 CPUID headers 2026-05-06 14:29:59 +02:00
powernow-k7.h
powernow-k8.c x86/msr updates for v7.3: 2026-08-18 14:02:15 -07:00
powernow-k8.h
powernv-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
powernv-trace.h PM: cpufreq: powernv/tracing: Move powernv_throttle trace event 2025-07-21 16:40:56 -04:00
pxa2xx-cpufreq.c cpufreq: pxa3: move clk register access to clk driver 2022-05-07 22:55:49 +02:00
pxa3xx-cpufreq.c cpufreq: Remove driver default policy->min/max init 2026-06-08 18:42:14 +02:00
qcom-cpufreq-hw.c cpufreq: qcom: Add cpufreq scaling support for Qualcomm Shikra SoC 2026-06-08 10:58:07 +05:30
qcom-cpufreq-nvmem.c cpufreq: qcom-nvmem: Add IPQ5210 support 2026-07-02 10:33:20 +05:30
qoriq-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
raspberrypi-cpufreq.c cpufreq: Switch back to struct platform_driver::remove() 2024-10-28 12:24:39 +01:00
rcpufreq_dt.rs Driver core changes for 7.3-rc1 2026-08-19 10:42:18 -07:00
s3c64xx-cpufreq.c cpufreq: s3c64xx: Fix compilation warning 2025-01-23 20:47:32 +01:00
s5pv210-cpufreq.c cpufreq: s5pv210: Simplify with scoped for each OF child loop 2026-02-03 20:58:13 -06:00
sa1110-cpufreq.c ARM: sa1100: remove unused board files 2023-01-12 10:53:12 +01:00
scmi-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
scpi-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sh-cpufreq.c cpufreq: Remove driver default policy->min/max init 2026-06-08 18:42:14 +02:00
sparc-us2e-cpufreq.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
sparc-us3-cpufreq.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
spear-cpufreq.c cpufreq: spear: Fix an IS_ERR() vs NULL bug in spear1340_set_cpu_rate() 2026-07-15 11:15:13 +05:30
speedstep-centrino.c cpufreq: Stop using 32-bit MSR interfaces 2026-07-17 11:31:25 +02:00
speedstep-ich.c cpufreq: speedstep: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:14 +05:30
speedstep-lib.c cpufreq: Stop using 32-bit MSR interfaces 2026-07-17 11:31:25 +02:00
speedstep-lib.h cpufreq: speedstep-lib: Use int type to store negative error codes 2025-09-05 20:28:46 +02:00
speedstep-smi.c cpufreq: speedstep: Stop setting cpufreq_driver->attr field 2025-02-07 09:45:14 +05:30
sti-cpufreq.c cpufreq: Use of_property_present() 2024-08-07 12:11:45 +05:30
sun50i-cpufreq-nvmem.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
tegra20-cpufreq.c Devicetree updates for v6.4, part 2: 2023-04-27 10:09:05 -07:00
tegra124-cpufreq.c drivers: cpufreq: add Tegra114 support 2025-07-15 08:37:35 +05:30
tegra186-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
tegra194-cpufreq.c cpufreq: tegra194: Rename Tegra239 to Tegra238 2026-03-03 09:46:04 +05:30
ti-cpufreq.c cpufreq: ti: Add EPROBE_DEFER for K3 SoCs 2026-06-08 11:16:42 +05:30
vexpress-spc-cpufreq.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
virtual-cpufreq.c cpufreq: Remove driver default policy->min/max init 2026-06-08 18:42:14 +02:00