[patch 40/46] i386 prepare nmi watchdog for dynticks

Thomas Gleixner
2007-01-23T22:04:50Z

[-- Attachment #1: dynticks-i386-prepare-nmi-watchdog.patch --]
[-- Type: text/plain, Size: 1757 bytes --]

From: Thomas Gleixner <tglx@linutronix.de>

The NMI watchdog implementation assumes that the local APIC timer
interrupt is happening. This assumption is not longer true when high
resolution timers and dynamic ticks come into play, as they may switch
off the local APIC timer completely. Take the PIT/HPET interrupts into
account too, to avoid false positives.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <ak@suse.de>
Cc: Zachary Amsden <zach@vmware.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Rohit Seth <rohitseth@google.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

arch/i386/kernel/nmi.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-2.6.20-rc4-mm1-bo/arch/i386/kernel/nmi.c
===================================================================
--- linux-2.6.20-rc4-mm1-bo.orig/arch/i386/kernel/nmi.c
+++ linux-2.6.20-rc4-mm1-bo/arch/i386/kernel/nmi.c
@@ -23,6 +23,7 @@
#include <linux/dmi.h>
#include <linux/kprobes.h>
#include <linux/cpumask.h>
+#include <linux/kernel_stat.h>

#include <asm/smp.h>
#include <asm/nmi.h>
@@ -971,9 +972,13 @@ __kprobes int nmi_watchdog_tick(struct p
cpu_clear(cpu, backtrace_mask);
}

- sum = per_cpu(irq_stat, cpu).apic_timer_irqs;
+ /*
+ * Take the local apic timer and PIT/HPET into account. We don't
+ * know which one is active, when we have highres/dyntick on
+ */
+ sum = per_cpu(irq_stat, cpu).apic_timer_irqs + kstat_irqs(0);

- /* if the apic timer 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) {
/*
* Ayiee, looks like this CPU is stuck ...

--