Re: [PATCH V3 1/2] topology: Allow multiple entities to provide sched_freq_tick() callback

From: Viresh Kumar
Date: Tue Feb 16 2021 - 23:34:21 EST


On 17-02-21, 00:24, Ionela Voinescu wrote:
> I think it could be merged in patch 1/2 as it's part of enabling the use
> of multiple sources of information for FIE. Up to you!

Sure.

> > static void amu_fie_setup(const struct cpumask *cpus)
> > {
> > - bool invariant;
> > int cpu;
> >
> > /* We are already set since the last insmod of cpufreq driver */
> > @@ -257,25 +256,10 @@ static void amu_fie_setup(const struct cpumask *cpus)
> >
> > cpumask_or(amu_fie_cpus, amu_fie_cpus, cpus);
> >
> > - invariant = topology_scale_freq_invariant();
> > -
> > - /* We aren't fully invariant yet */
> > - if (!invariant && !cpumask_equal(amu_fie_cpus, cpu_present_mask))
> > - return;
> > -
>
> You still need these checks, otherwise you could end up with only part
> of the CPUs setting a scale factor, when only part of the CPUs support
> AMUs and there is no cpufreq support for FIE.

Both supports_scale_freq_counters() and topology_scale_freq_invariant() take
care of this now and they will keep reporting the system as invariant until the
time all the CPUs have counters (in absence of cpufreq).

The topology_set_scale_freq_source() API is supposed to be called multiple
times, probably once for each policy and so I don't see a need of these checks
anymore.

> Small(ish) optimisation at the beginning of this function:
>
> if (cpumask_empty(&scale_freq_counters_mask))
> scale_freq_invariant = topology_scale_freq_invariant();
>
> This will save you a call to rebuild_sched_domains_energy(), which is
> quite expensive, when cpufreq supports FIE and we also have counters.

Good Point.

> After comments addressed,
>
> Reviewed-by: Ionela Voinescu <ionela.voinescu@xxxxxxx>

Thanks.

> Tested-by: Ionela Voinescu <ionela.voinescu@xxxxxxx>

Just out of curiosity, what exactly did you test and what was the setup ? :)

--
viresh