]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
MIPS: SMP: Fix possibility of deadlock when bringing CPUs online
authorMatt Redfearn <matt.redfearn@imgtec.com>
Thu, 22 Sep 2016 16:15:47 +0000 (17:15 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Sat, 24 Sep 2016 23:43:52 +0000 (01:43 +0200)
commit8f46cca1e6c06a058374816887059bcc017b382f
tree0208125c0c12aac63194f8864e79cd26a39c4e2f
parent7e956304eb8a285304a78582e4537e72c6365f20
MIPS: SMP: Fix possibility of deadlock when bringing CPUs online

This patch fixes the possibility of a deadlock when bringing up
secondary CPUs.
The deadlock occurs because the set_cpu_online() is called before
synchronise_count_slave(). This can cause a deadlock if the boot CPU,
having scheduled another thread, attempts to send an IPI to the
secondary CPU, which it sees has been marked online. The secondary is
blocked in synchronise_count_slave() waiting for the boot CPU to enter
synchronise_count_master(), but the boot cpu is blocked in
smp_call_function_many() waiting for the secondary to respond to it's
IPI request.

Fix this by marking the CPU online in cpu_callin_map and synchronising
counters before declaring the CPU online and calculating the maps for
IPIs.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Reported-by: Justin Chen <justinpopo6@gmail.com>
Tested-by: Justin Chen <justinpopo6@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: stable@vger.kernel.org # v4.1+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14302/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/smp.c