mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: linux-kernel@vger.kernel.org
Cc: Andi Kleen <ak@suse.de>
Subject: i386: Enable NMI watchdog by default does not work as intended
Date: Thu, 26 Oct 2006 15:54:33 +1000	[thread overview]
Message-ID: <29986.1161842073@kao2.melbourne.sgi.com> (raw)

This patch does not work as intended.

commit 1de84979dfc527c422abf63f27beabe43892989b
Author: Andi Kleen <ak@suse.de>
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.


                 reply	other threads:[~2006-10-26  5:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29986.1161842073@kao2.melbourne.sgi.com \
    --to=kaos@ocs.com.au \
    --cc=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®