diff mbox series

[RFC,v0.3,3/6] cpufreq/sched: Allow .setpolicy() cpufreq drivers to enable EAS

Message ID 1940620.CQOukoFCf9@rjwysocki.net
State New
Headers show
Series cpufreq: intel_pstate: Enable EAS on hybrid platforms without SMT - alternative | expand

Commit Message

Rafael J. Wysocki March 7, 2025, 7:16 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Some cpufreq drivers, like intel_pstate, have built-in governors that
are used instead of regular cpufreq governors, schedutil in particular,
but they can work with EAS just fine, so allow EAS to be used with
those drivers.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/cpufreq.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -3053,6 +3053,20 @@ 
 	return 0;
 }
 
+static bool cpufreq_policy_is_good_for_eas(struct cpufreq_policy *policy)
+{
+	/*
+	 * For EAS compatibility, require that either schedutil is the policy
+	 * governor or the policy is governed directly by the cpufreq driver.
+	 *
+	 * In the latter case, it is assumed that EAS can only be enabled by the
+	 * cpufreq driver itself which will not enable EAS if it does not meet
+	 * the EAS' expectations regarding performance scaling response.
+	 */
+	return sugov_is_cpufreq_governor(policy) || (!policy->governor &&
+		policy->policy != CPUFREQ_POLICY_UNKNOWN);
+}
+
 bool cpufreq_ready_for_eas(const struct cpumask *cpu_mask)
 {
 	int i;
@@ -3069,7 +3083,7 @@ 
 
 			return false;
 		}
-		policy_is_ready = sugov_is_cpufreq_governor(policy);
+		policy_is_ready = cpufreq_policy_is_good_for_eas(policy);
 		cpufreq_cpu_put(policy);
 		if (!policy_is_ready) {
 			pr_debug("rd %*pbl: schedutil is mandatory for EAS\n",