From: Russell King <rmk+kernel@arm.linux.org.uk>
Date: Tue, 30 Nov 2010 12:21:30 +0000 (+0000)
Subject: ARM: CPU hotplug: ensure correct ordering of unplug
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f36d340122ae8744e64af0a92a6f77b97542c0a4;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git

ARM: CPU hotplug: ensure correct ordering of unplug

Don't call idle_task_exit() with interrupts disabled, and ensure
that we have a memory barrier after interrupts are disabled but
before signalling that this CPU has shut down.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---

diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 8c81ff9b3732..1a1c5e2b3ef9 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -269,9 +269,11 @@ void __ref cpu_die(void)
 {
 	unsigned int cpu = smp_processor_id();
 
-	local_irq_disable();
 	idle_task_exit();
 
+	local_irq_disable();
+	mb();
+
 	/* Tell __cpu_die() that this CPU is now safe to dispose of */
 	complete(&cpu_died);