All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aristeu Rozanski <aris@redhat.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI
Date: Mon, 27 Oct 2008 12:42:34 -0400	[thread overview]
Message-ID: <20081027164234.679734000@napanee.usersys.redhat.com> (raw)
In-Reply-To: 20081027164233.132189000@napanee.usersys.redhat.com

[-- Attachment #1: nmi-add_support_for_ioapic_nmi_watchdog_on_nmi_enabled.patch --]
[-- Type: text/plain, Size: 1576 bytes --]

This patch adds support to enable/disable IOAPIC NMI watchdog in runtime via
procfs.

Signed-off-by: Aristeu Rozanski <aris@redhat.com>

---
 arch/x86/kernel/nmi.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

--- linus-2.6.orig/arch/x86/kernel/nmi.c	2008-10-27 11:31:56.000000000 -0400
+++ linus-2.6/arch/x86/kernel/nmi.c	2008-10-27 11:43:49.000000000 -0400
@@ -340,6 +340,8 @@ void stop_apic_nmi_watchdog(void *unused
 		return;
 	if (nmi_watchdog == NMI_LOCAL_APIC)
 		lapic_watchdog_stop();
+	else
+		__acpi_nmi_disable(NULL);
 	__get_cpu_var(wd_enabled) = 0;
 	atomic_dec(&nmi_active);
 }
@@ -465,6 +467,24 @@ nmi_watchdog_tick(struct pt_regs *regs, 
 
 #ifdef CONFIG_SYSCTL
 
+static void enable_ioapic_nmi_watchdog_single(void *unused)
+{
+	__get_cpu_var(wd_enabled) = 1;
+	atomic_inc(&nmi_active);
+	__acpi_nmi_enable(NULL);
+}
+
+static void enable_ioapic_nmi_watchdog(void)
+{
+	on_each_cpu(enable_ioapic_nmi_watchdog_single, NULL, 1);
+	touch_nmi_watchdog();
+}
+
+static void disable_ioapic_nmi_watchdog(void)
+{
+	on_each_cpu(stop_apic_nmi_watchdog, NULL, 1);
+}
+
 static int __init setup_unknown_nmi_panic(char *str)
 {
 	unknown_nmi_panic = 1;
@@ -507,6 +527,11 @@ int proc_nmi_enabled(struct ctl_table *t
 			enable_lapic_nmi_watchdog();
 		else
 			disable_lapic_nmi_watchdog();
+	} else if (nmi_watchdog == NMI_IO_APIC) {
+		if (nmi_watchdog_enabled)
+			enable_ioapic_nmi_watchdog();
+		else
+			disable_ioapic_nmi_watchdog();
 	} else {
 		printk(KERN_WARNING
 			"NMI watchdog doesn't know what hardware to touch\n");

-- 
Aristeu


  reply	other threads:[~2008-10-27 16:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-27 16:42 [PATCH 0/2] IOAPIC NMI watchdog fixes Aristeu Rozanski
2008-10-27 16:42 ` Aristeu Rozanski [this message]
2008-10-29 16:05   ` [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI Randy Dunlap
2008-10-29 19:47     ` Maciej W. Rozycki
2008-10-29 20:39       ` Aristeu Rozanski
2008-10-30  0:50         ` Randy Dunlap
2008-10-27 16:42 ` [PATCH 2/2] NMI watchdog: disable NMIs on LVT0 in case NMI watchdog is not working Aristeu Rozanski
2008-10-27 16:58 ` [PATCH 0/2] IOAPIC NMI watchdog fixes Maciej W. Rozycki
2008-10-27 17:45   ` Ingo Molnar
2008-12-15 11:23   ` Aristeu Rozanski
2008-12-16 15:04     ` Maciej W. Rozycki

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=20081027164234.679734000@napanee.usersys.redhat.com \
    --to=aris@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@linux-mips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.