LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] IOAPIC NMI watchdog fixes
@ 2008-10-27 16:42 Aristeu Rozanski
  2008-10-27 16:42 ` [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI Aristeu Rozanski
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Aristeu Rozanski @ 2008-10-27 16:42 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: linux-kernel, Ingo Molnar

These two patches make use of __acpi_nmi_disable() to make possible to:
- enable and disable IOAPIC NMI watchdog using procfs
- disable NMI generation if the NMI watchdog is not working on boot time

-- 
Aristeu


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI
  2008-10-27 16:42 [PATCH 0/2] IOAPIC NMI watchdog fixes Aristeu Rozanski
@ 2008-10-27 16:42 ` Aristeu Rozanski
  2008-10-29 16:05   ` 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
  2 siblings, 1 reply; 11+ messages in thread
From: Aristeu Rozanski @ 2008-10-27 16:42 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: linux-kernel, Ingo Molnar

[-- 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/2] NMI watchdog: disable NMIs on LVT0 in case NMI watchdog is not working
  2008-10-27 16:42 [PATCH 0/2] IOAPIC NMI watchdog fixes Aristeu Rozanski
  2008-10-27 16:42 ` [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI Aristeu Rozanski
@ 2008-10-27 16:42 ` Aristeu Rozanski
  2008-10-27 16:58 ` [PATCH 0/2] IOAPIC NMI watchdog fixes Maciej W. Rozycki
  2 siblings, 0 replies; 11+ messages in thread
From: Aristeu Rozanski @ 2008-10-27 16:42 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: linux-kernel, Ingo Molnar

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

Currently, if the NMI watchdog fails using IOAPIC method, it'll only disable
interrupts on 8259 if the timer is passing thru it. This patch disables
NMI delivery on LINT0 if the NMI watchdog initial test fails, just for safety.

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

---
 arch/x86/kernel/nmi.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

--- linus-2.6.orig/arch/x86/kernel/nmi.c	2008-10-27 11:59:49.000000000 -0400
+++ linus-2.6/arch/x86/kernel/nmi.c	2008-10-27 11:59:49.000000000 -0400
@@ -131,6 +131,11 @@ static void report_broken_nmi(int cpu, i
 	atomic_dec(&nmi_active);
 }
 
+static void __acpi_nmi_disable(void *__unused)
+{
+	apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
+}
+
 int __init check_nmi_watchdog(void)
 {
 	unsigned int *prev_nmi_count;
@@ -179,8 +184,12 @@ int __init check_nmi_watchdog(void)
 	kfree(prev_nmi_count);
 	return 0;
 error:
-	if (nmi_watchdog == NMI_IO_APIC && !timer_through_8259)
-		disable_8259A_irq(0);
+	if (nmi_watchdog == NMI_IO_APIC) {
+		if (!timer_through_8259)
+			disable_8259A_irq(0);
+		on_each_cpu(__acpi_nmi_disable, NULL, 1);
+	}
+
 #ifdef CONFIG_X86_32
 	timer_ack = 0;
 #endif
@@ -285,11 +294,6 @@ void acpi_nmi_enable(void)
 		on_each_cpu(__acpi_nmi_enable, NULL, 1);
 }
 
-static void __acpi_nmi_disable(void *__unused)
-{
-	apic_write(APIC_LVT0, APIC_DM_NMI | APIC_LVT_MASKED);
-}
-
 /*
  * Disable timer based NMIs on all CPUs:
  */

-- 
Aristeu


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] IOAPIC NMI watchdog fixes
  2008-10-27 16:42 [PATCH 0/2] IOAPIC NMI watchdog fixes Aristeu Rozanski
  2008-10-27 16:42 ` [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI Aristeu Rozanski
  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 ` Maciej W. Rozycki
  2008-10-27 17:45   ` Ingo Molnar
  2008-12-15 11:23   ` Aristeu Rozanski
  2 siblings, 2 replies; 11+ messages in thread
From: Maciej W. Rozycki @ 2008-10-27 16:58 UTC (permalink / raw)
  To: Aristeu Rozanski; +Cc: linux-kernel, Ingo Molnar

On Mon, 27 Oct 2008, Aristeu Rozanski wrote:

> These two patches make use of __acpi_nmi_disable() to make possible to:
> - enable and disable IOAPIC NMI watchdog using procfs
> - disable NMI generation if the NMI watchdog is not working on boot time

 Thanks, I'll see if I can find some time soon to give them a hit -- I've 
