Re: [PATCH] cpufreq/cppc: changing highest_perf to nominal_perf in cppc_cpufreq_cpu_init()

From: Ionela Voinescu
Date: Tue Jun 11 2024 - 06:29:22 EST


On Tuesday 11 Jun 2024 at 15:15:26 (+0530), Viresh Kumar wrote:
> On 11-06-24, 10:39, Ionela Voinescu wrote:
> > Makes sense! But maybe we should no longer update policy->cur to the
> > current/hardware frequency once a request comes through from a
> > governor, and we have a first actually requested value.
>
> Hmm, not sure I understood that. When the request comes from governor,
> we only update policy->cur to the requested frequency and not the
> actual hardware frequency. And it is very much required. policy->cur

Yes, I mean we should only update policy->cur to a requested frequency
from a governor, after we start it (cpufreq_start_governor()).

But currently policy->cur gets updated to the .get() returned value in
multiple places, via cpufreq_verify_current_freq() (for example from
show_cpuinfo_cur_freq() or cpufreq_get().

.get() is meant to return the current frequency of the hardware and that
can opportunistically be different from the last request made.

(+ we probably should force the first request from a governor to go
through to the driver to make sure the policy->cur obtained before,
via .get(), did not just happen to coincide with the governor request,
therefore making the request no longer go through to the driver: see
__cpufreq_driver_target)

> needs to be up to date all the times, it is an important part of the
> entire working of the cpufreq core..
>

When you say that "policy->cur must be kept up to date at all times",
I suppose you mean that it should be kept up to date with any frequency
change requests not with any changes happening in hardware?

Thanks,
Ionela.

> --
> viresh