public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] x86, nmi watchdog: Fixes from removing old nmi watchdog
@ 2010-11-29 22:07 Don Zickus
  2010-11-29 22:07 ` [PATCH 1/2] lockup detector: Compile fixes from removing the old x86 " Don Zickus
  2010-11-29 22:07 ` [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls Don Zickus
  0 siblings, 2 replies; 10+ messages in thread
From: Don Zickus @ 2010-11-29 22:07 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: fweisbec, gorcunov, yinghai, LKML, Don Zickus

A couple of small fixes to address issues caused by removing the old nmi watchdog

Applied on top of Ingo's latest master branch.

Don Zickus (2):
  lockup detector:  Compile fixes from removing the old x86 nmi
    watchdog
  x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls

 Documentation/kernel-parameters.txt |   10 +---------
 arch/x86/kernel/apic/hw_nmi.c       |   12 ++++++++----
 arch/x86/kernel/traps.c             |   16 +++++++++++-----
 include/linux/nmi.h                 |    4 +++-
 kernel/sysctl.c                     |   16 ++++++++++++++++
 kernel/sysctl_binary.c              |    1 -
 kernel/watchdog.c                   |    2 ++
 7 files changed, 41 insertions(+), 20 deletions(-)

-- 
1.7.3.2


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

* [PATCH 1/2] lockup detector:  Compile fixes from removing the old x86 nmi watchdog
  2010-11-29 22:07 [PATCH 0/2] x86, nmi watchdog: Fixes from removing old nmi watchdog Don Zickus
@ 2010-11-29 22:07 ` Don Zickus
  2010-11-30 13:15   ` Cyrill Gorcunov
  2010-12-09 23:27   ` [tip:perf/core] " tip-bot for Don Zickus
  2010-11-29 22:07 ` [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls Don Zickus
  1 sibling, 2 replies; 10+ messages in thread
From: Don Zickus @ 2010-11-29 22:07 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: fweisbec, gorcunov, yinghai, LKML, Don Zickus

My patch that removed the old x86 nmi watchdog broke other arches.  This
change reverts a piece of that patch and puts the change in the correct spot.

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 arch/x86/kernel/apic/hw_nmi.c |    9 ++++++++-
 include/linux/nmi.h           |    4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index a0e71cb..d13081e 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -24,11 +24,18 @@ u64 hw_nmi_get_sample_period(void)
 }
 #endif
 
+#ifndef CONFIG_HARDLOCKUP_DETECTOR
+void touch_nmi_watchdog(void)
+{
+	touch_softlockup_watchdog();
+}
+EXPORT_SYMBOL(touch_nmi_watchdog);
+#endif
 
+#ifdef arch_trigger_all_cpu_backtrace
 /* For reliability, we're prepared to waste bits here. */
 static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
 
-#ifdef arch_trigger_all_cpu_backtrace
 void arch_trigger_all_cpu_backtrace(void)
 {
 	int i;
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 1c451e6..17ccf44 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -16,7 +16,8 @@
  */
 #ifdef ARCH_HAS_NMI_WATCHDOG
 #include <asm/nmi.h>
-#endif
+extern void touch_nmi_watchdog(void);
+#else
 #ifndef CONFIG_HARDLOCKUP_DETECTOR
 static inline void touch_nmi_watchdog(void)
 {
@@ -25,6 +26,7 @@ static inline void touch_nmi_watchdog(void)
 #else
 extern void touch_nmi_watchdog(void);
 #endif
+#endif
 
 /*
  * Create trigger_all_cpu_backtrace() out of the arch-provided
-- 
1.7.3.2


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

* [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls
  2010-11-29 22:07 [PATCH 0/2] x86, nmi watchdog: Fixes from removing old nmi watchdog Don Zickus
  2010-11-29 22:07 ` [PATCH 1/2] lockup detector: Compile fixes from removing the old x86 " Don Zickus
@ 2010-11-29 22:07 ` Don Zickus
  2010-11-30 13:15   ` Cyrill Gorcunov
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Don Zickus @ 2010-11-29 22:07 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: fweisbec, gorcunov, yinghai, LKML, Don Zickus

Originally adapted from Huang Ying's patch which moved the unknown_nmi_panic
to the traps.c file.  Because the old nmi watchdog was deleted before this
change happened, the unknown_nmi_panic sysctl was lost.  This re-adds it.

Also, the nmi_watchdog sysctl was re-implemented and its documentation
updated accordingly.

Patch-inspired-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 Documentation/kernel-parameters.txt |   10 +---------
 arch/x86/kernel/apic/hw_nmi.c       |    3 ---
 arch/x86/kernel/traps.c             |   16 +++++++++++-----
 kernel/sysctl.c                     |   16 ++++++++++++++++
 kernel/sysctl_binary.c              |    1 -
 kernel/watchdog.c                   |    2 ++
 6 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index cdd2a6e..5e55e46 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1579,20 +1579,12 @@ and is between 256 and 4096 characters. It is defined in the file
 
 	nmi_watchdog=	[KNL,BUGS=X86] Debugging features for SMP kernels
 			Format: [panic,][num]
-			Valid num: 0,1,2
+			Valid num: 0
 			0 - turn nmi_watchdog off
-			1 - use the IO-APIC timer for the NMI watchdog
-			2 - use the local APIC for the NMI watchdog using
-			a performance counter. Note: This will use one
-			performance counter and the local APIC's performance
-			vector.
 			When panic is specified, panic when an NMI watchdog
 			timeout occurs.
 			This is useful when you use a panic=... timeout and
 			need the box quickly up again.
-			Instead of 1 and 2 it is possible to use the following
-			symbolic names: lapic and ioapic
-			Example: nmi_watchdog=2 or nmi_watchdog=panic,lapic
 
 	netpoll.carrier_timeout=
 			[NET] Specifies amount of time (in seconds) that
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index d13081e..a86840c 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -100,6 +100,3 @@ static int __init register_trigger_all_cpu_backtrace(void)
 }
 early_initcall(register_trigger_all_cpu_backtrace);
 #endif
-
-/* STUB calls to mimic old nmi_watchdog behaviour */
-int unknown_nmi_panic;
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index f02c179..bb6f041 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -83,6 +83,8 @@ EXPORT_SYMBOL_GPL(used_vectors);
 
 static int ignore_nmis;
 
+int unknown_nmi_panic;
+
 static inline void conditional_sti(struct pt_regs *regs)
 {
 	if (regs->flags & X86_EFLAGS_IF)
@@ -300,6 +302,13 @@ gp_in_kernel:
 	die("general protection fault", regs, error_code);
 }
 
+static int __init setup_unknown_nmi_panic(char *str)
+{
+	unknown_nmi_panic = 1;
+	return 1;
+}
+__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
+
 static notrace __kprobes void
 mem_parity_error(unsigned char reason, struct pt_regs *regs)
 {
@@ -371,7 +380,7 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
 			reason, smp_processor_id());
 
 	printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n");
-	if (panic_on_unrecovered_nmi)
+	if (unknown_nmi_panic || panic_on_unrecovered_nmi)
 		panic("NMI: Not continuing");
 
 	printk(KERN_EMERG "Dazed and confused, but trying to continue\n");
@@ -397,11 +406,8 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 		if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
 							== NOTIFY_STOP)
 			return;
-
-			unknown_nmi_error(reason, regs);
-#else
-		unknown_nmi_error(reason, regs);
 #endif
+		unknown_nmi_error(reason, regs);
 
 		return;
 	}
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index d91b07d..140344d 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -733,6 +733,22 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &zero,
 		.extra2		= &one,
 	},
