x86: Take IRQ 0 correctly into account for NMI watchdog But only on the boot processor for i386 which dynticks might cause the apic timer to not run in parallel with irq 0. Do the same for x86-64, although it is not strictly needed there yet because there are no dynticks so far. Signed-off-by: Andi Kleen --- arch/i386/kernel/nmi.c | 7 ++++--- arch/x86_64/kernel/nmi.c | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) Index: linux/arch/i386/kernel/nmi.c =================================================================== --- linux.orig/arch/i386/kernel/nmi.c +++ linux/arch/i386/kernel/nmi.c @@ -350,10 +350,11 @@ __kprobes int nmi_watchdog_tick(struct p } /* - * Take the local apic timer and PIT/HPET into account. We don't - * know which one is active, when we have highres/dyntick on + * On CPU #0 the apic timer might not run, but irq 0 instead. */ - sum = per_cpu(irq_stat, cpu).apic_timer_irqs + kstat_cpu(cpu).irqs[0]; + sum = per_cpu(irq_stat, cpu).apic_timer_irqs; + if (smp_processor_id() == 0) + sum += kstat_cpu(cpu).irqs[0]; /* if the none of the timers isn't firing, this cpu isn't doing much */ if (!touched && last_irq_sums[cpu] == sum) { Index: linux/arch/x86_64/kernel/nmi.c =================================================================== --- linux.orig/arch/x86_64/kernel/nmi.c +++ linux/arch/x86_64/kernel/nmi.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -330,6 +331,9 @@ int __kprobes nmi_watchdog_tick(struct p } sum = read_pda(apic_timer_irqs); + if (smp_processor_id() == 0) + sum += kstat_cpu(cpu).irqs[0]; + if (__get_cpu_var(nmi_touch)) { __get_cpu_var(nmi_touch) = 0; touched = 1;