got a serial console on my laptop now, :) so any odd boot-time tests will 
be easier for me.  These would be best tested with Ingo's APIC tree, a 
current snapshot of which I may not have handy.  Ping me if I don't 
respond within a few days.

  Maciej

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] IOAPIC NMI watchdog fixes
  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
  1 sibling, 0 replies; 11+ messages in thread
From: Ingo Molnar @ 2008-10-27 17:45 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Aristeu Rozanski, linux-kernel, Thomas Gleixner, H. Peter Anvin


* Maciej W. Rozycki <macro@linux-mips.org> wrote:

> On Mon, 27 Oct 2008, Aristeu Rozanski wrote:
> 
> > These two patches make use of __acpi_nmi_disable() to make possible to:
> > - enable and disable IOAPIC NMI watchdog using procfs
> > - disable NMI generation if the NMI watchdog is not working on boot time
> 
>  Thanks, I'll see if I can find some time soon to give them a hit -- 
> I've got a serial console on my laptop now, :) so any odd boot-time 
> tests will be easier for me.  These would be best tested with Ingo's 
> APIC tree, a current snapshot of which I may not have handy.  Ping 
> me if I don't respond within a few days.

okay - they look reasonable so i've applied Aristeu's patches to 
tip/x86/apic and integrated them into tip/master, we'll see how they 
work out.

Please Ack/Nak them once you have the time to have a close look.

	Ingo

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI
  2008-10-27 16:42 ` [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI Aristeu Rozanski
@ 2008-10-29 16:05   ` Randy Dunlap
  2008-10-29 19:47     ` Maciej W. Rozycki
  0 siblings, 1 reply; 11+ messages in thread
From: Randy Dunlap @ 2008-10-29 16:05 UTC (permalink / raw)
  To: Aristeu Rozanski; +Cc: Maciej W. Rozycki, linux-kernel, Ingo Molnar

On Mon, 27 Oct 2008 12:42:34 -0400 Aristeu Rozanski wrote:

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

Some info on how to use this, what to write(?) to what file(?) in procfs
would be Very Good to have.


> 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");
> 
> -- 

---
~Randy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI
  2008-10-29 16:05   ` Randy Dunlap
@ 2008-10-29 19:47     ` Maciej W. Rozycki
  2008-10-29 20:39       ` Aristeu Rozanski
  0 siblings, 1 reply; 11+ messages in thread
From: Maciej W. Rozycki @ 2008-10-29 19:47 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Aristeu Rozanski, linux-kernel, Ingo Molnar

On Wed, 29 Oct 2008, Randy Dunlap wrote:

> > This patch adds support to enable/disable IOAPIC NMI watchdog in runtime via
> > procfs.
> 
> Some info on how to use this, what to write(?) to what file(?) in procfs
> would be Very Good to have.

 I gather this is an extension to the existing interface already covering 
the local APIC NMI watchdog, which surely ;) must have been documented at 
the time it was added.  If it wasn't, then we cannot require it now as a 
prerequisite to accept this patch, although such documentation would be 
desirable as a separate submission.

  Maciej

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI
  2008-10-29 19:47     ` Maciej W. Rozycki
@ 2008-10-29 20:39       ` Aristeu Rozanski
  2008-10-30  0:50         ` Randy Dunlap
  0 siblings, 1 reply; 11+ messages in thread
From: Aristeu Rozanski @ 2008-10-29 20:39 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Randy Dunlap, linux-kernel, Ingo Molnar

> > > This patch adds support to enable/disable IOAPIC NMI watchdog in runtime via
> > > procfs.
> > 
> > Some info on how to use this, what to write(?) to what file(?) in procfs
> > would be Very Good to have.
> 
>  I gather this is an extension to the existing interface already covering 
> the local APIC NMI watchdog, which surely ;) must have been documented at 
> the time it was added.  If it wasn't, then we cannot require it now as a 
> prerequisite to accept this patch, although such documentation would be 
> desirable as a separate submission.
What about (if OK, I'll resubmit in a different thread with proper format):

---
 Documentation/nmi_watchdog.txt |    5 +++++
 1 file changed, 5 insertions(+)

--- linus-2.6.orig/Documentation/nmi_watchdog.txt	2008-10-24 11:41:30.000000000 -0400
+++ linus-2.6/Documentation/nmi_watchdog.txt	2008-10-29 16:38:12.000000000 -0400
@@ -69,6 +69,11 @@ to the overall system performance.
 On x86 nmi_watchdog is disabled by default so you have to enable it with
 a boot time parameter.
 
+It's possible to disable the NMI watchdog in run-time by writing "0" to
+/proc/sys/kernel/nmi_watchdog. Writing "1" to the same file will re-enable
+the NMI watchdog. Notice that you still need to use "nmi_watchdog=" parameter
+in boot time.
+
 NOTE: In kernels prior to 2.4.2-ac18 the NMI-oopser is enabled unconditionally
 on x86 SMP boxes.
 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI
  2008-10-29 20:39       ` Aristeu Rozanski
