i386: Enable NMI watchdog by default does not work as intended

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


This patch does not work as intended.

commit 1de84979dfc527c422abf63f27beabe43892989b
Author: Andi Kleen <[email protected]>
Date:   Tue Sep 26 10:52:27 2006 +0200

    [PATCH] i386: Enable NMI watchdog by default

diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 8e4ed93..6e5085d 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -21,6 +21,7 @@ #include <linux/nmi.h>
 #include <linux/sysdev.h>
 #include <linux/sysctl.h>
 #include <linux/percpu.h>
+#include <linux/dmi.h>
 #include <asm/smp.h>
 #include <asm/nmi.h>
@@ -204,6 +205,14 @@ static int __init check_nmi_watchdog(voi
 	unsigned int *prev_nmi_count;
 	int cpu;
+	/* Enable NMI watchdog for newer systems.
+           Actually it should be safe for most systems before 2004 too except
+	   for some IBM systems that corrupt registers when NMI happens
+	   during SMM. Unfortunately we don't have more exact information
+ 	   on these and use this coarse check. */
+	if (nmi_watchdog == NMI_DEFAULT && dmi_get_year(DMI_BIOS_DATE) >= 2004)
+		nmi_watchdog = NMI_LOCAL_APIC;
 	if ((nmi_watchdog == NMI_NONE) || (nmi_watchdog == NMI_DEFAULT))
 		return 0;
It attempts to change NMI_DEFAULT to NMI_LOCAL_APIC for recent BIOS
versions, even when the user does _not_ specify nmi_watchdog= on the
command line.  However a few lines further down is this test which
fails because nmi_active is 0.

	if (!atomic_read(&nmi_active))
		return 0;

The calling sequence is setup_local_APIC() -> setup_apic_nmi_watchdog()
-> atomic_inc(nmi_active), but only if nmi_watchdog contains
NMI_LOCAL_APIC or NMI_IO_APIC.  Without a command line option,
setup_apic_nmi_watchdog() does nothing, nmi_active is still 0 and
check_nmi_watchdog() exits early.  Only if you specify nmi_watchdog= on
the command line so nmi_active is non-zero before check_nmi_watchdog()
is called do you get an NMI handler.  IOW, the automatic activation of
the NMI handler is too late.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux