Re: [PATCH V3 1/2] topology: Allow multiple entities to provide sched_freq_tick() callback
From: Ionela Voinescu
Date: Thu Feb 18 2021 - 13:48:35 EST
Hey,
On Thursday 18 Feb 2021 at 15:03:04 (+0530), Viresh Kumar wrote:
> On 17-02-21, 00:24, Ionela Voinescu wrote:
> > > diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c
> > > index 1e47dfd465f8..47fca7376c93 100644
> > > --- a/arch/arm64/kernel/topology.c
> > > +++ b/arch/arm64/kernel/topology.c
> > > @@ -240,7 +240,6 @@ static struct scale_freq_data amu_sfd = {
> > >
> > > 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.
>
> Another look at it and here goes another reason (hope I don't have
> another in-code comment somewhere else to kill this one) :)
>
> We don't need to care for the reason you gave (which is a valid reason
> otherwise), as we are talking specifically about amu_fie_setup() here
> and it gets called from cpufreq policy-notifier. i.e. we won't support
> AMUs without cpufreq being there in the first place and the same goes
> for cppc-driver.
>
> Does that sound reasonable ?
>
Yes, we don't care if there is no cpufreq driver, as the use of AMUs won't
get initialised either. But we do care if there is a cpufreq driver that
does not support frequency invariance, which is the example above.
The intention with the patches that made cpufreq based invariance generic
a while back was for it to be present, seamlessly, for as many drivers as
possible, as a less than accurate invariance default method is still
better than nothing. So only a few drivers today don't support cpufreq
based FI, but it's not a guarantee that it will stay this way.
Hope it makes sense,
Ionela.
> --
> viresh