Re: [PATCH v2 3/3] cpufreq: intel_pstate: Set asymmetric CPU capacity on hybrid systems

From: Rafael J. Wysocki
Date: Tue Aug 27 2024 - 07:49:38 EST


On Tue, Aug 27, 2024 at 1:00 AM Ricardo Neri
<ricardo.neri-calderon@xxxxxxxxxxxxxxx> wrote:
>
> On Mon, Aug 12, 2024 at 02:44:30PM +0200, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> [...]
> > @@ -3143,6 +3341,20 @@ static int intel_pstate_register_driver(
> >
> > global.min_perf_pct = min_perf_pct_min();
> >
> > + /*
> > + * 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()) {
> > + sched_clear_itmt_support();
> > +
> > + hybrid_init_cpu_scaling();
> > +
> > + arch_rebuild_sched_domains();
>
> sched_clear_itmt_support() also calls arch_rebuild_sched_domains(). The
> latter is also called earlier via sched_set_itmt_support(), totaling 3
> calls, two of which are wasted.

Not necessarily two because arch_enable_hybrid_capacity_scale() may
return "false".

But you have a point.

> Perhaps at minimum hybrid_init_cpu_scaling() can be before
> sched_clear_itmt_support().

It can.

I'll send a new version of the patch with this change.

> The changes made by these two functions will
> be picked up in a single call of arch_rebuild_sched_domains().
>
> Moreover, ITMT can be not enabled at all if so we wish. By the time
> intel_pstate_set_itmt_prio() is called, the value of hwp_is_hybrid is
> already known.

But at that time it is not known whether or not
arch_enable_hybrid_capacity_scale() will succeed.

Thanks!