Re: [PATCH] cpufreq,cppc: fix issue when hotplugging out policy->cpu

From: Ionela Voinescu
Date: Fri Sep 04 2020 - 05:43:08 EST


Hi Viresh,

On Friday 04 Sep 2020 at 10:36:04 (+0530), Viresh Kumar wrote:
[..]
> > /* Per CPU container for runtime CPPC management. */
> > struct cppc_cpudata {
> > - int cpu;
> > struct cppc_perf_caps perf_caps;
> > struct cppc_perf_ctrls perf_ctrls;
> > struct cppc_perf_fb_ctrs perf_fb_ctrs;
>
> With the way things are designed, I believe this is one of the bugs
> out of many.
>
> The structure cppc_cpudata must be shared across all CPUs of the same
> policy, so they all end up using the same set of values for different
> variables. i.e. it shouldn't be a per-cpu thing at all. Just allocate
> it from cpufreq_driver->init and store in policy->driver_data for use
> elsewhere.
>
> That would be a proper fix IMO, we just avoided one of the bugs here
> otherwise.
>

Do you know why it was designed this way in the first place?

I assumed it was designed like this (per-cpu cppc_cpudata structures) to
allow for the future addition of support for the HW_ALL CPPC coordination
type. In that case you can still have PSD (dependency) domains but the
desired performance controls would be per-cpu, with the coordination
done in hardware/firmware. So, in the HW_ALL case you'd end up having
different performance controls even for CPUs in the same policy.
Currently the CPPC driver only supports SW_ANY which is the traditional
cpufreq approach.

Thanks,
Ionela.


> --
> viresh