Skip to content

Commit 56a49e1

Browse files
dhananjay-AMDsuperm1
authored andcommitted
cpufreq/amd-pstate: Fix min_limit perf and freq updation for performance governor
The min_limit perf and freq values can get disconnected with performance governor, as we only modify the perf value in the special case. Fix that by modifying the perf and freq values together Fixes: 009d1c2 ("cpufreq/amd-pstate: Move perf values into a union") Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20250407081925.850473-1-dhananjay.ugwekar@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
1 parent 0af2f6b commit 56a49e1

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -607,13 +607,16 @@ static void amd_pstate_update_min_max_limit(struct cpufreq_policy *policy)
607607
union perf_cached perf = READ_ONCE(cpudata->perf);
608608

609609
perf.max_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->max);
610-
perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min);
610+
WRITE_ONCE(cpudata->max_limit_freq, policy->max);
611611

612-
if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
612+
if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE) {
613613
perf.min_limit_perf = min(perf.nominal_perf, perf.max_limit_perf);
614+
WRITE_ONCE(cpudata->min_limit_freq, min(cpudata->nominal_freq, cpudata->max_limit_freq));
615+
} else {
616+
perf.min_limit_perf = freq_to_perf(perf, cpudata->nominal_freq, policy->min);
617+
WRITE_ONCE(cpudata->min_limit_freq, policy->min);
618+
}
614619

615-
WRITE_ONCE(cpudata->max_limit_freq, policy->max);
616-
WRITE_ONCE(cpudata->min_limit_freq, policy->min);
617620
WRITE_ONCE(cpudata->perf, perf);
618621
}
619622

0 commit comments

Comments
 (0)