diff options
author | Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> | 2008-01-30 07:30:33 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:33 -0500 |
commit | 416b72182ac3f3f4931ed17d0256b1d805d1b553 (patch) | |
tree | f06587fbc2cff8fa1fb7ad6d03cc94e8b1e24d54 /arch/x86/kernel/nmi_32.c | |
parent | 6ea8bad1c06c8ccde381f1c848afe6a245bb33b5 (diff) |
x86: clean up nmi_32/64.c
clean up and make nmi_32/64.c more similar.
- white space and coding style clean up.
- nmi_cpu_busy is available on CONFIG_SMP.
- move functions __acpi_nmi_enable, acpi_nmi_enable,
__acpi_nmi_disable and acpi_nmi_disable.
- make variables name more similar.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/nmi_32.c')
-rw-r--r-- | arch/x86/kernel/nmi_32.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c index 4f4bfd3a88b6..edd413650b3b 100644 --- a/arch/x86/kernel/nmi_32.c +++ b/arch/x86/kernel/nmi_32.c | |||
@@ -51,13 +51,13 @@ static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu); | |||
51 | 51 | ||
52 | static int endflag __initdata = 0; | 52 | static int endflag __initdata = 0; |
53 | 53 | ||
54 | #ifdef CONFIG_SMP | ||
54 | /* The performance counters used by NMI_LOCAL_APIC don't trigger when | 55 | /* The performance counters used by NMI_LOCAL_APIC don't trigger when |
55 | * the CPU is idle. To make sure the NMI watchdog really ticks on all | 56 | * the CPU is idle. To make sure the NMI watchdog really ticks on all |
56 | * CPUs during the test make them busy. | 57 | * CPUs during the test make them busy. |
57 | */ | 58 | */ |
58 | static __init void nmi_cpu_busy(void *data) | 59 | static __init void nmi_cpu_busy(void *data) |
59 | { | 60 | { |
60 | #ifdef CONFIG_SMP | ||
61 | local_irq_enable_in_hardirq(); | 61 | local_irq_enable_in_hardirq(); |
62 | /* Intentionally don't use cpu_relax here. This is | 62 | /* Intentionally don't use cpu_relax here. This is |
63 | to make sure that the performance counter really ticks, | 63 | to make sure that the performance counter really ticks, |
@@ -67,8 +67,8 @@ static __init void nmi_cpu_busy(void *data) | |||
67 | care if they get somewhat less cycles. */ | 67 | care if they get somewhat less cycles. */ |
68 | while (endflag == 0) | 68 | while (endflag == 0) |
69 | mb(); | 69 | mb(); |
70 | #endif | ||
71 | } | 70 | } |
71 | #endif | ||
72 | 72 | ||
73 | static int __init check_nmi_watchdog(void) | 73 | static int __init check_nmi_watchdog(void) |
74 | { | 74 | { |
@@ -87,11 +87,13 @@ static int __init check_nmi_watchdog(void) | |||
87 | 87 | ||
88 | printk(KERN_INFO "Testing NMI watchdog ... "); | 88 | printk(KERN_INFO "Testing NMI watchdog ... "); |
89 | 89 | ||
90 | #ifdef CONFIG_SMP | ||
90 | if (nmi_watchdog == NMI_LOCAL_APIC) | 91 | if (nmi_watchdog == NMI_LOCAL_APIC) |
91 | smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); | 92 | smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); |
93 | #endif | ||
92 | 94 | ||
93 | for_each_possible_cpu(cpu) | 95 | for_each_possible_cpu(cpu) |
94 | prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; | 96 | prev_nmi_count[cpu] = nmi_count(cpu); |
95 | local_irq_enable(); | 97 | local_irq_enable(); |
96 | mdelay((20*1000)/nmi_hz); // wait 20 ticks | 98 | mdelay((20*1000)/nmi_hz); // wait 20 ticks |
97 | 99 | ||
@@ -237,10 +239,10 @@ void acpi_nmi_disable(void) | |||
237 | on_each_cpu(__acpi_nmi_disable, NULL, 0, 1); | 239 | on_each_cpu(__acpi_nmi_disable, NULL, 0, 1); |
238 | } | 240 | } |
239 | 241 | ||
240 | void setup_apic_nmi_watchdog (void *unused) | 242 | void setup_apic_nmi_watchdog(void *unused) |
241 | { | 243 | { |
242 | if (__get_cpu_var(wd_enabled)) | 244 | if (__get_cpu_var(wd_enabled)) |
243 | return; | 245 | return; |
244 | 246 | ||
245 | /* cheap hack to support suspend/resume */ | 247 | /* cheap hack to support suspend/resume */ |
246 | /* if cpu0 is not active neither should the other cpus */ | 248 | /* if cpu0 is not active neither should the other cpus */ |
@@ -329,7 +331,7 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason) | |||
329 | unsigned int sum; | 331 | unsigned int sum; |
330 | int touched = 0; | 332 | int touched = 0; |
331 | int cpu = smp_processor_id(); | 333 | int cpu = smp_processor_id(); |
332 | int rc=0; | 334 | int rc = 0; |
333 | 335 | ||
334 | /* check for other users first */ | 336 | /* check for other users first */ |
335 | if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) | 337 | if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) |