mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] cpufreq: cppc: Clamp default minimum limit to lowest_nonlinear_perf
@ 2026-02-13 10:06 Pengjie Zhang
  2026-03-03 12:03 ` zhangpengjie (A)
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Pengjie Zhang @ 2026-02-13 10:06 UTC (permalink / raw)
  To: rafael, viresh.kumar
  Cc: linux-pm, linux-kernel, zhanjie9, zhenglifeng1, lihuisong,
	yubowen8, linhongye, linuxarm, jonathan.cameron, zhangpengjie2,
	wangzhi12

The ACPI spec defines 'lowest_nonlinear_perf' as the threshold for
linear performance scaling. Performance levels below this threshold
are typically inefficient and should not be used by default.

Currently, the QoS minimum request is initialized to 0. This defaults
the performance floor to the absolute "Lowest Performance" state
instead of "lowest_nonlinear_perf", allowing the CPU to operate in
an inefficient range unnecessarily.

Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com>
---
Changes in v2:
  - Renamed the patch subject to better reflect the logic change.
  - Updated the commit log to clarify ACPI spec details.
Link to v1:https://lore.kernel.org/all/20260116094555.2978887-1-zhangpengjie2@huawei.com/
---
 drivers/cpufreq/cppc_cpufreq.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 7e8042efedd1..4a3031d9fcf4 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -333,9 +333,23 @@ static unsigned int cppc_cpufreq_fast_switch(struct cpufreq_policy *policy,
 	return target_freq;
 }
 
-static int cppc_verify_policy(struct cpufreq_policy_data *policy)
+static int cppc_verify_policy(struct cpufreq_policy_data *policy_data)
 {
-	cpufreq_verify_within_cpu_limits(policy);
+	if (policy_data->min == FREQ_QOS_MIN_DEFAULT_VALUE) {
+		struct cpufreq_policy *policy __free(put_cpufreq_policy) =
+					      cpufreq_cpu_get(policy_data->cpu);
+		struct cppc_cpudata *cpu_data;
+
+		if (!policy)
+			return -EINVAL;
+
+		cpu_data = policy->driver_data;
+		policy_data->min = cppc_perf_to_khz(&cpu_data->perf_caps,
+			cpu_data->perf_caps.lowest_nonlinear_perf);
+	}
+
+	cpufreq_verify_within_cpu_limits(policy_data);
+
 	return 0;
 }
 
-- 
2.33.0


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-03-10 11:08 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-13 10:06 [PATCH v2] cpufreq: cppc: Clamp default minimum limit to lowest_nonlinear_perf Pengjie Zhang
2026-03-03 12:03 ` zhangpengjie (A)
2026-03-05  6:32   ` Viresh Kumar
2026-03-05  7:00     ` Jie Zhan
2026-03-05 11:31     ` zhenglifeng (A)
2026-03-05 13:14     ` Sumit Gupta
2026-03-06 15:08     ` Pierre Gondois
2026-03-06 18:16       ` Rafael J. Wysocki
2026-03-05 11:34 ` zhenglifeng (A)
2026-03-05 13:49 ` Jie Zhan
2026-03-09 13:16   ` zhangpengjie (A)
2026-03-10  9:12     ` Jie Zhan
2026-03-10 11:07       ` Pierre Gondois

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®