aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorAlex Nixon <alex.nixon@citrix.com>2008-08-22 06:52:13 -0400
committerIngo Molnar <mingo@elte.hu>2008-08-25 04:59:19 -0400
commita21f5d88c17a40941f6239d1959d89e8493e8e01 (patch)
tree767f763a4e05afa4b0e89192730db47e58c1180b /arch/x86/kernel
parent379002586368ae22916f668011c9118c8ce8189c (diff)
x86: unify x86_32 and x86_64 play_dead into one function
Add the new play_dead into smpboot.c, as it fits more cleanly in there alongside other CONFIG_HOTPLUG functions. Separate out the common code into its own function. Signed-off-by: Alex Nixon <alex.nixon@citrix.com> Acked-by: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/process_32.c32
-rw-r--r--arch/x86/kernel/process_64.c23
-rw-r--r--arch/x86/kernel/smpboot.c29
3 files changed, 29 insertions, 55 deletions
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index d55eb49584b1..633cf06578fa 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -72,38 +72,6 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
72 return ((unsigned long *)tsk->thread.sp)[3]; 72 return ((unsigned long *)tsk->thread.sp)[3];
73} 73}
74 74
75#ifdef CONFIG_HOTPLUG_CPU
76#include <asm/nmi.h>
77
78/* We don't actually take CPU down, just spin without interrupts. */
79void native_play_dead(void)
80{
81 int cpu = raw_smp_processor_id();
82
83 idle_task_exit();
84
85 reset_lazy_tlbstate();
86
87 irq_ctx_exit(cpu);
88
89 mb();
90 /* Ack it */
91 __get_cpu_var(cpu_state) = CPU_DEAD;
92
93 /*
94 * With physical CPU hotplug, we should halt the cpu
95 */
96 local_irq_disable();
97 /* mask all interrupts, flush any and all caches, and halt */
98 wbinvd_halt();
99}
100#else
101void native_play_dead(void)
102{
103 BUG();
104}
105#endif /* CONFIG_HOTPLUG_CPU */
106
107/* 75/*
108 * The idle thread. There's no useful work to be 76 * The idle thread. There's no useful work to be
109 * done, so just try to conserve power and have a 77 * done, so just try to conserve power and have a
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index dfd3f5752085..aa28ed01cdf3 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -85,29 +85,6 @@ void exit_idle(void)
85 __exit_idle(); 85 __exit_idle();
86} 86}
87 87
88#ifdef CONFIG_HOTPLUG_CPU
89DECLARE_PER_CPU(int, cpu_state);
90
91#include <asm/nmi.h>
92/* We halt the CPU with physical CPU hotplug */
93void native_play_dead(void)
94{
95 idle_task_exit();
96 mb();
97 /* Ack it */
98 __get_cpu_var(cpu_state) = CPU_DEAD;
99
100 local_irq_disable();
101 /* mask all interrupts, flush any and all caches, and halt */
102 wbinvd_halt();
103}
104#else
105void native_play_dead(void)
106{
107 BUG();
108}
109#endif /* CONFIG_HOTPLUG_CPU */
110
111/* 88/*
112 * The idle thread. There's no useful work to be 89 * The idle thread. There's no useful work to be
113 * done, so just try to conserve power and have a 90 * done, so just try to conserve power and have a
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index c414cee296ba..28b4287296aa 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1402,6 +1402,29 @@ void native_cpu_die(unsigned int cpu)
1402 } 1402 }
1403 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1403 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
1404} 1404}
1405
1406void play_dead_common(void)
1407{
1408 idle_task_exit();
1409 reset_lazy_tlbstate();
1410 irq_ctx_exit(raw_smp_processor_id());
1411
1412 mb();
1413 /* Ack it */
1414 __get_cpu_var(cpu_state) = CPU_DEAD;
1415
1416 /*
1417 * With physical CPU hotplug, we should halt the cpu
1418 */
1419 local_irq_disable();
1420}
1421
1422void native_play_dead(void)
1423{
1424 play_dead_common();
1425 wbinvd_halt();
1426}
1427
1405#else /* ... !CONFIG_HOTPLUG_CPU */ 1428#else /* ... !CONFIG_HOTPLUG_CPU */
1406int native_cpu_disable(void) 1429int native_cpu_disable(void)
1407{ 1430{
@@ -1413,4 +1436,10 @@ void native_cpu_die(unsigned int cpu)
1413 /* We said "no" in __cpu_disable */ 1436 /* We said "no" in __cpu_disable */
1414 BUG(); 1437 BUG();
1415} 1438}
1439
1440void native_play_dead(void)
1441{
1442 BUG();
1443}
1444
1416#endif 1445#endif