Skip to contentSkip to conversation

cpufreq: intel_pstate: Rearrange checks in hybrid_get_cost()

PATCH In review Rafael J. Wysocki 2 participants 3 messages Jun 17 – Jul 1

Subsystems (2)
lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 1/1 cpufreq: intel_pstate: Rearrange checks in hybrid_get_cost()

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

Make the checks in hybrid_get_cost() more straightforward.

---
 drivers/cpufreq/intel_pstate.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/cpufreq/intel_pstate.c +3 -5
@@ -979,12 +979,10 @@ static int hybrid_get_cost(struct device
 	 * capacity.  Similarly, P-cores start to be populated when E-cores are
 	 * utilized above 60% of the capacity.
 	 */
-	if (hybrid_get_cpu_type(dev->id) == INTEL_CPU_TYPE_ATOM) {
-		if (hybrid_has_l3(dev->id)) /* E-core */
-			*cost += 1;
-	} else { /* P-core */
+	if (hybrid_get_cpu_type(dev->id) == INTEL_CPU_TYPE_CORE) /* P-core */
 		*cost += 2;
-	}
+	else if (hybrid_has_l3(dev->id)) /* E-core */
+		*cost += 1;
 
 	return 0;
 }
#1 lore raw
Quoted 4 lines · Rafael J. Wysocki

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

Make the checks in hybrid_get_cost() more straightforward.

Please do the same for hwp_get_cpu_scaling()

if (hybrid_get_cpu_type(cpu) != INTEL_CPU_TYPE_ATOM) to
if (hybrid_get_cpu_type(cpu) == INTEL_CPU_TYPE_CORE)

Thanks,
Srinivas

Quoted 28 lines

---
 drivers/cpufreq/intel_pstate.c |    8 +++-----

 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/cpufreq/intel_pstate.c +0 -0
@@ -979,12 +979,10 @@ static int hybrid_get_cost(struct device
  	 * capacity.  Similarly, P-cores start to be populated when

E-cores are
  * utilized above 60% of the capacity.
  */

drivers/cpufreq/intel_pstate.c +1 -4
-	if (hybrid_get_cpu_type(dev->id) == INTEL_CPU_TYPE_ATOM) {
-		if (hybrid_has_l3(dev->id)) /* E-core */
-			*cost += 1;
-	} else { /* P-core */
+	if (hybrid_get_cpu_type(dev->id) == INTEL_CPU_TYPE_CORE) /*

P-core */
  *cost += 2;

drivers/cpufreq/intel_pstate.c +2 -1
-	}
+	else if (hybrid_has_l3(dev->id)) /* E-core */
+		*cost += 1;


  return 0;
 }

author maintainer
#2 lore raw
Quoted 4 lines · srinivas pandruvada
Quoted 2 lines · Rafael J. Wysocki

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

Quoted 8 lines
Quoted 2 lines

Make the checks in hybrid_get_cost() more straightforward.

Please do the same for hwp_get_cpu_scaling()

if (hybrid_get_cpu_type(cpu) != INTEL_CPU_TYPE_ATOM) to
if (hybrid_get_cpu_type(cpu) == INTEL_CPU_TYPE_CORE)

I don't think this is necessary and it would break Razor Lake-E - see commit 0e7c710478b3 ("cpufreq: intel_pstate: Use correct scaling factor on Raptor Lake-E") - and Bartlett Lake.

The check in hwp_get_cpu_scaling() is only done for the processors having nonzero hybrid_scaling_factor that are explicitly listed in intel_hybrid_scaling_factor[] and on those the TYPE_ATOM cores all have the default scaling factor.

I'm going to apply the patch as is.

Thanks!

Quoted 28 lines
Quoted 28 lines
---
 drivers/cpufreq/intel_pstate.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/cpufreq/intel_pstate.c +0 -0
@@ -979,12 +979,10 @@ static int hybrid_get_cost(struct device
       * capacity.  Similarly, P-cores start to be populated when

E-cores are
* utilized above 60% of the capacity.
*/

drivers/cpufreq/intel_pstate.c +1 -4
-     if (hybrid_get_cpu_type(dev->id) == INTEL_CPU_TYPE_ATOM) {
-             if (hybrid_has_l3(dev->id)) /* E-core */
-                     *cost += 1;
-     } else { /* P-core */
+     if (hybrid_get_cpu_type(dev->id) == INTEL_CPU_TYPE_CORE) /*

P-core */

              *cost += 2;
drivers/cpufreq/intel_pstate.c +2 -1
-     }
+     else if (hybrid_has_l3(dev->id)) /* E-core */
+             *cost += 1;
 
      return 0;
 }