UPSTREAM: thermal: cpufreq_cooling: Update also offline CPUs per-cpu thermal_pressure

The thermal pressure signal gives information to the scheduler about
reduced CPU capacity due to thermal. It is based on a value stored in a
per-cpu 'thermal_pressure' variable. The online CPUs will get the new
value there, while the offline won't. Unfortunately, when the CPU is back
online, the value read from per-cpu variable might be wrong (stale data).
This might affect the scheduler decisions, since it sees the CPU capacity
differently than what is actually available.

Fix it by making sure that all online+offline CPUs would get the proper
value in their per-cpu variable when thermal framework sets capping.

Fixes: f12e4f66ab ("thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping")
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Link: https://lore.kernel.org/all/20210614191030.22241-1-lukasz.luba@arm.com/
Bug: 199501011
Change-Id: I10cceb48b72ccce1f51cfc0a7ecfa8d8e67d4394
(cherry picked from commit 2ad8ccc17d1e4270cf65a3f2a07a7534aa23e3fb)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
This commit is contained in:
Lukasz Luba
2021-06-10 16:03:22 +01:00
committed by Ram Chandrasekar
parent 6c3417436a
commit 640610dbc4

View File

@@ -443,7 +443,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency); ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency);
if (ret >= 0) { if (ret >= 0) {
cpufreq_cdev->cpufreq_state = state; cpufreq_cdev->cpufreq_state = state;
cpus = cpufreq_cdev->policy->cpus; cpus = cpufreq_cdev->policy->related_cpus;
max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus)); max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus));
capacity = frequency * max_capacity; capacity = frequency * max_capacity;
capacity /= cpufreq_cdev->policy->cpuinfo.max_freq; capacity /= cpufreq_cdev->policy->cpuinfo.max_freq;