Skip to contentSkip to conversation

cpufreq: intel_pstate: Make it possible to avoid enabling CAS

PATCH In review Rafael J. Wysocki 3 participants 3 messages Jan 27, 2025 – Feb 10, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: intel_pstate: Make it possible to avoid enabling CAS

From: Rafael J. Wysocki <[email protected]>

Capacity-aware scheduling (CAS) is enabled by default by intel_pstate on hybrid systems without SMT, but in some usage scenarios it may be more attractive to place tasks for maximum CPU performance regardless of the extra cost in terms of energy, which is the case on such systems when CAS is not enabled, so introduce a command line option to forbid intel_pstate to enable CAS.

---
 Documentation/admin-guide/kernel-parameters.txt |    3 +++
 Documentation/admin-guide/pm/intel_pstate.rst   |    3 +++
 drivers/cpufreq/intel_pstate.c                  |    9 +++++++++
 3 files changed, 15 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +3 -0
@@ -2295,6 +2295,9 @@
 			per_cpu_perf_limits
 			  Allow per-logical-CPU P-State performance control limits using
 			  cpufreq sysfs interface
+			no_cas
+			  Do not enable capacity-aware scheduling (CAS) on
+			  hybrid systems
 
 	intremap=	[X86-64,Intel-IOMMU,EARLY]
 			on	enable Interrupt Remapping (default)
Documentation/admin-guide/pm/intel_pstate.rst +3 -0
@@ -696,6 +696,9 @@
 	Use per-logical-CPU P-State limits (see `Coordination of P-state
 	Limits`_ for details).
 
+``no_cas``
+	Do not enable capacity-aware scheduling (CAS) which is enabled by
+	default on hybrid systems.
 
 Diagnostics and Tuning
 ======================
drivers/cpufreq/intel_pstate.c +9 -0
@@ -936,6 +936,8 @@
 	NULL,
 };
 
+static bool no_cas __ro_after_init;
+
 static struct cpudata *hybrid_max_perf_cpu __read_mostly;
 /*
  * Protects hybrid_max_perf_cpu, the capacity_perf fields in struct cpudata,
@@ -1041,6 +1043,10 @@
 
 static void hybrid_init_cpu_capacity_scaling(bool refresh)
 {
+	/* 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
@@ -3835,6 +3841,9 @@
 	if (!strcmp(str, "no_hwp"))
 		no_hwp = 1;
 
+	if (!strcmp(str, "no_cas"))
+		no_cas = true;
+
 	if (!strcmp(str, "force"))
 		force_load = 1;
 	if (!strcmp(str, "hwp_only"))
#1 lore raw
Quoted 11 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Capacity-aware scheduling (CAS) is enabled by default by intel_pstate on hybrid systems without SMT, but in some usage scenarios it may be more attractive to place tasks for maximum CPU performance regardless of the extra cost in terms of energy, which is the case on such systems when CAS is not enabled, so introduce a command line option to forbid intel_pstate to enable CAS.

Srinivas,

Any concerns or comments?

Quoted 66 lines
---
 Documentation/admin-guide/kernel-parameters.txt |    3 +++
 Documentation/admin-guide/pm/intel_pstate.rst   |    3 +++
 drivers/cpufreq/intel_pstate.c                  |    9 +++++++++
 3 files changed, 15 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +3 -0
@@ -2295,6 +2295,9 @@
                        per_cpu_perf_limits
                          Allow per-logical-CPU P-State performance control limits using
                          cpufreq sysfs interface
+                       no_cas
+                         Do not enable capacity-aware scheduling (CAS) on
+                         hybrid systems
 
        intremap=       [X86-64,Intel-IOMMU,EARLY]
                        on      enable Interrupt Remapping (default)
Documentation/admin-guide/pm/intel_pstate.rst +3 -0
@@ -696,6 +696,9 @@
        Use per-logical-CPU P-State limits (see `Coordination of P-state
        Limits`_ for details).
 
+``no_cas``
+       Do not enable capacity-aware scheduling (CAS) which is enabled by
+       default on hybrid systems.
 
 Diagnostics and Tuning
 ======================
drivers/cpufreq/intel_pstate.c +9 -0
@@ -936,6 +936,8 @@
        NULL,
 };
 
+static bool no_cas __ro_after_init;
+
 static struct cpudata *hybrid_max_perf_cpu __read_mostly;
 /*
  * Protects hybrid_max_perf_cpu, the capacity_perf fields in struct cpudata,
@@ -1041,6 +1043,10 @@
 
 static void hybrid_init_cpu_capacity_scaling(bool refresh)
 {
+       /* 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
@@ -3835,6 +3841,9 @@
        if (!strcmp(str, "no_hwp"))
                no_hwp = 1;
 
+       if (!strcmp(str, "no_cas"))
+               no_cas = true;
+
        if (!strcmp(str, "force"))
                force_load = 1;
        if (!strcmp(str, "hwp_only"))
maintainer Acked-by
#2 lore raw
Quoted 16 lines · Rafael J. Wysocki
Quoted 14 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Capacity-aware scheduling (CAS) is enabled by default by intel_pstate on
hybrid systems without SMT, but in some usage scenarios it may be more
attractive to place tasks for maximum CPU performance regardless of the
extra cost in terms of energy, which is the case on such systems when
CAS is not enabled, so introduce a command line option to forbid intel_pstate to enable CAS.

Quoted 6 lines
Quoted 1 line

Srinivas,

Any concerns or comments?

No.

Quoted 76 lines
Quoted 75 lines

---
 Documentation/admin-guide/kernel-parameters.txt |    3 +++ Documentation/admin-guide/pm/intel_pstate.rst   |    3 +++ drivers/cpufreq/intel_pstate.c                  |    9 +++++++++

 3 files changed, 15 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +0 -0
@@ -2295,6 +2295,9 @@

                        per_cpu_perf_limits
                          Allow per-logical-CPU P-State performance control limits using
                          cpufreq sysfs interface
+                       no_cas
+                         Do not enable capacity-aware scheduling (CAS) on
+                         hybrid systems

        intremap=       [X86-64,Intel-IOMMU,EARLY] on      enable Interrupt Remapping (default)

Documentation/admin-guide/pm/intel_pstate.rst +0 -0
@@ -696,6 +696,9 @@

        Use per-logical-CPU P-State limits (see `Coordination of P- state
        Limits`_ for details).

+``no_cas``
+       Do not enable capacity-aware scheduling (CAS) which is enabled by
+       default on hybrid systems.

 Diagnostics and Tuning
 ======================

drivers/cpufreq/intel_pstate.c +2 -0
@@ -936,6 +936,8 @@
         NULL,
  };
 
+static bool no_cas __ro_after_init;
+
  static struct cpudata *hybrid_max_perf_cpu __read_mostly;
  /*
   * Protects hybrid_max_perf_cpu, the capacity_perf fields in

struct cpudata,

drivers/cpufreq/intel_pstate.c +1 -0
@@ -1041,6 +1043,10 @@
 
  static void hybrid_init_cpu_capacity_scaling(bool refresh)
  {
+       /* 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

drivers/cpufreq/intel_pstate.c +3 -0
@@ -3835,6 +3841,9 @@
         if (!strcmp(str, "no_hwp"))
                 no_hwp = 1;
 
+       if (!strcmp(str, "no_cas"))
+               no_cas = true;
+
         if (!strcmp(str, "force"))
                 force_load = 1;
         if (!strcmp(str, "hwp_only"))