ANDROID: cpu/hotplug: failure to offline 2nd to last cpu

cpu_down() checks for num_active_cpus() to ensure that at least one
cpu is left active. If there are two online CPUs, but one of these
is paused this check will fail indicating that only one active
CPU is available. This will prevent the online but inactive cpu
from being offlined.

Correct cpu_down() to ensure that if there is only one active CPU
and that is the CPU being requested, the offline is blocked, allowing
the second to last CPU that is inactive but online to be offlined.

Bug: 182362445
Change-Id: I5b26cb6c5fdba4f2e69e5201e25bfe987d30c405
Signed-off-by: Stephen Dickey <dickey@codeaurora.org>
This commit is contained in:
Stephen Dickey
2021-03-10 09:54:15 -08:00
committed by Todd Kjos
parent 2c728929c1
commit 5e1e3e9387

View File

@@ -1005,7 +1005,7 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
int prev_state, ret = 0;
if (num_active_cpus() == 1)
if (num_active_cpus() == 1 && cpu_active(cpu))
return -EBUSY;
if (!cpu_present(cpu))