[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200213094704.GA30335@arm.com>
Date: Thu, 13 Feb 2020 09:47:04 +0000
From: Ionela Voinescu <ionela.voinescu@....com>
To: Lukasz Luba <lukasz.luba@....com>
Cc: catalin.marinas@....com, will@...nel.org, mark.rutland@....com,
maz@...nel.org, suzuki.poulose@....com, sudeep.holla@....com,
valentin.schneider@....com, rjw@...ysocki.net,
peterz@...radead.org, mingo@...hat.com, vincent.guittot@...aro.org,
viresh.kumar@...aro.org, linux-arm-kernel@...ts.infradead.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH v3 6/7] arm64: use activity monitors for frequency
invariance
Hi Lukasz,
[..]
> > +
> > +/* Obtain max frequency (in KHz) as reported by hardware */
> > +__weak unsigned int cpu_get_max_freq(unsigned int cpu)
> > +{
> > + return 0;
> > +}
> > +
> > +#ifdef CONFIG_CPU_FREQ
> > +/* Replace max frequency getter with cpufreq based function */
> > +#define cpu_get_max_freq cpufreq_get_hw_max_freq
> > +#endif
>
> Can we just use cpufreq_get_hw_max_freq()?
> We have cpufreq_get_hw_max_freq returning 0 in such case, so it should
> be OK.
>
The reasoning for the implementation is the following:
- For CONFIG_CPU_FREQ we use cpufreq_get_hw_max_freq (weak default or
strong alternative)
- For !CONFIG_CPU_FREQ cpufreq_get_hw_max_freq returns 0 - it signals
that cpufreq cannot return the hardware max frequency. In this case
cpu_get_max_freq is used (weak default or strong alternative
implementation).
> Is there a possibility that some platform which has !CONFIG_CPU_FREQ
> would define its own cpu_get_max_freq() overwriting the weak function
> above?
> Based on the code which checks 'if (unlikely(!max_freq_hz))' it should,
> otherwise 'valid_cpus' is not set.
>
> I would assume that we won't see such platform, interested
> in AMU freq invariance without CONFIG_CPU_FREQ.
>
> We already have a lot of these defines or __weak functions, which is
> hard to follow.
There is no dependency between CONFIG_CPU_FREQ and frequency invariance.
Therefore, I did not see a reason to potentially bypass the use of AMU
for frequency invariance for !CONFIG_CPU_FREQ.
But I agree it makes the code harder to read so I can remove
cpu_get_max_freq and keep cpufreq_get_hw_max_freq only until there is a
provable need for this.
Thank you for the review,
Ionela.
Powered by blists - more mailing lists