All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] watchdog: Add sysctl knob hardlockup_panic
@ 2015-10-15  2:42 Don Zickus
  2015-10-15  4:19 ` kbuild test robot
  2015-10-15 21:02 ` Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Don Zickus @ 2015-10-15  2:42 UTC (permalink / raw)
  To: LKML; +Cc: Andrew Morton, uobergfe, jkosina, atomlin, Don Zickus

The only way to enable a hardlockup to panic the machine is to set
'nmi_watchdog=panic' on the kernel command line.

This makes it awkward for end users and folks who want to run automate tests
(like myself).

Mimic the softlockup_panic knob and create a /proc/sys/kernel/hardlockup_panic
knob.

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
 Documentation/lockup-watchdogs.txt | 5 +++--
 include/linux/sched.h              | 1 +
 kernel/sysctl.c                    | 9 +++++++++
 kernel/watchdog.c                  | 2 +-
 4 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Documentation/lockup-watchdogs.txt b/Documentation/lockup-watchdogs.txt
index 22dd6af..4a6e33e 100644
--- a/Documentation/lockup-watchdogs.txt
+++ b/Documentation/lockup-watchdogs.txt
@@ -20,8 +20,9 @@ kernel mode for more than 10 seconds (see "Implementation" below for
 details), without letting other interrupts have a chance to run.
 Similarly to the softlockup case, the current stack trace is displayed
 upon detection and the system will stay locked up unless the default
-behavior is changed, which can be done through a compile time knob,
-"BOOTPARAM_HARDLOCKUP_PANIC", and a kernel parameter, "nmi_watchdog"
+behavior is changed, which can be done through a sysctl,
+'hardlockup_panic', a compile time knob, "BOOTPARAM_HARDLOCKUP_PANIC",
+and a kernel parameter, "nmi_watchdog"
 (see "Documentation/kernel-parameters.txt" for details).
 
 The panic option can be used in combination with panic_timeout (this
diff --git a/include/linux/sched.h b/include/linux/sched.h
index b7b9501..5e65b14 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -384,6 +384,7 @@ extern int proc_dowatchdog_thresh(struct ctl_table *table, int write,
 				  void __user *buffer,
 				  size_t *lenp, loff_t *ppos);
 extern unsigned int  softlockup_panic;
+extern unsigned int  hardlockup_panic;
 void lockup_detector_init(void);
 #else
 static inline void touch_softlockup_watchdog(void)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index efb0370..3e6a742 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -887,6 +887,15 @@ static struct ctl_table kern_table[] = {
 		.extra1		= &zero,
 		.extra2		= &one,
 	},
+	{
+		.procname	= "hardlockup_panic",
+		.data		= &hardlockup_panic,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.extra1		= &zero,
+		.extra2		= &one,
+	},
 #ifdef CONFIG_SMP
 	{
 		.procname	= "softlockup_all_cpu_backtrace",
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index f6b32b8..0a23125 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -112,7 +112,7 @@ static unsigned long soft_lockup_nmi_warn;
  * Should we panic when a soft-lockup or hard-lockup occurs:
  */
 #ifdef CONFIG_HARDLOCKUP_DETECTOR
-static int hardlockup_panic =
+unsigned int __read_mostly hardlockup_panic =
 			CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE;
 static unsigned long hardlockup_allcpu_dumped;
 /*
-- 
1.8.4


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

* Re: [PATCH] watchdog: Add sysctl knob hardlockup_panic
  2015-10-15  2:42 [PATCH] watchdog: Add sysctl knob hardlockup_panic Don Zickus
@ 2015-10-15  4:19 ` kbuild test robot
  2015-10-15 21:02 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2015-10-15  4:19 UTC (permalink / raw)
  To: Don Zickus
  Cc: kbuild-all, LKML, Andrew Morton, uobergfe, jkosina, atomlin, Don Zickus

[-- Attachment #1: Type: text/plain, Size: 838 bytes --]

Hi Don,

[auto build test ERROR on next-20151013 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Don-Zickus/watchdog-Add-sysctl-knob-hardlockup_panic/20151015-104506
config: sparc64-defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=sparc64 

All errors (new ones prefixed by >>):

>> kernel/built-in.o:(.data+0x24b8): undefined reference to `hardlockup_panic'

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 16672 bytes --]

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

* Re: [PATCH] watchdog: Add sysctl knob hardlockup_panic
  2015-10-15  2:42 [PATCH] watchdog: Add sysctl knob hardlockup_panic Don Zickus
  2015-10-15  4:19 ` kbuild test robot
@ 2015-10-15 21:02 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2015-10-15 21:02 UTC (permalink / raw)
  To: Don Zickus; +Cc: LKML, Andrew Morton, uobergfe, atomlin

On Wed, 14 Oct 2015, Don Zickus wrote:

> The only way to enable a hardlockup to panic the machine is to set
> 'nmi_watchdog=panic' on the kernel command line.
> 
> This makes it awkward for end users and folks who want to run automate tests
> (like myself).
> 
> Mimic the softlockup_panic knob and create a /proc/sys/kernel/hardlockup_panic
> knob.
> 
> Signed-off-by: Don Zickus <dzickus@redhat.com>

Seems like with my previous stack-dumping patch + this one, we are finally 
covering all the possible combinations. Hence in principle

	Acked-by: Jiri Kosina <jkosina@suse.cz>

The build failure reported by Fengguang's bot of course needs to be fixed, 
but I think it's there for soft lockup detector as well, but Fengguang's 
.config has soft lockup detector enable, so that failure is invisible.

I guess the most straightfoward fix is to ...

[ ... snip ... ]
> index b7b9501..5e65b14 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -384,6 +384,7 @@ extern int proc_dowatchdog_thresh(struct ctl_table *table, int write,
>  				  void __user *buffer,
>  				  size_t *lenp, loff_t *ppos);
>  extern unsigned int  softlockup_panic;
> +extern unsigned int  hardlockup_panic;

... those two be there only if appropriate config options are set.

Thanks,

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2015-10-15 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-15  2:42 [PATCH] watchdog: Add sysctl knob hardlockup_panic Don Zickus
2015-10-15  4:19 ` kbuild test robot
2015-10-15 21:02 ` Jiri Kosina

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.