linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpufreq/cppc: changing highest_perf to nominal_perf in cppc_cpufreq_cpu_init()
@ 2024-04-28  9:28 liwei
  2024-04-29 10:49 ` Viresh Kumar
  0 siblings, 1 reply; 14+ messages in thread
From: liwei @ 2024-04-28  9:28 UTC (permalink / raw)
  To: rafael, viresh.kumar
  Cc: al.stone, ashwin.chaugule, linux-pm, linux-kernel, liwei391,
	liwei728, liaoyu15

When turning on turbo, if frequency configuration takes effect slowly,
the updated policy->cur may be equal to the frequency configured in
governor->limits(), performance governor will not adjust the frequency,
configured frequency will remain at turbo-freq.

Simplified call stack looks as follows:
cpufreq_register_driver(&cppc_cpufreq_driver)
	...
	cppc_cpufreq_cpu_init()
		cppc_get_perf_caps()
		policy->max = cppc_perf_to_khz(caps, caps->nominal_perf)
			cppc_set_perf(highest_perf) // set highest_perf
			policy->cur = cpufreq_driver->get() // if cur == policy->max
	cpufreq_init_policy()
		...
		cpufreq_start_governor() // governor: performance
			new_freq = cpufreq_driver->get() // if new_freq == policy->max
			if (policy->cur != new_freq)
			cpufreq_out_of_sync(policy, new_freq)
				...
				policy->cur = new_freq
			...
			policy->governor->limits()
				__cpufreq_driver_target(policy->max)
					if (policy->cur==target)
					// generate error, keep set highest_perf
						ret
					cppc_set_perf(target)

Fix this by changing highest_perf to nominal_perf in cppc_cpufreq_cpu_init().

Fixes: 5477fb3bd1e8 ("ACPI / CPPC: Add a CPUFreq driver for use with CPPC")
Signed-off-by: liwei <liwei728@huawei.com>
---
 drivers/cpufreq/cppc_cpufreq.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 64420d9cfd1e..db04a82b8a97 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -669,14 +669,14 @@ static int cppc_cpufreq_cpu_init(struct cpufreq_policy *policy)
 	if (caps->highest_perf > caps->nominal_perf)
 		boost_supported = true;
 
-	/* Set policy->cur to max now. The governors will adjust later. */
-	policy->cur = cppc_perf_to_khz(caps, caps->highest_perf);
-	cpu_data->perf_ctrls.desired_perf =  caps->highest_perf;
+	/* Set policy->cur to norm now. */
+	policy->cur = cppc_perf_to_khz(caps, caps->nominal_perf);
+	cpu_data->perf_ctrls.desired_perf =  caps->nominal_perf;
 
 	ret = cppc_set_perf(cpu, &cpu_data->perf_ctrls);
 	if (ret) {
 		pr_debug("Err setting perf value:%d on CPU:%d. ret:%d\n",
-			 caps->highest_perf, cpu, ret);
+			 caps->nominal_perf, cpu, ret);
 		goto out;
 	}
 
-- 
2.25.1


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

end of thread, other threads:[~2024-06-13  8:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-28  9:28 [PATCH] cpufreq/cppc: changing highest_perf to nominal_perf in cppc_cpufreq_cpu_init() liwei
2024-04-29 10:49 ` Viresh Kumar
2024-05-01 17:14   ` Vanshidhar Konda
2024-05-03 14:19   ` Pierre Gondois
2024-05-06  2:21     ` liwei (JK)
2024-05-07 10:25   ` Ionela Voinescu
2024-05-10  3:06     ` liwei (JK)
2024-06-05 14:26       ` Ionela Voinescu
2024-06-06  7:20         ` Viresh Kumar
2024-06-11  9:39           ` Ionela Voinescu
2024-06-11  9:45             ` Viresh Kumar
2024-06-11 10:29               ` Ionela Voinescu
2024-06-13  8:40                 ` Viresh Kumar
2024-06-06  7:16       ` Viresh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).