Skip to content

Commit 1fa744e

Browse files
Shaohua LiLinus Torvalds
authored andcommitted
[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: Shaohua Li <[email protected]> Cc: Andi Kleen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 766c3f9 commit 1fa744e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

arch/x86_64/kernel/process.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
157157
DECLARE_PER_CPU(int, cpu_state);
158158

159159
#include <asm/nmi.h>
160-
/* We don't actually take CPU down, just spin without interrupts. */
160+
/* We halt the CPU with physical CPU hotplug */
161161
static inline void play_dead(void)
162162
{
163163
idle_task_exit();
@@ -166,8 +166,9 @@ static inline void play_dead(void)
166166
/* Ack it */
167167
__get_cpu_var(cpu_state) = CPU_DEAD;
168168

169+
local_irq_disable();
169170
while (1)
170-
safe_halt();
171+
halt();
171172
}
172173
#else
173174
static inline void play_dead(void)

include/asm-x86_64/system.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
315315
#define local_irq_enable() __asm__ __volatile__("sti": : :"memory")
316316
/* used in the idle loop; sti takes one instruction cycle to complete */
317317
#define safe_halt() __asm__ __volatile__("sti; hlt": : :"memory")
318+
/* used when interrupts are already enabled or to shutdown the processor */
319+
#define halt() __asm__ __volatile__("hlt": : :"memory")
318320

319321
#define irqs_disabled() \
320322
({ \

0 commit comments

Comments
 (0)