Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH v1] cpufreq: intel_pstate: Rearrange checks in hybrid_get_cost()
@ 2026-06-17 17:02 Rafael J. Wysocki
  2026-07-01 18:08 ` srinivas pandruvada
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2026-06-17 17:02 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML, Srinivas Pandruvada

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Make the checks in hybrid_get_cost() more straightforward.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/cpufreq/intel_pstate.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -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;
 }




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] cpufreq: intel_pstate: Rearrange checks in hybrid_get_cost()
  2026-06-17 17:02 [PATCH v1] cpufreq: intel_pstate: Rearrange checks in hybrid_get_cost() Rafael J. Wysocki
@ 2026-07-01 18:08 ` srinivas pandruvada
  2026-07-01 19:07   ` Rafael J. Wysocki (Intel)
  0 siblings, 1 reply; 3+ messages in thread
From: srinivas pandruvada @ 2026-07-01 18:08 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux PM; +Cc: LKML

On Wed, 2026-06-17 at 19:02 +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> 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

> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/cpufreq/intel_pstate.c |    8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -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;
>  }
> 
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] cpufreq: intel_pstate: Rearrange checks in hybrid_get_cost()
  2026-07-01 18:08 ` srinivas pandruvada
@ 2026-07-01 19:07   ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-07-01 19:07 UTC (permalink / raw)
  To: srinivas pandruvada; +Cc: Rafael J. Wysocki, Linux PM, LKML

On Wed, Jul 1, 2026 at 8:08 PM srinivas pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> On Wed, 2026-06-17 at 19:02 +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > 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!

> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >  drivers/cpufreq/intel_pstate.c |    8 +++-----
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> >
> > --- a/drivers/cpufreq/intel_pstate.c
> > +++ b/drivers/cpufreq/intel_pstate.c
> > @@ -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;
> >  }
> >
> >
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-01 19:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 17:02 [PATCH v1] cpufreq: intel_pstate: Rearrange checks in hybrid_get_cost() Rafael J. Wysocki
2026-07-01 18:08 ` srinivas pandruvada
2026-07-01 19:07   ` Rafael J. Wysocki (Intel)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox