[PATCH 43/45] WIP: Revert "cpufreq: intel_pstate: Simplify intel_pstate_adjust_pstate()"

Chris Wilson chris at chris-wilson.co.uk
Tue Apr 28 13:23:29 UTC 2020


From: Francisco Jerez <currojerez at riseup.net>

This reverts commit a891283e56362543d1d276e192266069ef52075b.  The
previous approach of taking an explicit P-state target as argument
makes it more easily reusable by a future commit.
---
 drivers/cpufreq/intel_pstate.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index 2974146a01d1..7345fd5ef7ee 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -2302,15 +2302,13 @@ static void intel_pstate_update_pstate(struct cpudata *cpu, int pstate)
 	wrmsrl(MSR_IA32_PERF_CTL, pstate_funcs.get_val(cpu, pstate));
 }
 
-static void intel_pstate_adjust_pstate(struct cpudata *cpu)
+static void intel_pstate_adjust_pstate(struct cpudata *cpu, int target_pstate)
 {
 	int from = cpu->pstate.current_pstate;
 	struct sample *sample;
-	int target_pstate;
 
 	update_turbo_state();
 
-	target_pstate = get_target_pstate_use_cpu_load(cpu);
 	target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
 	trace_cpu_frequency(target_pstate * cpu->pstate.scaling, cpu->cpu);
 	intel_pstate_update_pstate(cpu, target_pstate);
@@ -2403,8 +2401,12 @@ static void intel_pstate_update_util(struct update_util_data *data, u64 time,
 	if ((s64)delta_ns < INTEL_PSTATE_SAMPLING_INTERVAL)
 		return;
 
-	if (intel_pstate_sample(cpu, time))
-		intel_pstate_adjust_pstate(cpu);
+	if (intel_pstate_sample(cpu, time)) {
+		int target_pstate;
+
+		target_pstate = get_target_pstate_use_cpu_load(cpu);
+		intel_pstate_adjust_pstate(cpu, target_pstate);
+	}
 }
 
 /**
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list