Commit b3cc5afc authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge tag 'amd-pstate-v6.14-2025-02-06' of...

Merge tag 'amd-pstate-v6.14-2025-02-06' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux

Merge amd-pstate driver fixes for 6.14-rc2 from Mario Limonciello:

"* Fix some error cleanup paths with mutex use and boost
 * Fix a ref counting issue
 * Fix a schedutil issue"

* tag 'amd-pstate-v6.14-2025-02-06' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/superm1/linux:
  cpufreq/amd-pstate: Fix cpufreq_policy ref counting
  cpufreq/amd-pstate: Fix max_perf updation with schedutil
  cpufreq/amd-pstate: Remove the goto label in amd_pstate_update_limits
  cpufreq/amd-pstate: Fix per-policy boost flag incorrect when fail
parents 0813fd2e 3ace2003
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -699,7 +699,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
	if (min_perf < lowest_nonlinear_perf)
		min_perf = lowest_nonlinear_perf;

	max_perf = cap_perf;
	max_perf = cpudata->max_limit_perf;
	if (max_perf < min_perf)
		max_perf = min_perf;

@@ -747,7 +747,6 @@ static int amd_pstate_set_boost(struct cpufreq_policy *policy, int state)
	guard(mutex)(&amd_pstate_driver_lock);

	ret = amd_pstate_cpu_boost_update(policy, state);
	policy->boost_enabled = !ret ? state : false;
	refresh_frequency_limits(policy);

	return ret;
@@ -822,25 +821,28 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)

static void amd_pstate_update_limits(unsigned int cpu)
{
	struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
	struct cpufreq_policy *policy = NULL;
	struct amd_cpudata *cpudata;
	u32 prev_high = 0, cur_high = 0;
	int ret;
	bool highest_perf_changed = false;

	if (!amd_pstate_prefcore)
		return;

	policy = cpufreq_cpu_get(cpu);
	if (!policy)
		return;

	cpudata = policy->driver_data;

	if (!amd_pstate_prefcore)
		return;

	guard(mutex)(&amd_pstate_driver_lock);

	ret = amd_get_highest_perf(cpu, &cur_high);
	if (ret)
		goto free_cpufreq_put;
	if (ret) {
		cpufreq_cpu_put(policy);
		return;
	}

	prev_high = READ_ONCE(cpudata->prefcore_ranking);
	highest_perf_changed = (prev_high != cur_high);
@@ -850,8 +852,6 @@ static void amd_pstate_update_limits(unsigned int cpu)
		if (cur_high < CPPC_MAX_PERF)
			sched_set_itmt_core_prio((int)cur_high, cpu);
	}

free_cpufreq_put:
	cpufreq_cpu_put(policy);

	if (!highest_perf_changed)