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>
This commit is contained in:
Hiroshi Shimamoto 2008-05-02 16:45:08 -07:00 коммит произвёл Ingo Molnar
Родитель 492c2e476e
Коммит f784946ded
1 изменённых файлов: 17 добавлений и 12 удалений

Просмотреть файл

@ -293,9 +293,9 @@ void stop_apic_nmi_watchdog(void *unused)
* here too!] * here too!]
*/ */
static unsigned int static DEFINE_PER_CPU(unsigned, last_irq_sum);
last_irq_sums [NR_CPUS], static DEFINE_PER_CPU(local_t, alert_counter);
alert_counter [NR_CPUS]; static DEFINE_PER_CPU(int, nmi_touch);
void touch_nmi_watchdog(void) void touch_nmi_watchdog(void)
{ {
@ -303,12 +303,13 @@ void touch_nmi_watchdog(void)
unsigned cpu; unsigned cpu;
/* /*
* Just reset the alert counters, (other CPUs might be * Tell other CPUs to reset their alert counters. We cannot
* spinning on locks we hold): * do it ourselves because the alert count increase is not
* atomic.
*/ */
for_each_present_cpu(cpu) { for_each_present_cpu(cpu) {
if (alert_counter[cpu]) if (per_cpu(nmi_touch, cpu) != 1)
alert_counter[cpu] = 0; per_cpu(nmi_touch, cpu) = 1;
} }
} }
@ -358,22 +359,26 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
*/ */
sum = per_cpu(irq_stat, cpu).apic_timer_irqs + sum = per_cpu(irq_stat, cpu).apic_timer_irqs +
per_cpu(irq_stat, cpu).irq0_irqs; per_cpu(irq_stat, cpu).irq0_irqs;
if (__get_cpu_var(nmi_touch)) {
__get_cpu_var(nmi_touch) = 0;
touched = 1;
}
/* if the none of the timers isn't firing, this cpu isn't doing much */ /* if the none of the timers isn't firing, this cpu isn't doing much */
if (!touched && last_irq_sums[cpu] == sum) { if (!touched && __get_cpu_var(last_irq_sum) == sum) {
/* /*
* Ayiee, looks like this CPU is stuck ... * Ayiee, looks like this CPU is stuck ...
* wait a few IRQs (5 seconds) before doing the oops ... * wait a few IRQs (5 seconds) before doing the oops ...
*/ */
alert_counter[cpu]++; local_inc(&__get_cpu_var(alert_counter));
if (alert_counter[cpu] == 5*nmi_hz) if (local_read(&__get_cpu_var(alert_counter)) == 5*nmi_hz)
/* /*
* die_nmi will return ONLY if NOTIFY_STOP happens.. * die_nmi will return ONLY if NOTIFY_STOP happens..
*/ */
die_nmi(regs, "BUG: NMI Watchdog detected LOCKUP"); die_nmi(regs, "BUG: NMI Watchdog detected LOCKUP");
} else { } else {
last_irq_sums[cpu] = sum; __get_cpu_var(last_irq_sum) = sum;
alert_counter[cpu] = 0; local_set(&__get_cpu_var(alert_counter), 0);
} }
/* see if the nmi watchdog went off */ /* see if the nmi watchdog went off */
if (!__get_cpu_var(wd_enabled)) if (!__get_cpu_var(wd_enabled))