public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <andrewm@uow.edu.au>
To: Ion Badulescu <ionut@moisil.cs.columbia.edu>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>, Ingo Molnar <mingo@elte.hu>,
	Keith Owens <kaos@ocs.com.au>
Subject: Re: [patch] serial console vs NMI watchdog
Date: Sat, 10 Mar 2001 13:41:15 +1100	[thread overview]
Message-ID: <3AA9944B.679E5BD3@uow.edu.au> (raw)
In-Reply-To: <3AA8E6E5.A4AD5035@uow.edu.au> <200103091635.f29GZmC19160@moisil.dev.hydraweb.com>

Ion Badulescu wrote:
> 
> On Sat, 10 Mar 2001 01:21:25 +1100, Andrew Morton <andrewm@uow.edu.au> wrote:
> 
> > +/**
> > + * enable_nmi_watchdog - enables/disables NMI watchdog checking.
> > + * @yes: If zero, disable
> 
> Ugh. I have a feeling that your chances to get Linus to accept this are
> extremely slim.
> 
> Just have two functions, enable_nmi_watchdog and disable_nmi_watchdog.
> You can make them inline, or even macros...

You're right.



--- linux-2.4.2-ac16/include/linux/irq.h	Fri Mar  9 17:11:17 2001
+++ linux-ac/include/linux/irq.h	Sat Mar 10 13:34:22 2001
@@ -56,6 +56,21 @@
 
 #include <asm/hw_irq.h> /* the arch dependent stuff */
 
+/**
+ * nmi_watchdog_disable - disable NMI watchdog checking.
+ * 
+ * If the architecture supports the NMI watchdog, nmi_watchdog_disable() may be used
+ * to temporarily disable it.  Use nmi_watchdog_enable() later on.  It is implemented
+ * via an up/down counter, so you must keep the calls balanced.
+ */
+#ifdef ARCH_HAS_NMI_WATCHDOG
+extern void nmi_watchdog_disable(void);
+extern void nmi_watchdog_enable(void);
+#else
+#define nmi_watchdog_disable() do{} while(0)
+#define nmi_watchdog_enable() do{} while(0)
+#endif
+
 extern int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
 extern int setup_irq(unsigned int , struct irqaction * );
 
--- linux-2.4.2-ac16/include/asm-i386/irq.h	Fri Oct  8 03:17:09 1999
+++ linux-ac/include/asm-i386/irq.h	Sat Mar 10 02:17:47 2001
@@ -32,4 +32,8 @@
 extern void disable_irq_nosync(unsigned int);
 extern void enable_irq(unsigned int);
 
+#ifdef CONFIG_X86_LOCAL_APIC
+#define ARCH_HAS_NMI_WATCHDOG		/* See include/linux/irq.h */
+#endif
+
 #endif /* _ASM_IRQ_H */
--- linux-2.4.2-ac16/drivers/char/sysrq.c	Sun Feb 25 17:37:04 2001
+++ linux-ac/drivers/char/sysrq.c	Sat Mar 10 13:07:46 2001
@@ -23,6 +23,7 @@
 #include <linux/quotaops.h>
 #include <linux/smp_lock.h>
 #include <linux/module.h>
+#include <linux/irq.h>
 
 #include <asm/ptrace.h>
 
@@ -69,6 +70,11 @@
 	if (!key)
 		return;
 
+	/*
+	 * Interrupts are disabled, and serial consoles are slow. So
+	 * Let's suspend the NMI watchdog.
+	 */
+	nmi_watchdog_disable();
 	console_loglevel = 7;
 	printk(KERN_INFO "SysRq: ");
 	switch (key) {
@@ -152,6 +158,7 @@
 		/* Don't use 'A' as it's handled specially on the Sparc */
 	}
 
+	nmi_watchdog_enable();
 	console_loglevel = orig_log_level;
 }
 
--- linux-2.4.2-ac16/arch/i386/kernel/nmi.c	Fri Mar  9 17:10:51 2001
+++ linux-ac/arch/i386/kernel/nmi.c	Sat Mar 10 13:21:59 2001
@@ -226,6 +226,17 @@
 }
 
 static spinlock_t nmi_print_lock = SPIN_LOCK_UNLOCKED;
+static atomic_t nmi_watchdog_disabled = ATOMIC_INIT(0);
+
+void nmi_watchdog_disable(void)
+{
+	atomic_inc(&nmi_watchdog_disabled);
+}
+
+void nmi_watchdog_enable(void)
+{
+	atomic_dec(&nmi_watchdog_disabled);
+}
 
 void nmi_watchdog_tick (struct pt_regs * regs)
 {
@@ -255,7 +266,7 @@
 
 	sum = apic_timer_irqs[cpu];
 
-	if (last_irq_sums[cpu] == sum) {
+	if (last_irq_sums[cpu] == sum && atomic_read(&nmi_watchdog_disabled) == 0) {
 		/*
 		 * Ayiee, looks like this CPU is stuck ...
 		 * wait a few IRQs (5 seconds) before doing the oops ...

  reply	other threads:[~2001-03-10  2:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-09 14:21 [patch] serial console vs NMI watchdog Andrew Morton
2001-03-09 16:35 ` Ion Badulescu
2001-03-10  2:41   ` Andrew Morton [this message]
2001-03-09 22:23 ` Robert Read
2001-03-11  7:44 ` Ingo Molnar
2001-03-11  7:52   ` Keith Owens
2001-03-11  7:53     ` Ingo Molnar
2001-03-11  8:00       ` Keith Owens
2001-03-11  8:16         ` Andrew Morton
2001-03-11  9:01         ` [patch] nmi-watchdog-2.4.2-A1 Ingo Molnar
2001-03-11 10:08           ` Andrew Morton
2001-03-11 15:04             ` [patch] nmi-watchdog-2.4.2-A2 Ingo Molnar
2001-03-12  4:43     ` [patch] serial console vs NMI watchdog george anzinger
2001-03-12  5:52       ` Keith Owens
2001-03-12  8:27         ` george anzinger
2001-03-12  8:41           ` Keith Owens

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=3AA9944B.679E5BD3@uow.edu.au \
    --to=andrewm@uow.edu.au \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ionut@moisil.cs.columbia.edu \
    --cc=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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