[PATCH] cpu hotplug/x86_64: disable interrupt in play_dead
authorShaohua Li <shaohua.li@intel.com>
Fri, 6 Jan 2006 08:12:20 +0000 (00:12 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 6 Jan 2006 16:33:39 +0000 (08:33 -0800)
With physical CPU hotplug, the CPU is hot removed and it should not receive
any interrupts.  Disabling interrupt is much safer.  This basically is what we
do in ia64 & x86.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/x86_64/kernel/process.c
include/asm-x86_64/system.h

index 7519fc520eb3f2d157d1da41cb4c3c1d5b40bc82..3060ed97b755f836f076c54bee60740ebc41e1be 100644 (file)
@@ -157,7 +157,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
 DECLARE_PER_CPU(int, cpu_state);
 
 #include <asm/nmi.h>
-/* We don't actually take CPU down, just spin without interrupts. */
+/* We halt the CPU with physical CPU hotplug */
 static inline void play_dead(void)
 {
        idle_task_exit();
@@ -166,8 +166,9 @@ static inline void play_dead(void)
        /* Ack it */
        __get_cpu_var(cpu_state) = CPU_DEAD;
 
+       local_irq_disable();
        while (1)
-               safe_halt();
+               halt();
 }
 #else
 static inline void play_dead(void)
index 85348e02ad2e1f847580d21e7e8acd878f83fc4f..b34cc2ee222be04842ad512945b5e92022996ed5 100644 (file)
@@ -315,6 +315,8 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
 #define local_irq_enable()     __asm__ __volatile__("sti": : :"memory")
 /* used in the idle loop; sti takes one instruction cycle to complete */
 #define safe_halt()            __asm__ __volatile__("sti; hlt": : :"memory")
+/* used when interrupts are already enabled or to shutdown the processor */
+#define halt()                 __asm__ __volatile__("hlt": : :"memory")
 
 #define irqs_disabled()                        \
 ({                                     \