Skip to content

Commit 90e4ed6

Browse files
Riwen Luvireshk
authored andcommitted
cpufreq/cppc: Don't compare desired_perf in target()
There is a corner case where the desired_perf is exactly same as the old perf, but the actual current freq is not. This happens during S3 while the cpufreq governor is set to powersave. During cpufreq resume process, the booting CPU's new_freq obtained via .get() is the highest frequency, while the policy->cur and cpu->perf_ctrls.desired_perf are set to the lowest level (powersave governor). This causes the warning: "CPU frequency out of sync:", and the cpufreq core sets policy->cur to new_freq. Then the governor->limits() calls cppc_cpufreq_set_target() to configures the CPU frequency and returns directly because the desired_perf converted from target_freq is same as the cpu->perf_ctrls.desired_perf and both are the lowest_perf. Since target_freq and policy->cur have been already compared in __cpufreq_driver_target(), there's no need to compare them again here. Drop the comparison. Signed-off-by: Riwen Lu <[email protected]> [ Viresh: Updated commit message / subject ] Signed-off-by: Viresh Kumar <[email protected]>
1 parent 3a1ac6b commit 90e4ed6

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,10 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy,
291291
struct cppc_cpudata *cpu_data = policy->driver_data;
292292
unsigned int cpu = policy->cpu;
293293
struct cpufreq_freqs freqs;
294-
u32 desired_perf;
295294
int ret = 0;
296295

297-
desired_perf = cppc_khz_to_perf(&cpu_data->perf_caps, target_freq);
298-
/* Return if it is exactly the same perf */
299-
if (desired_perf == cpu_data->perf_ctrls.desired_perf)
300-
return ret;
301-
302-
cpu_data->perf_ctrls.desired_perf = desired_perf;
296+
cpu_data->perf_ctrls.desired_perf =
297+
cppc_khz_to_perf(&cpu_data->perf_caps, target_freq);
303298
freqs.old = policy->cur;
304299
freqs.new = target_freq;
305300

0 commit comments

Comments
 (0)