Re: [PATCH 1/8] cpufreq: allow drivers to flag custom support for freq invariance

From: Ionela Voinescu
Date: Thu Jul 09 2020 - 04:53:59 EST


Hi guys,

On Monday 06 Jul 2020 at 14:14:47 (+0200), Dietmar Eggemann wrote:
> On 02/07/2020 13:44, Ionela Voinescu wrote:
> > Hi,
> >
> > On Thursday 02 Jul 2020 at 08:28:18 (+0530), Viresh Kumar wrote:
> >> On 01-07-20, 18:05, Rafael J. Wysocki wrote:
> >>> On Wed, Jul 1, 2020 at 3:33 PM Ionela Voinescu <ionela.voinescu@xxxxxxx> wrote:
> >>>> On Wednesday 01 Jul 2020 at 16:16:17 (+0530), Viresh Kumar wrote:
>
> [...]
>
> >> There can be other reasons which we aren't able to imagine at this
> >> point of time.
> >>
> >
> > But I understand both the points you and Rafael raised so it's obvious
> > that a 'opt in' flag would be the better option.
>
> Why can't we just move the arch_set_freq_scale() call from cpufreq
> driver to cpufreq core w/o introducing a FIE related driver flag?
>
> Current scenario for Frequency Invariance Engine (FIE) on arm/arm64.
>
> +------------------------------+ +------------------------------+
> | | | |
> | cpufreq core: | | arch: (arm, arm64) |
>
> | | | |
> | weak arch_set_freq_scale() {}| | |
> | | | |
> +------------------------------+ | |
> | |
> +------------------------------+ | |
> | | | |
> | cpufreq driver: | | |
> | +-----------> arch_set_freq_scale() |
> | | | { |
> +------------------------------+ | if (use counters) |
> | return; |
> +------------------------------+ | ... |
> | | | } |
> | task scheduler: | | |
> | +-----------> arch_scale_freq_tick()* |
> | | | { |
>
> | | | if (!use counters) |
> | | | return; |
> | | | ... |
> | | | } |
> +------------------------------+ +------------------------------+
>
> * defined as topology_scale_freq_tick() in arm64
>
> Only Arm/Arm64 defines arch_set_freq_scale() to get the 'legacy' CPUfreq
> based FIE. This would still be the case when we move
> arch_set_freq_scale() from individual cpufreq drivers to cpufreq core.
>
> Arm64 is the only arch which has to runtime-choose between two different
> FIEs. This is currently done by bailing out early in one of the FIE
> functions based on 'use counters'.
>
> X86 (and others) will continue to not define arch_set_freq_scale().
>
> The issue with CONFIG_BL_SWITCHER (vexpress-spc-cpufreq.c) could be
> solved arm/arm64 internally (arch_topology.c) by putting
> arch_set_freq_scale() under a !CONFIG_BL_SWITCHER guard.
> I doubt that there are any arm bL systems out there running it. At least
> I'm not aware of any complaints due to missing FIE support in bl
> switcher setups so far.

Thank you Dietmar, for your review.

I was trying to suggest the same in my other replies. Given that BL_SWITCHER
can be removed as an argument for introducing a flag, I would also find it
cleaner to just skip on introducing a flag altogether, at least until we
have a driver/scenario in the kernel that will functionally benefit from it.
This would also give us the chance to reconsider the best meaning of the
flag we later introduce.

The introduction of the 'opt in' flag would be the next best thing as
suggested in the other replies, but currently it would not result in
anything functionally different.


Rafael, Viresh, would you mind confirming whether you still consider
having an 'opt in' flag is preferable here?

Many thanks,
Ionela.