ANDROID: thermal: cpu_cooling: Use related_cpus for energy model cpumask check

With CONFIG_ENERGY_MODEL=y the registration of a CPU cooling device
fails if the cpumask of the energy model doesn't match policy->cpus
(CPUs of the policy that are currently online). For cheza this
succeeds at boot, however it fails on resume when the cooling device
for CPU4 is registered. At this time only the first core of the gold
cluster is online (cpumask 0x10), however the cpumask of the energy
model includes all cores of the cluster (cpumask 0xf0).

Change the check to use policy->related_cpus, which includes the CPUs
that are currently offline.

Bug: 120440300
Change-Id: I3465c4085ca2ea8a8fcafd04e2d708c74234ecee
Test: On hikey960 /sys/class/thermal/cooling_device1 exists despite
plugging all the CPUs of policy4 off then back in
Fixes: 2054105d16 ("ANDROID: thermal: cpu_cooling: Migrate to using
the EM framework")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
(Reworked the commit message for android)
Signed-off-by: Quentin Perret <quentin.perret@arm.com>
This commit is contained in:
Matthias Kaehlcke 2019-01-08 14:37:37 -08:00 committed by Quentin Perret
parent 9f5e702922
commit 253906b22f

View file

@ -578,7 +578,8 @@ __cpufreq_cooling_register(struct device_node *np,
if (try_model) {
struct em_perf_domain *em = em_cpu_get(policy->cpu);
if (!em || !cpumask_equal(policy->cpus, to_cpumask(em->cpus))) {
if (!em || !cpumask_equal(policy->related_cpus,
to_cpumask(em->cpus))) {
cdev = ERR_PTR(-EINVAL);
goto free_idle_time;
}