Skip to contentSkip to conversation

cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag

PATCH Applied Prashant Malani 3 participants 3 messages Jul 22, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: CPPC: Mark driver with NEED_UPDATE_LIMITS flag

AMU counters on certain CPPC-based platforms tend to yield inaccurate delivered performance measurements on systems that are idle/mostly idle. This results in an inaccurate frequency being stored by cpufreq in its policy structure when the CPU is brought online. [1]

Consequently, if the userspace governor tries to set the frequency to a new value, there is a possibility that it would be the erroneous value stored earlier. In such a scenario, cpufreq would assume that the requested frequency has already been set and return early, resulting in the correct/new frequency request never making it to the hardware.

Since the operating frequency is liable to this sort of inconsistency, mark the CPPC driver with CPUFREQ_NEED_UPDATE_LIMITS so that it is always invoked when a target frequency update is requested.

[1] https://lore.kernel.org/linux-pm/[email protected]/

---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +1 -1
index a1fd0ff22bc5..4a17162a392d 100644
@@ -910,7 +910,7 @@ static struct freq_attr *cppc_cpufreq_attr[] = {
 };
 
 static struct cpufreq_driver cppc_cpufreq_driver = {
-	.flags = CPUFREQ_CONST_LOOPS,
+	.flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
 	.verify = cppc_verify_policy,
 	.target = cppc_cpufreq_set_target,
 	.get = cppc_cpufreq_get_rate,
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · Prashant Malani

AMU counters on certain CPPC-based platforms tend to yield inaccurate delivered performance measurements on systems that are idle/mostly idle. This results in an inaccurate frequency being stored by cpufreq in its policy structure when the CPU is brought online. [1]

Consequently, if the userspace governor tries to set the frequency to a new value, there is a possibility that it would be the erroneous value stored earlier. In such a scenario, cpufreq would assume that the requested frequency has already been set and return early, resulting in the correct/new frequency request never making it to the hardware.

Since the operating frequency is liable to this sort of inconsistency, mark the CPPC driver with CPUFREQ_NEED_UPDATE_LIMITS so that it is always invoked when a target frequency update is requested.

[1] https://lore.kernel.org/linux-pm/[email protected]/

---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +0 -0
index a1fd0ff22bc5..4a17162a392d 100644

drivers/cpufreq/cppc_cpufreq.c static struct freq_attr *cppc_cpufreq_attr[] = { · line 916

Quoted 8 lines
drivers/cpufreq/cppc_cpufreq.c +1 -1
@@ -910,7 +910,7 @@ static struct freq_attr *cppc_cpufreq_attr[] = {
 };
 
 static struct cpufreq_driver cppc_cpufreq_driver = {
-	.flags = CPUFREQ_CONST_LOOPS,
+	.flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
 	.verify = cppc_verify_policy,
 	.target = cppc_cpufreq_set_target,
 	.get = cppc_cpufreq_get_rate,
Signature · 1 line
viresh
maintainer Applied
#2 lore raw
Quoted 34 lines · Viresh Kumar
Quoted 32 lines · Prashant Malani

AMU counters on certain CPPC-based platforms tend to yield inaccurate delivered performance measurements on systems that are idle/mostly idle. This results in an inaccurate frequency being stored by cpufreq in its policy structure when the CPU is brought online. [1]

Consequently, if the userspace governor tries to set the frequency to a new value, there is a possibility that it would be the erroneous value stored earlier. In such a scenario, cpufreq would assume that the requested frequency has already been set and return early, resulting in the correct/new frequency request never making it to the hardware.

Since the operating frequency is liable to this sort of inconsistency, mark the CPPC driver with CPUFREQ_NEED_UPDATE_LIMITS so that it is always invoked when a target frequency update is requested.

[1] https://lore.kernel.org/linux-pm/[email protected]/

---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +0 -0
index a1fd0ff22bc5..4a17162a392d 100644
@@ -910,7 +910,7 @@ static struct freq_attr *cppc_cpufreq_attr[] = {
 };
 
Quoted 8 lines

drivers/cpufreq/cppc_cpufreq.c static struct freq_attr *cppc_cpufreq_attr[] = { · line 916

Quoted 6 lines
drivers/cpufreq/cppc_cpufreq.c +1 -1
 static struct cpufreq_driver cppc_cpufreq_driver = {
-     .flags = CPUFREQ_CONST_LOOPS,
+     .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
      .verify = cppc_verify_policy,
      .target = cppc_cpufreq_set_target,
      .get = cppc_cpufreq_get_rate,

Applied as 6.17 material, thanks!