Commit 1fa744e6 authored by Shaohua Li's avatar Shaohua Li Committed by Linus Torvalds

[PATCH] cpu hotplug/x86_64: disable interrupt in play_dead

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: default avatarShaohua Li <shaohua.li@intel.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 766c3f94
...@@ -157,7 +157,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait); ...@@ -157,7 +157,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
DECLARE_PER_CPU(int, cpu_state); DECLARE_PER_CPU(int, cpu_state);
#include <asm/nmi.h> #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) static inline void play_dead(void)
{ {
idle_task_exit(); idle_task_exit();
...@@ -166,8 +166,9 @@ static inline void play_dead(void) ...@@ -166,8 +166,9 @@ static inline void play_dead(void)
/* Ack it */ /* Ack it */
__get_cpu_var(cpu_state) = CPU_DEAD; __get_cpu_var(cpu_state) = CPU_DEAD;
local_irq_disable();
while (1) while (1)
safe_halt(); halt();
} }
#else #else
static inline void play_dead(void) static inline void play_dead(void)
......
...@@ -315,6 +315,8 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, ...@@ -315,6 +315,8 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
#define local_irq_enable() __asm__ __volatile__("sti": : :"memory") #define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
/* used in the idle loop; sti takes one instruction cycle to complete */ /* used in the idle loop; sti takes one instruction cycle to complete */
#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory") #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() \ #define irqs_disabled() \
({ \ ({ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment