Skip to content
Commit bd054b75 authored by Ionela Voinescu's avatar Ionela Voinescu Committed by Deepak Kumar Mishra
Browse files

cpufreq,cppc: fix issue when hotplugging out policy->cpu



An issue is observed in the cpufreq CPPC driver when having dependency
domains (PSD) and the policy->cpu is hotplugged out.

Considering a platform with 4 CPUs and 2 PSD domains (CPUs 0 and 1 in PSD1,
CPUs 2 and 3 in PSD2), cppc_cpufreq_cpu_init() will be called for the two
cpufreq policies that are created and it will set
all_cpu_data[policy->cpu]->cpu = policy->cpu.

Therefore all_cpu_data[0]->cpu=0, and all_cpu_data[2]->cpu=2. But for CPUs
1 and 3, all_cpu_data[{1,3}]->cpu will remain 0 from the structure
allocation.

If CPU 2 is hotplugged out, CPU 3 will become policy->cpu. But its
all_cpu_data[3]->cpu will remain 0. Later, when the .target() function is
called for policy2, the cpu argument to cppc_set_perf() will be 0 and
therefore it will use the performance controls of CPU 0, which will result
in incorrect performance level setting.

While the possibility of setting a correct CPU value in the per-cpu
cppc_cpudata structure is available, it can be noticed that this cpu value
is not used at all outside the .target() function where it's not actually
necessary. Therefore, remove the cpu variable from the cppc_cpudata
structure and use policy->cpu in the .target() function as done for the
other CPPC cpufreq functions.

Signed-off-by: Ionela Voinescu's avatarIonela Voinescu <ionela.voinescu@arm.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
parent 613e1734
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment