[PATCH 2/3] cpufreq: intel_pstate: Remove refresh logic in hybrid_init_cpu_capacity_scaling()

Yaxiong Tian posted 3 patches 2 weeks, 4 days ago
[PATCH 2/3] cpufreq: intel_pstate: Remove refresh logic in hybrid_init_cpu_capacity_scaling()
Posted by Yaxiong Tian 2 weeks, 4 days ago
Users can disable SMT (Simultaneous Multi-Threading) via
/sys/devices/system/cpu/smt, meaning that CPU hybrid capabilities
and related features like EAS (Energy Aware Scheduling) may become
dynamically eligible. Since the driver provides sysfs interfaces
for cpufreq_driver switching, merely performing a refresh is
insufficient.

To address this issue, remove the refresh-related logic.

Fixes: 929ebc93ccaa ("cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems")
Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn>
---
 drivers/cpufreq/intel_pstate.c | 29 ++---------------------------
 1 file changed, 2 insertions(+), 27 deletions(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index ec4abe374573..76fb79b8068a 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1140,22 +1140,12 @@ static void hybrid_refresh_cpu_capacity_scaling(void)
 	hybrid_register_all_perf_domains();
 }
 
-static void hybrid_init_cpu_capacity_scaling(bool refresh)
+static void hybrid_init_cpu_capacity_scaling(void)
 {
 	/* Bail out if enabling capacity-aware scheduling is prohibited. */
 	if (no_cas)
 		return;
 
-	/*
-	 * If hybrid_max_perf_cpu is set at this point, the hybrid CPU capacity
-	 * scaling has been enabled already and the driver is just changing the
-	 * operation mode.
-	 */
-	if (refresh) {
-		hybrid_refresh_cpu_capacity_scaling();
-		return;
-	}
-
 	/*
 	 * On hybrid systems, use asym capacity instead of ITMT, but because
 	 * the capacity of SMT threads is not deterministic even approximately,
@@ -1171,18 +1161,6 @@ static void hybrid_init_cpu_capacity_scaling(bool refresh)
 	}
 }
 
-static bool hybrid_clear_max_perf_cpu(void)
-{
-	bool ret;
-
-	guard(mutex)(&hybrid_capacity_lock);
-
-	ret = !!hybrid_max_perf_cpu;
-	hybrid_max_perf_cpu = NULL;
-
-	return ret;
-}
-
 static void __intel_pstate_get_hwp_cap(struct cpudata *cpu)
 {
 	u64 cap;
@@ -3428,7 +3406,6 @@ static void intel_pstate_driver_cleanup(void)
 
 static int intel_pstate_register_driver(struct cpufreq_driver *driver)
 {
-	bool refresh_cpu_cap_scaling;
 	int ret;
 
 	if (driver == &intel_pstate)
@@ -3441,8 +3418,6 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
 
 	arch_set_max_freq_ratio(global.turbo_disabled);
 
-	refresh_cpu_cap_scaling = hybrid_clear_max_perf_cpu();
-
 	intel_pstate_driver = driver;
 	ret = cpufreq_register_driver(intel_pstate_driver);
 	if (ret) {
@@ -3452,7 +3427,7 @@ static int intel_pstate_register_driver(struct cpufreq_driver *driver)
 
 	global.min_perf_pct = min_perf_pct_min();
 
-	hybrid_init_cpu_capacity_scaling(refresh_cpu_cap_scaling);
+	hybrid_init_cpu_capacity_scaling();
 
 	return 0;
 }
-- 
2.25.1