Re: [PATCH] cpufreq: intel_pstate: Enable asym capacity only when cpu smt is not possible
From: Yaxiong Tian
Date: Wed Jan 28 2026 - 20:32:13 EST
在 2026/1/29 05:21, Rafael J. Wysocki 写道:
On Wed, Jan 28, 2026 at 4:15 AM Yaxiong Tian <tianyaxiong@xxxxxxxxxx> wrote:Because I think cpu_smt_possible() becomes fixed after kernel startup. Placing this check earlier can also prevent calling arch_enable_hybrid_capacity_scale(). Additionally, when users switch the cpufreq driver via /sys/devices/system/cpu/intel_pstate/status, it's unnecessary to proceed with further checks.
According to the description in the intel_pstate.rst documentation,Why don't you replace sched_smt_active() here with cpu_smt_possible()?
Capacity-Aware Scheduling and Energy-Aware Scheduling are only
supported on a hybrid processor without SMT. Previously, the system
used sched_smt_active() for judgment, which is not a strict condition
because users can switch it on or off via /sys at any time.
This could lead to incorrect driver settings in certain scenarios.
For example, on a CPU that supports SMT, a user can disable SMT
via the nosmt parameter to enable asym capacity, and then re-enable
SMT via /sys. In such cases, some settings in the driver would no
longer be correct.
To address this issue, replace sched_smt_active() with cpu_smt_possible(),
and only enable asym capacity when cpu smt is not possible.
Fixes: 929ebc93ccaa ("cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems")
Signed-off-by: Yaxiong Tian <tianyaxiong@xxxxxxxxxx>
---
drivers/cpufreq/intel_pstate.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index ec4abe374573..8105c41861a3 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -1142,8 +1142,11 @@ static void hybrid_refresh_cpu_capacity_scaling(void)
static void hybrid_init_cpu_capacity_scaling(bool refresh)
{
- /* Bail out if enabling capacity-aware scheduling is prohibited. */
- if (no_cas)
+ /*
+ * Bail out if capacity-aware scheduling is prohibited, or if SMT is
+ * possible, as the capacity of SMT threads cannot be determined reliably.
+ */
+ if (no_cas || cpu_smt_possible())
return;
/*
@@ -1156,12 +1159,8 @@ static void hybrid_init_cpu_capacity_scaling(bool refresh)
return;
}
- /*
- * On hybrid systems, use asym capacity instead of ITMT, but because
- * the capacity of SMT threads is not deterministic even approximately,
- * do not do that when SMT is in use.
- */
- if (hwp_is_hybrid && !sched_smt_active() && arch_enable_hybrid_capacity_scale()) {
There's no point calling arch_enable_hybrid_capacity_scale() if the
latter is true.
+ /* On hybrid systems, use asym capacity instead of ITMT */
+ if (hwp_is_hybrid && arch_enable_hybrid_capacity_scale()) {
hybrid_refresh_cpu_capacity_scaling();
/*
* Disabling ITMT causes sched domains to be rebuilt to disable asym
--