@ 2008-10-30  0:50         ` Randy Dunlap
  0 siblings, 0 replies; 11+ messages in thread
From: Randy Dunlap @ 2008-10-30  0:50 UTC (permalink / raw)
  To: Aristeu Rozanski; +Cc: Maciej W. Rozycki, linux-kernel, Ingo Molnar

On Wed, 29 Oct 2008 16:39:19 -0400 Aristeu Rozanski wrote:

> > > > This patch adds support to enable/disable IOAPIC NMI watchdog in runtime via
> > > > procfs.
> > > 
> > > Some info on how to use this, what to write(?) to what file(?) in procfs
> > > would be Very Good to have.
> > 
> >  I gather this is an extension to the existing interface already covering 
> > the local APIC NMI watchdog, which surely ;) must have been documented at 
> > the time it was added.  If it wasn't, then we cannot require it now as a 
> > prerequisite to accept this patch, although such documentation would be 
> > desirable as a separate submission.
> What about (if OK, I'll resubmit in a different thread with proper format):
> 
> ---
>  Documentation/nmi_watchdog.txt |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> --- linus-2.6.orig/Documentation/nmi_watchdog.txt	2008-10-24 11:41:30.000000000 -0400
> +++ linus-2.6/Documentation/nmi_watchdog.txt	2008-10-29 16:38:12.000000000 -0400
> @@ -69,6 +69,11 @@ to the overall system performance.
>  On x86 nmi_watchdog is disabled by default so you have to enable it with
>  a boot time parameter.
>  
> +It's possible to disable the NMI watchdog in run-time by writing "0" to
> +/proc/sys/kernel/nmi_watchdog. Writing "1" to the same file will re-enable
> +the NMI watchdog. Notice that you still need to use "nmi_watchdog=" parameter
> +in boot time.
> +
>  NOTE: In kernels prior to 2.4.2-ac18 the NMI-oopser is enabled unconditionally
>  on x86 SMP boxes.

OK.  Or update Documentation/filesystems/proc.txt::nmi_watchdog
(now that I have found it).

---
~Randy

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] IOAPIC NMI watchdog fixes
  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
  1 sibling, 1 reply; 11+ messages in thread
From: Aristeu Rozanski @ 2008-12-15 11:23 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: linux-kernel, Ingo Molnar

> > These two patches make use of __acpi_nmi_disable() to make possible to:
> > - enable and disable IOAPIC NMI watchdog using procfs
> > - disable NMI generation if the NMI watchdog is not working on boot time
> 
>  Thanks, I'll see if I can find some time soon to give them a hit -- I've 
> got a serial console on my laptop now, :) so any odd boot-time tests will 
> be easier for me.  These would be best tested with Ingo's APIC tree, a 
> current snapshot of which I may not have handy.  Ping me if I don't 
> respond within a few days.
ping :)

-- 
Aristeu


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/2] IOAPIC NMI watchdog fixes
  2008-12-15 11:23   ` Aristeu Rozanski
@ 2008-12-16 15:04     ` Maciej W. Rozycki
  0 siblings, 0 replies; 11+ messages in thread
From: Maciej W. Rozycki @ 2008-12-16 15:04 UTC (permalink / raw)
  To: Aristeu Rozanski; +Cc: linux-kernel, Ingo Molnar

On Mon, 15 Dec 2008, Aristeu Rozanski wrote:

> >  Thanks, I'll see if I can find some time soon to give them a hit -- I've 
> > got a serial console on my laptop now, :) so any odd boot-time tests will 
> > be easier for me.  These would be best tested with Ingo's APIC tree, a 
> > current snapshot of which I may not have handy.  Ping me if I don't 
> > respond within a few days.
> ping :)

 Pong.  Recent weeks have been rather hectic for me.  I'll see if I can 
find an hour or so over the Christmas period.  The thing is to test 2/2 
properly I need to tweak the sources to pretend the IRQ routing tables on 
my system are different than they really are and it takes a short while.  
We shall see.  Thanks for your patience. :)

  Maciej

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-12-16 15:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-27 16:42 [PATCH 0/2] IOAPIC NMI watchdog fixes Aristeu Rozanski
2008-10-27 16:42 ` [PATCH 1/2] NMI watchdog: add support to enable and disable IOAPIC NMI Aristeu Rozanski
2008-10-29 16:05   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).