+	{
+		.procname       = "nmi_watchdog",
+		.data           = &watchdog_enabled,
+		.maxlen         = sizeof (int),
+		.mode           = 0644,
+		.proc_handler   = proc_dowatchdog_enabled,
+	},
+#endif
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
+	{
+		.procname       = "unknown_nmi_panic",
+		.data           = &unknown_nmi_panic,
+		.maxlen         = sizeof (int),
+		.mode           = 0644,
+		.proc_handler   = proc_dointvec,
+	},
 #endif
 #if defined(CONFIG_X86)
 	{
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index 1357c57..4b2545a 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -136,7 +136,6 @@ static const struct bin_table bin_kern_table[] = {
 	{ CTL_INT,	KERN_IA64_UNALIGNED,		"ignore-unaligned-usertrap" },
 	{ CTL_INT,	KERN_COMPAT_LOG,		"compat-log" },
 	{ CTL_INT,	KERN_MAX_LOCK_DEPTH,		"max_lock_depth" },
-	{ CTL_INT,	KERN_NMI_WATCHDOG,		"nmi_watchdog" },
 	{ CTL_INT,	KERN_PANIC_ON_NMI,		"panic_on_unrecovered_nmi" },
 	{}
 };
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index fd77b69..e0f44dc 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -57,6 +57,8 @@ static int __init hardlockup_panic_setup(char *str)
 {
 	if (!strncmp(str, "panic", 5))
 		hardlockup_panic = 1;
+	else if (!strncmp(str, "0", 1))
+		no_watchdog = 1;
 	return 1;
 }
 __setup("nmi_watchdog=", hardlockup_panic_setup);
-- 
1.7.3.2


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

* Re: [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls
  2010-11-29 22:07 ` [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls Don Zickus
@ 2010-11-30 13:15   ` Cyrill Gorcunov
  2010-11-30 16:20     ` Don Zickus
  2010-12-02  8:16   ` Yinghai Lu
  2010-12-09 23:28   ` [tip:perf/core] x86, NMI: Add " tip-bot for Don Zickus
  2 siblings, 1 reply; 10+ messages in thread
From: Cyrill Gorcunov @ 2010-11-30 13:15 UTC (permalink / raw)
  To: Don Zickus; +Cc: Ingo Molnar, fweisbec, yinghai, LKML

On Mon, Nov 29, 2010 at 05:07:17PM -0500, Don Zickus wrote:
> Originally adapted from Huang Ying's patch which moved the unknown_nmi_panic
> to the traps.c file.  Because the old nmi watchdog was deleted before this
> change happened, the unknown_nmi_panic sysctl was lost.  This re-adds it.
> 
> Also, the nmi_watchdog sysctl was re-implemented and its documentation
> updated accordingly.
> 
> Patch-inspired-by: Huang Ying <ying.huang@intel.com>
> Signed-off-by: Don Zickus <dzickus@redhat.com>

Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>

(a 'thing' below which could be addressed later)
...
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index d91b07d..140344d 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -733,6 +733,22 @@ static struct ctl_table kern_table[] = {
>  		.extra1		= &zero,
>  		.extra2		= &one,
>  	},
> +	{
> +		.procname       = "nmi_watchdog",
> +		.data           = &watchdog_enabled,
> +		.maxlen         = sizeof (int),
> +		.mode           = 0644,
> +		.proc_handler   = proc_dowatchdog_enabled,
> +	},
> +#endif
> +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)

This kinda wonders me -- do we have CONFIG_X86_LOCAL_APIC set _without_
CONFIG_X86? I mean CONFIG_X86_LOCAL_APIC is per x86, no?

  Cyrill

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

* Re: [PATCH 1/2] lockup detector:  Compile fixes from removing the old x86 nmi watchdog
  2010-11-29 22:07 ` [PATCH 1/2] lockup detector: Compile fixes from removing the old x86 " Don Zickus
@ 2010-11-30 13:15   ` Cyrill Gorcunov
  2010-12-09 23:27   ` [tip:perf/core] " tip-bot for Don Zickus
  1 sibling, 0 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2010-11-30 13:15 UTC (permalink / raw)
  To: Don Zickus; +Cc: Ingo Molnar, fweisbec, yinghai, LKML

On Mon, Nov 29, 2010 at 05:07:16PM -0500, Don Zickus wrote:
> My patch that removed the old x86 nmi watchdog broke other arches.  This
> change reverts a piece of that patch and puts the change in the correct spot.
> 
> Signed-off-by: Don Zickus <dzickus@redhat.com>
> ---
>  arch/x86/kernel/apic/hw_nmi.c |    9 ++++++++-
>  include/linux/nmi.h           |    4 +++-
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 

Looks good to me, thanks Don!
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>

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

* Re: [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls
  2010-11-30 13:15   ` Cyrill Gorcunov
@ 2010-11-30 16:20     ` Don Zickus
  2010-11-30 17:37       ` Cyrill Gorcunov
  0 siblings, 1 reply; 10+ messages in thread
From: Don Zickus @ 2010-11-30 16:20 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Ingo Molnar, fweisbec, yinghai, LKML

On Tue, Nov 30, 2010 at 04:15:17PM +0300, Cyrill Gorcunov wrote:
> On Mon, Nov 29, 2010 at 05:07:17PM -0500, Don Zickus wrote:
> > Originally adapted from Huang Ying's patch which moved the unknown_nmi_panic
> > to the traps.c file.  Because the old nmi watchdog was deleted before this
> > change happened, the unknown_nmi_panic sysctl was lost.  This re-adds it.
> > 
> > Also, the nmi_watchdog sysctl was re-implemented and its documentation
> > updated accordingly.
> > 
> > Patch-inspired-by: Huang Ying <ying.huang@intel.com>
> > Signed-off-by: Don Zickus <dzickus@redhat.com>
> 
> Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
> 
> (a 'thing' below which could be addressed later)
> ...
> > diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> > index d91b07d..140344d 100644
> > --- a/kernel/sysctl.c
> > +++ b/kernel/sysctl.c
> > @@ -733,6 +733,22 @@ static struct ctl_table kern_table[] = {
> >  		.extra1		= &zero,
> >  		.extra2		= &one,
> >  	},
> > +	{
> > +		.procname       = "nmi_watchdog",
> > +		.data           = &watchdog_enabled,
> > +		.maxlen         = sizeof (int),
> > +		.mode           = 0644,
> > +		.proc_handler   = proc_dowatchdog_enabled,
> > +	},
> > +#endif
> > +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
> 
> This kinda wonders me -- do we have CONFIG_X86_LOCAL_APIC set _without_
> CONFIG_X86? I mean CONFIG_X86_LOCAL_APIC is per x86, no?

Probably, I was just copying-n-pasting what was there previously.  I can
chop it off.

Cheers,
Don

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

* Re: [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls
  2010-11-30 16:20     ` Don Zickus
@ 2010-11-30 17:37       ` Cyrill Gorcunov
  0 siblings, 0 replies; 10+ messages in thread
From: Cyrill Gorcunov @ 2010-11-30 17:37 UTC (permalink / raw)
  To: Don Zickus; +Cc: Ingo Molnar, fweisbec, yinghai, LKML

On Tue, Nov 30, 2010 at 11:20:44AM -0500, Don Zickus wrote:
...
> > > +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
> > 
> > This kinda wonders me -- do we have CONFIG_X86_LOCAL_APIC set _without_
> > CONFIG_X86? I mean CONFIG_X86_LOCAL_APIC is per x86, no?
> 
> Probably, I was just copying-n-pasting what was there previously.  I can
> chop it off.
> 
> Cheers,
> Don
> 

ok, lets leave it as is, at least for better bisectability and tune up
after.

  Cyrill

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

* Re: [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls
  2010-11-29 22:07 ` [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls Don Zickus
  2010-11-30 13:15   ` Cyrill Gorcunov
@ 2010-12-02  8:16   ` Yinghai Lu
  2010-12-09 23:28   ` [tip:perf/core] x86, NMI: Add " tip-bot for Don Zickus
  2 siblings, 0 replies; 10+ messages in thread
From: Yinghai Lu @ 2010-12-02  8:16 UTC (permalink / raw)
  To: Don Zickus; +Cc: Ingo Molnar, fweisbec, gorcunov, LKML

On 11/29/2010 02:07 PM, Don Zickus wrote:
> Originally adapted from Huang Ying's patch which moved the unknown_nmi_panic
> to the traps.c file.  Because the old nmi watchdog was deleted before this
> change happened, the unknown_nmi_panic sysctl was lost.  This re-adds it.
> 
> Also, the nmi_watchdog sysctl was re-implemented and its documentation
> updated accordingly.
> 
> Patch-inspired-by: Huang Ying <ying.huang@intel.com>
> Signed-off-by: Don Zickus <dzickus@redhat.com>
> ---
>  Documentation/kernel-parameters.txt |   10 +---------
>  arch/x86/kernel/apic/hw_nmi.c       |    3 ---
>  arch/x86/kernel/traps.c             |   16 +++++++++++-----
>  kernel/sysctl.c                     |   16 ++++++++++++++++
>  kernel/sysctl_binary.c              |    1 -
>  kernel/watchdog.c                   |    2 ++
>  6 files changed, 30 insertions(+), 18 deletions(-)
> 
> diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
> index cdd2a6e..5e55e46 100644
> --- a/Documentation/kernel-parameters.txt
> +++ b/Documentation/kernel-parameters.txt
> @@ -1579,20 +1579,12 @@ and is between 256 and 4096 characters. It is defined in the file
>  
>  	nmi_watchdog=	[KNL,BUGS=X86] Debugging features for SMP kernels
>  			Format: [panic,][num]
> -			Valid num: 0,1,2
> +			Valid num: 0
>  			0 - turn nmi_watchdog off
> -			1 - use the IO-APIC timer for the NMI watchdog
> -			2 - use the local APIC for the NMI watchdog using
> -			a performance counter. Note: This will use one
> -			performance counter and the local APIC's performance
> -			vector.
>  			When panic is specified, panic when an NMI watchdog
>  			timeout occurs.
>  			This is useful when you use a panic=... timeout and
>  			need the box quickly up again.
> -			Instead of 1 and 2 it is possible to use the following
> -			symbolic names: lapic and ioapic
> -			Example: nmi_watchdog=2 or nmi_watchdog=panic,lapic
>  
>  	netpoll.carrier_timeout=
>  			[NET] Specifies amount of time (in seconds) that
> diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
> index d13081e..a86840c 100644
> --- a/arch/x86/kernel/apic/hw_nmi.c
> +++ b/arch/x86/kernel/apic/hw_nmi.c
> @@ -100,6 +100,3 @@ static int __init register_trigger_all_cpu_backtrace(void)
>  }
>  early_initcall(register_trigger_all_cpu_backtrace);
>  #endif
> -
> -/* STUB calls to mimic old nmi_watchdog behaviour */
> -int unknown_nmi_panic;
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index f02c179..bb6f041 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -83,6 +83,8 @@ EXPORT_SYMBOL_GPL(used_vectors);
>  
>  static int ignore_nmis;
>  
> +int unknown_nmi_panic;
> +
>  static inline void conditional_sti(struct pt_regs *regs)
>  {
>  	if (regs->flags & X86_EFLAGS_IF)
> @@ -300,6 +302,13 @@ gp_in_kernel:
>  	die("general protection fault", regs, error_code);
>  }
>  
> +static int __init setup_unknown_nmi_panic(char *str)
> +{
> +	unknown_nmi_panic = 1;
> +	return 1;
> +}
> +__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
> +
>  static notrace __kprobes void
>  mem_parity_error(unsigned char reason, struct pt_regs *regs)
>  {
> @@ -371,7 +380,7 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
>  			reason, smp_processor_id());
>  
>  	printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n");
> -	if (panic_on_unrecovered_nmi)
> +	if (unknown_nmi_panic || panic_on_unrecovered_nmi)
>  		panic("NMI: Not continuing");
>  
>  	printk(KERN_EMERG "Dazed and confused, but trying to continue\n");
> @@ -397,11 +406,8 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
>  		if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
>  							== NOTIFY_STOP)
>  			return;
> -
> -			unknown_nmi_error(reason, regs);
> -#else
> -		unknown_nmi_error(reason, regs);
>  #endif
> +		unknown_nmi_error(reason, regs);
>  
>  		return;
>  	}
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index d91b07d..140344d 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -733,6 +733,22 @@ static struct ctl_table kern_table[] = {
>  		.extra1		= &zero,
>  		.extra2		= &one,
>  	},
> +	{
> +		.procname       = "nmi_watchdog",
> +		.data           = &watchdog_enabled,
> +		.maxlen         = sizeof (int),
> +		.mode           = 0644,
> +		.proc_handler   = proc_dowatchdog_enabled,
> +	},
> +#endif
> +#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
> +	{
> +		.procname       = "unknown_nmi_panic",
> +		.data           = &unknown_nmi_panic,
> +		.maxlen         = sizeof (int),
> +		.mode           = 0644,
> +		.proc_handler   = proc_dointvec,
> +	},
>  #endif
>  #if defined(CONFIG_X86)
>  	{
> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
> index 1357c57..4b2545a 100644
> --- a/kernel/sysctl_binary.c
> +++ b/kernel/sysctl_binary.c
> @@ -136,7 +136,6 @@ static const struct bin_table bin_kern_table[] = {
>  	{ CTL_INT,	KERN_IA64_UNALIGNED,		"ignore-unaligned-usertrap" },
>  	{ CTL_INT,	KERN_COMPAT_LOG,		"compat-log" },
>  	{ CTL_INT,	KERN_MAX_LOCK_DEPTH,		"max_lock_depth" },
> -	{ CTL_INT,	KERN_NMI_WATCHDOG,		"nmi_watchdog" },
>  	{ CTL_INT,	KERN_PANIC_ON_NMI,		"panic_on_unrecovered_nmi" },
>  	{}
>  };
> diff --git a/kernel/watchdog.c b/kernel/watchdog.c
> index fd77b69..e0f44dc 100644
> --- a/kernel/watchdog.c
> +++ b/kernel/watchdog.c
> @@ -57,6 +57,8 @@ static int __init hardlockup_panic_setup(char *str)
>  {
>  	if (!strncmp(str, "panic", 5))
>  		hardlockup_panic = 1;
> +	else if (!strncmp(str, "0", 1))
> +		no_watchdog = 1;
>  	return 1;
>  }
>  __setup("nmi_watchdog=", hardlockup_panic_setup);

Thanks, unknown_nmi_panic works again.

Acked-by: Yinghai Lu <yinghai@kernel.org>

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

* [tip:perf/core] lockup detector: Compile fixes from removing the old x86 nmi watchdog
  2010-11-29 22:07 ` [PATCH 1/2] lockup detector: Compile fixes from removing the old x86 " Don Zickus
  2010-11-30 13:15   ` Cyrill Gorcunov
@ 2010-12-09 23:27   ` tip-bot for Don Zickus
  1 sibling, 0 replies; 10+ messages in thread
From: tip-bot for Don Zickus @ 2010-12-09 23:27 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tglx, gorcunov, mingo, dzickus

Commit-ID:  96a84c20d635fb1e98ab92f9fc517c4441f5c424
Gitweb:     http://git.kernel.org/tip/96a84c20d635fb1e98ab92f9fc517c4441f5c424
Author:     Don Zickus <dzickus@redhat.com>
AuthorDate: Mon, 29 Nov 2010 17:07:16 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Dec 2010 00:01:06 +0100

lockup detector: Compile fixes from removing the old x86 nmi watchdog

My patch that removed the old x86 nmi watchdog broke other
arches.  This change reverts a piece of that patch and puts the
change in the correct spot.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: fweisbec@gmail.com
Cc: yinghai@kernel.org
LKML-Reference: <1291068437-5331-2-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/apic/hw_nmi.c |    8 +++++++-
 include/linux/nmi.h           |    4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index 057f1eb..2e94eb4 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -24,8 +24,14 @@ u64 hw_nmi_get_sample_period(void)
 }
 #endif
 
+#ifndef CONFIG_HARDLOCKUP_DETECTOR
+void touch_nmi_watchdog(void)
+{
+	touch_softlockup_watchdog();
+}
+EXPORT_SYMBOL(touch_nmi_watchdog);
+#endif
 #ifdef arch_trigger_all_cpu_backtrace
-
 /* For reliability, we're prepared to waste bits here. */
 static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
 
diff --git a/include/linux/nmi.h b/include/linux/nmi.h
index 1c451e6..17ccf44 100644
--- a/include/linux/nmi.h
+++ b/include/linux/nmi.h
@@ -16,7 +16,8 @@
  */
 #ifdef ARCH_HAS_NMI_WATCHDOG
 #include <asm/nmi.h>
-#endif
+extern void touch_nmi_watchdog(void);
+#else
 #ifndef CONFIG_HARDLOCKUP_DETECTOR
 static inline void touch_nmi_watchdog(void)
 {
@@ -25,6 +26,7 @@ static inline void touch_nmi_watchdog(void)
 #else
 extern void touch_nmi_watchdog(void);
 #endif
+#endif
 
 /*
  * Create trigger_all_cpu_backtrace() out of the arch-provided

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

* [tip:perf/core] x86, NMI: Add back unknown_nmi_panic and nmi_watchdog sysctls
  2010-11-29 22:07 ` [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls Don Zickus
  2010-11-30 13:15   ` Cyrill Gorcunov
  2010-12-02  8:16   ` Yinghai Lu
@ 2010-12-09 23:28   ` tip-bot for Don Zickus
  2 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Don Zickus @ 2010-12-09 23:28 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, gorcunov, ying.huang, tglx,
	mingo, dzickus

Commit-ID:  5dc3055879b8f659f62abb7c3d1eaa4d02e36d65
Gitweb:     http://git.kernel.org/tip/5dc3055879b8f659f62abb7c3d1eaa4d02e36d65
Author:     Don Zickus <dzickus@redhat.com>
AuthorDate: Mon, 29 Nov 2010 17:07:17 -0500
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 10 Dec 2010 00:01:06 +0100

x86, NMI: Add back unknown_nmi_panic and nmi_watchdog sysctls

Originally adapted from Huang Ying's patch which moved the
unknown_nmi_panic to the traps.c file.  Because the old nmi
watchdog was deleted before this change happened, the
unknown_nmi_panic sysctl was lost.  This re-adds it.

Also, the nmi_watchdog sysctl was re-implemented and its
documentation updated accordingly.

Patch-inspired-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Don Zickus <dzickus@redhat.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Cc: fweisbec@gmail.com
LKML-Reference: <1291068437-5331-3-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 Documentation/kernel-parameters.txt |   10 +---------
 arch/x86/kernel/apic/hw_nmi.c       |    3 ---
 arch/x86/kernel/traps.c             |   16 +++++++++++-----
 kernel/sysctl.c                     |   16 ++++++++++++++++
 kernel/sysctl_binary.c              |    1 -
 kernel/watchdog.c                   |    2 ++
 6 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index cdd2a6e..5e55e46 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1579,20 +1579,12 @@ and is between 256 and 4096 characters. It is defined in the file
 
 	nmi_watchdog=	[KNL,BUGS=X86] Debugging features for SMP kernels
 			Format: [panic,][num]
-			Valid num: 0,1,2
+			Valid num: 0
 			0 - turn nmi_watchdog off
-			1 - use the IO-APIC timer for the NMI watchdog
-			2 - use the local APIC for the NMI watchdog using
-			a performance counter. Note: This will use one
-			performance counter and the local APIC's performance
-			vector.
 			When panic is specified, panic when an NMI watchdog
 			timeout occurs.
 			This is useful when you use a panic=... timeout and
 			need the box quickly up again.
-			Instead of 1 and 2 it is possible to use the following
-			symbolic names: lapic and ioapic
-			Example: nmi_watchdog=2 or nmi_watchdog=panic,lapic
 
 	netpoll.carrier_timeout=
 			[NET] Specifies amount of time (in seconds) that
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index 2e94eb4..c558e11 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -99,6 +99,3 @@ static int __init register_trigger_all_cpu_backtrace(void)
 }
 early_initcall(register_trigger_all_cpu_backtrace);
 #endif
-
-/* STUB calls to mimic old nmi_watchdog behaviour */
-int unknown_nmi_panic;
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index f02c179..bb6f041 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -83,6 +83,8 @@ EXPORT_SYMBOL_GPL(used_vectors);
 
 static int ignore_nmis;
 
+int unknown_nmi_panic;
+
 static inline void conditional_sti(struct pt_regs *regs)
 {
 	if (regs->flags & X86_EFLAGS_IF)
@@ -300,6 +302,13 @@ gp_in_kernel:
 	die("general protection fault", regs, error_code);
 }
 
+static int __init setup_unknown_nmi_panic(char *str)
+{
+	unknown_nmi_panic = 1;
+	return 1;
+}
+__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
+
 static notrace __kprobes void
 mem_parity_error(unsigned char reason, struct pt_regs *regs)
 {
@@ -371,7 +380,7 @@ unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
 			reason, smp_processor_id());
 
 	printk(KERN_EMERG "Do you have a strange power saving mode enabled?\n");
-	if (panic_on_unrecovered_nmi)
+	if (unknown_nmi_panic || panic_on_unrecovered_nmi)
 		panic("NMI: Not continuing");
 
 	printk(KERN_EMERG "Dazed and confused, but trying to continue\n");
@@ -397,11 +406,8 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 		if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
 							== NOTIFY_STOP)
 			return;
-
-			unknown_nmi_error(reason, regs);
-#else
-		unknown_nmi_error(reason, regs);
 #endif
+		unknown_nmi_error(reason, regs);
 
 		return;
 	}
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index cbd97da..4640441 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -745,6 +745,22 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &zero,
 		.extra2		= &one,
 	},
+	{
+		.procname       = "nmi_watchdog",
+		.data           = &watchdog_enabled,
+		.maxlen         = sizeof (int),
+		.mode           = 0644,
+		.proc_handler   = proc_dowatchdog_enabled,
+	},
+#endif
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
+	{
+		.procname       = "unknown_nmi_panic",
+		.data           = &unknown_nmi_panic,
+		.maxlen         = sizeof (int),
+		.mode           = 0644,
+		.proc_handler   = proc_dointvec,
+	},
 #endif
 #if defined(CONFIG_X86)
 	{
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index 1357c57..4b2545a 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -136,7 +136,6 @@ static const struct bin_table bin_kern_table[] = {
 	{ CTL_INT,	KERN_IA64_UNALIGNED,		"ignore-unaligned-usertrap" },
 	{ CTL_INT,	KERN_COMPAT_LOG,		"compat-log" },
 	{ CTL_INT,	KERN_MAX_LOCK_DEPTH,		"max_lock_depth" },
-	{ CTL_INT,	KERN_NMI_WATCHDOG,		"nmi_watchdog" },
 	{ CTL_INT,	KERN_PANIC_ON_NMI,		"panic_on_unrecovered_nmi" },
 	{}
 };
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index cad4e42..eb17e14 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -57,6 +57,8 @@ static int __init hardlockup_panic_setup(char *str)
 {
 	if (!strncmp(str, "panic", 5))
 		hardlockup_panic = 1;
+	else if (!strncmp(str, "0", 1))
+		no_watchdog = 1;
 	return 1;
 }
 __setup("nmi_watchdog=", hardlockup_panic_setup);

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

end of thread, other threads:[~2010-12-09 23:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-29 22:07 [PATCH 0/2] x86, nmi watchdog: Fixes from removing old nmi watchdog Don Zickus
2010-11-29 22:07 ` [PATCH 1/2] lockup detector: Compile fixes from removing the old x86 " Don Zickus
2010-11-30 13:15   ` Cyrill Gorcunov
2010-12-09 23:27   ` [tip:perf/core] " tip-bot for Don Zickus
2010-11-29 22:07 ` [PATCH 2/2] x86, NMI: add back unknown_nmi_panic and nmi_watchdog sysctls Don Zickus
2010-11-30 13:15   ` Cyrill Gorcunov
2010-11-30 16:20     ` Don Zickus
2010-11-30 17:37       ` Cyrill Gorcunov
2010-12-02  8:16   ` Yinghai Lu
2010-12-09 23:28   ` [tip:perf/core] x86, NMI: Add " tip-bot for Don Zickus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox