diff options
author | Ivan Vecera <ivecera@redhat.com> | 2008-11-11 08:33:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-11 08:50:02 -0500 |
commit | d3ec5cae0921611ceae06464ef6291012dd9849f (patch) | |
tree | 81a84f184f9047b12895bbd91c1e8b1ff2e076f0 /arch/x86 | |
parent | 3ad4f597058301c97f362e500a32f63f5c950a45 (diff) |
x86: call machine_shutdown and stop all CPUs in native_machine_halt
Impact: really halt all CPUs on halt
Function machine_halt (resp. native_machine_halt) is empty for x86
architectures. When command 'halt -f' is invoked, the message "System
halted." is displayed but this is not really true because all CPUs are
still running.
There are also similar inconsistencies for other arches (some uses
power-off for halt or forever-loop with IRQs enabled/disabled).
IMO there should be used the same approach for all architectures OR
what does the message "System halted" really mean?
This patch fixes it for x86.
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/apic.h | 1 | ||||
-rw-r--r-- | arch/x86/include/asm/system.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/process.c | 16 | ||||
-rw-r--r-- | arch/x86/kernel/reboot.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/smp.c | 13 |
5 files changed, 24 insertions, 13 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 3b1510b4fc57..25caa0738af5 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -193,6 +193,7 @@ extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask); | |||
193 | static inline void lapic_shutdown(void) { } | 193 | static inline void lapic_shutdown(void) { } |
194 | #define local_apic_timer_c2_ok 1 | 194 | #define local_apic_timer_c2_ok 1 |
195 | static inline void init_apic_mappings(void) { } | 195 | static inline void init_apic_mappings(void) { } |
196 | static inline void disable_local_APIC(void) { } | ||
196 | 197 | ||
197 | #endif /* !CONFIG_X86_LOCAL_APIC */ | 198 | #endif /* !CONFIG_X86_LOCAL_APIC */ |
198 | 199 | ||
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h index 2ed3f0f44ff7..07c3e4048991 100644 --- a/arch/x86/include/asm/system.h +++ b/arch/x86/include/asm/system.h | |||
@@ -314,6 +314,8 @@ extern void free_init_pages(char *what, unsigned long begin, unsigned long end); | |||
314 | 314 | ||
315 | void default_idle(void); | 315 | void default_idle(void); |
316 | 316 | ||
317 | void stop_this_cpu(void *dummy); | ||
318 | |||
317 | /* | 319 | /* |
318 | * Force strict CPU ordering. | 320 | * Force strict CPU ordering. |
319 | * And yes, this is required on UP too when we're talking | 321 | * And yes, this is required on UP too when we're talking |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index c622772744d8..a4da7c4b3129 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/pm.h> | 8 | #include <linux/pm.h> |
9 | #include <linux/clockchips.h> | 9 | #include <linux/clockchips.h> |
10 | #include <asm/system.h> | 10 | #include <asm/system.h> |
11 | #include <asm/apic.h> | ||
11 | 12 | ||
12 | unsigned long idle_halt; | 13 | unsigned long idle_halt; |
13 | EXPORT_SYMBOL(idle_halt); | 14 | EXPORT_SYMBOL(idle_halt); |
@@ -122,6 +123,21 @@ void default_idle(void) | |||
122 | EXPORT_SYMBOL(default_idle); | 123 | EXPORT_SYMBOL(default_idle); |
123 | #endif | 124 | #endif |
124 | 125 | ||
126 | void stop_this_cpu(void *dummy) | ||
127 | { | ||
128 | local_irq_disable(); | ||
129 | /* | ||
130 | * Remove this CPU: | ||
131 | */ | ||
132 | cpu_clear(smp_processor_id(), cpu_online_map); | ||
133 | disable_local_APIC(); | ||
134 | |||
135 | for (;;) { | ||
136 | if (hlt_works(smp_processor_id())) | ||
137 | halt(); | ||
138 | } | ||
139 | } | ||
140 | |||
125 | static void do_nothing(void *unused) | 141 | static void do_nothing(void *unused) |
126 | { | 142 | { |
127 | } | 143 | } |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index 724adfc63cb9..34f8d37ae3c5 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -461,6 +461,11 @@ static void native_machine_restart(char *__unused) | |||
461 | 461 | ||
462 | static void native_machine_halt(void) | 462 | static void native_machine_halt(void) |
463 | { | 463 | { |
464 | /* stop other cpus and apics */ | ||
465 | machine_shutdown(); | ||
466 | |||
467 | /* stop this cpu */ | ||
468 | stop_this_cpu(NULL); | ||
464 | } | 469 | } |
465 | 470 | ||
466 | static void native_machine_power_off(void) | 471 | static void native_machine_power_off(void) |
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index 18f9b19f5f8f..3f92b134ab90 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c | |||
@@ -140,19 +140,6 @@ void native_send_call_func_ipi(cpumask_t mask) | |||
140 | send_IPI_mask(mask, CALL_FUNCTION_VECTOR); | 140 | send_IPI_mask(mask, CALL_FUNCTION_VECTOR); |
141 | } | 141 | } |
142 | 142 | ||
143 | static void stop_this_cpu(void *dummy) | ||
144 | { | ||
145 | local_irq_disable(); | ||
146 | /* | ||
147 | * Remove this CPU: | ||
148 | */ | ||
149 | cpu_clear(smp_processor_id(), cpu_online_map); | ||
150 | disable_local_APIC(); | ||
151 | if (hlt_works(smp_processor_id())) | ||
152 | for (;;) halt(); | ||
153 | for (;;); | ||
154 | } | ||
155 | |||
156 | /* | 143 | /* |
157 | * this function calls the 'stop' function on all other CPUs in the system. | 144 | * this function calls the 'stop' function on all other CPUs in the system. |
158 | */ | 145 | */ |