aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/nmi_32.c
diff options
context:
space:
mode:
authorHiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>2008-05-02 19:45:08 -0400
committerIngo Molnar <mingo@elte.hu>2008-05-12 15:28:11 -0400
commitf784946ded3e734524d1f48a6a8286b8a152c3b9 (patch)
treea6a6f324c73a6fe7809ffbc052a1abb5d827167a /arch/x86/kernel/nmi_32.c
parent492c2e476eac010962850006c49df326919b284c (diff)
x86: use per_cpu data in nmi_32
use per_cpu for per CPU data. Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/nmi_32.c')
-rw-r--r--arch/x86/kernel/nmi_32.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 11b14bbaa61e..69bdae555c18 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -293,9 +293,9 @@ void stop_apic_nmi_watchdog(void *unused)
293 * here too!] 293 * here too!]
294 */ 294 */
295 295
296static unsigned int 296static DEFINE_PER_CPU(unsigned, last_irq_sum);
297 last_irq_sums [NR_CPUS], 297static DEFINE_PER_CPU(local_t, alert_counter);
298 alert_counter [NR_CPUS]; 298static DEFINE_PER_CPU(int, nmi_touch);
299 299
300void touch_nmi_watchdog(void) 300void touch_nmi_watchdog(void)
301{ 301{
@@ -303,12 +303,13 @@ void touch_nmi_watchdog(void)
303 unsigned cpu; 303 unsigned cpu;
304 304
305 /* 305 /*
306 * Just reset the alert counters, (other CPUs might be 306 * Tell other CPUs to reset their alert counters. We cannot
307 * spinning on locks we hold): 307 * do it ourselves because the alert count increase is not
308 * atomic.
308 */ 309 */
309 for_each_present_cpu(cpu) { 310 for_each_present_cpu(cpu) {
310 if (alert_counter[cpu]) 311 if (per_cpu(nmi_touch, cpu) != 1)
311 alert_counter[cpu] = 0; 312 per_cpu(nmi_touch, cpu) = 1;
312 } 313 }
313 } 314 }
314 315
@@ -358,22 +359,26 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
358 */ 359 */
359 sum = per_cpu(irq_stat, cpu).apic_timer_irqs + 360 sum = per_cpu(irq_stat, cpu).apic_timer_irqs +
360 per_cpu(irq_stat, cpu).irq0_irqs; 361 per_cpu(irq_stat, cpu).irq0_irqs;
362 if (__get_cpu_var(nmi_touch)) {
363 __get_cpu_var(nmi_touch) = 0;
364 touched = 1;
365 }
361 366
362 /* if the none of the timers isn't firing, this cpu isn't doing much */ 367 /* if the none of the timers isn't firing, this cpu isn't doing much */
363 if (!touched && last_irq_sums[cpu] == sum) { 368 if (!touched && __get_cpu_var(last_irq_sum) == sum) {
364 /* 369 /*
365 * Ayiee, looks like this CPU is stuck ... 370 * Ayiee, looks like this CPU is stuck ...
366 * wait a few IRQs (5 seconds) before doing the oops ... 371 * wait a few IRQs (5 seconds) before doing the oops ...
367 */ 372 */
368 alert_counter[cpu]++; 373 local_inc(&__get_cpu_var(alert_counter));
369 if (alert_counter[cpu] == 5*nmi_hz) 374 if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz)
370 /* 375 /*
371 * die_nmi will return ONLY if NOTIFY_STOP happens.. 376 * die_nmi will return ONLY if NOTIFY_STOP happens..
372 */ 377 */
373 die_nmi(regs, "BUG: NMI Watchdog detected LOCKUP"); 378 die_nmi(regs, "BUG: NMI Watchdog detected LOCKUP");
374 } else { 379 } else {
375 last_irq_sums[cpu] = sum; 380 __get_cpu_var(last_irq_sum) = sum;
376 alert_counter[cpu] = 0; 381 local_set(&__get_cpu_var(alert_counter), 0);
377 } 382 }
378 /* see if the nmi watchdog went off */ 383 /* see if the nmi watchdog went off */
379 if (!__get_cpu_var(wd_enabled)) 384 if (!__get_cpu_var(wd_enabled))