diff options
Diffstat (limited to 'arch/ia64/kernel/process.c')
-rw-r--r-- | arch/ia64/kernel/process.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index 051e050359e4..e92ea64d8040 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c | |||
@@ -4,6 +4,9 @@ | |||
4 | * Copyright (C) 1998-2003 Hewlett-Packard Co | 4 | * Copyright (C) 1998-2003 Hewlett-Packard Co |
5 | * David Mosberger-Tang <davidm@hpl.hp.com> | 5 | * David Mosberger-Tang <davidm@hpl.hp.com> |
6 | * 04/11/17 Ashok Raj <ashok.raj@intel.com> Added CPU Hotplug Support | 6 | * 04/11/17 Ashok Raj <ashok.raj@intel.com> Added CPU Hotplug Support |
7 | * | ||
8 | * 2005-10-07 Keith Owens <kaos@sgi.com> | ||
9 | * Add notify_die() hooks. | ||
7 | */ | 10 | */ |
8 | #define __KERNEL_SYSCALLS__ /* see <asm/unistd.h> */ | 11 | #define __KERNEL_SYSCALLS__ /* see <asm/unistd.h> */ |
9 | #include <linux/config.h> | 12 | #include <linux/config.h> |
@@ -34,6 +37,7 @@ | |||
34 | #include <asm/elf.h> | 37 | #include <asm/elf.h> |
35 | #include <asm/ia32.h> | 38 | #include <asm/ia32.h> |
36 | #include <asm/irq.h> | 39 | #include <asm/irq.h> |
40 | #include <asm/kdebug.h> | ||
37 | #include <asm/pgalloc.h> | 41 | #include <asm/pgalloc.h> |
38 | #include <asm/processor.h> | 42 | #include <asm/processor.h> |
39 | #include <asm/sal.h> | 43 | #include <asm/sal.h> |
@@ -197,11 +201,15 @@ void | |||
197 | default_idle (void) | 201 | default_idle (void) |
198 | { | 202 | { |
199 | local_irq_enable(); | 203 | local_irq_enable(); |
200 | while (!need_resched()) | 204 | while (!need_resched()) { |
201 | if (can_do_pal_halt) | 205 | if (can_do_pal_halt) { |
202 | safe_halt(); | 206 | local_irq_disable(); |
203 | else | 207 | if (!need_resched()) |
208 | safe_halt(); | ||
209 | local_irq_enable(); | ||
210 | } else | ||
204 | cpu_relax(); | 211 | cpu_relax(); |
212 | } | ||
205 | } | 213 | } |
206 | 214 | ||
207 | #ifdef CONFIG_HOTPLUG_CPU | 215 | #ifdef CONFIG_HOTPLUG_CPU |
@@ -263,16 +271,16 @@ void __attribute__((noreturn)) | |||
263 | cpu_idle (void) | 271 | cpu_idle (void) |
264 | { | 272 | { |
265 | void (*mark_idle)(int) = ia64_mark_idle; | 273 | void (*mark_idle)(int) = ia64_mark_idle; |
274 | int cpu = smp_processor_id(); | ||
275 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
266 | 276 | ||
267 | /* endless idle loop with no priority at all */ | 277 | /* endless idle loop with no priority at all */ |
268 | while (1) { | 278 | while (1) { |
279 | if (!need_resched()) { | ||
280 | void (*idle)(void); | ||
269 | #ifdef CONFIG_SMP | 281 | #ifdef CONFIG_SMP |
270 | if (!need_resched()) | ||
271 | min_xtp(); | 282 | min_xtp(); |
272 | #endif | 283 | #endif |
273 | while (!need_resched()) { | ||
274 | void (*idle)(void); | ||
275 | |||
276 | if (__get_cpu_var(cpu_idle_state)) | 284 | if (__get_cpu_var(cpu_idle_state)) |
277 | __get_cpu_var(cpu_idle_state) = 0; | 285 | __get_cpu_var(cpu_idle_state) = 0; |
278 | 286 | ||
@@ -284,17 +292,17 @@ cpu_idle (void) | |||
284 | if (!idle) | 292 | if (!idle) |
285 | idle = default_idle; | 293 | idle = default_idle; |
286 | (*idle)(); | 294 | (*idle)(); |
287 | } | 295 | if (mark_idle) |
288 | 296 | (*mark_idle)(0); | |
289 | if (mark_idle) | ||
290 | (*mark_idle)(0); | ||
291 | |||
292 | #ifdef CONFIG_SMP | 297 | #ifdef CONFIG_SMP |
293 | normal_xtp(); | 298 | normal_xtp(); |
294 | #endif | 299 | #endif |
300 | } | ||
301 | preempt_enable_no_resched(); | ||
295 | schedule(); | 302 | schedule(); |
303 | preempt_disable(); | ||
296 | check_pgt_cache(); | 304 | check_pgt_cache(); |
297 | if (cpu_is_offline(smp_processor_id())) | 305 | if (cpu_is_offline(cpu)) |
298 | play_dead(); | 306 | play_dead(); |
299 | } | 307 | } |
300 | } | 308 | } |
@@ -804,12 +812,14 @@ cpu_halt (void) | |||
804 | void | 812 | void |
805 | machine_restart (char *restart_cmd) | 813 | machine_restart (char *restart_cmd) |
806 | { | 814 | { |
815 | (void) notify_die(DIE_MACHINE_RESTART, restart_cmd, NULL, 0, 0, 0); | ||
807 | (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL); | 816 | (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL); |
808 | } | 817 | } |
809 | 818 | ||
810 | void | 819 | void |
811 | machine_halt (void) | 820 | machine_halt (void) |
812 | { | 821 | { |
822 | (void) notify_die(DIE_MACHINE_HALT, "", NULL, 0, 0, 0); | ||
813 | cpu_halt(); | 823 | cpu_halt(); |
814 | } | 824 | } |
815 | 825 | ||