diff options
author | Jason Baron <jbaron@akamai.com> | 2013-11-25 18:23:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-11-26 06:12:26 -0500 |
commit | 5800dc3cff87c3a1548382298bb16e1fb4ec7e32 (patch) | |
tree | 7495d7a91bbac6ab956cb0099ae023deb3a4db76 | |
parent | b975dc3689fc6a3718ad288ce080924f9cb7e176 (diff) |
panic: Make panic_timeout configurable
The panic_timeout value can be set via the command line option
'panic=x', or via /proc/sys/kernel/panic, however that is not
sufficient when the panic occurs before we are able to set up
these values. Thus, add a CONFIG_PANIC_TIMEOUT so that we can
set the desired value from the .config.
The default panic_timeout value continues to be 0 - wait
forever. Also adds set_arch_panic_timeout(new_timeout,
arch_default_timeout), which is intended to be used by arches in
arch_setup(). The idea being that the new_timeout is only set if
the user hasn't changed from the arch_default_timeout.
Signed-off-by: Jason Baron <jbaron@akamai.com>
Cc: benh@kernel.crashing.org
Cc: paulus@samba.org
Cc: ralf@linux-mips.org
Cc: mpe@ellerman.id.au
Cc: felipe.contreras@gmail.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1a1674daec27c534df409697025ac568ebcee91e.1385418410.git.jbaron@akamai.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | include/linux/kernel.h | 9 | ||||
-rw-r--r-- | kernel/panic.c | 2 | ||||
-rw-r--r-- | lib/Kconfig.debug | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d4e98d13eff4..2ac02772a86e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -393,6 +393,15 @@ extern int panic_on_oops; | |||
393 | extern int panic_on_unrecovered_nmi; | 393 | extern int panic_on_unrecovered_nmi; |
394 | extern int panic_on_io_nmi; | 394 | extern int panic_on_io_nmi; |
395 | extern int sysctl_panic_on_stackoverflow; | 395 | extern int sysctl_panic_on_stackoverflow; |
396 | /* | ||
397 | * Only to be used by arch init code. If the user over-wrote the default | ||
398 | * CONFIG_PANIC_TIMEOUT, honor it. | ||
399 | */ | ||
400 | static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout) | ||
401 | { | ||
402 | if (panic_timeout == arch_default_timeout) | ||
403 | panic_timeout = timeout; | ||
404 | } | ||
396 | extern const char *print_tainted(void); | 405 | extern const char *print_tainted(void); |
397 | enum lockdep_ok { | 406 | enum lockdep_ok { |
398 | LOCKDEP_STILL_OK, | 407 | LOCKDEP_STILL_OK, |
diff --git a/kernel/panic.c b/kernel/panic.c index c00b4ceb39e8..6d6300375090 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -33,7 +33,7 @@ static int pause_on_oops; | |||
33 | static int pause_on_oops_flag; | 33 | static int pause_on_oops_flag; |
34 | static DEFINE_SPINLOCK(pause_on_oops_lock); | 34 | static DEFINE_SPINLOCK(pause_on_oops_lock); |
35 | 35 | ||
36 | int panic_timeout; | 36 | int panic_timeout = CONFIG_PANIC_TIMEOUT; |
37 | EXPORT_SYMBOL_GPL(panic_timeout); | 37 | EXPORT_SYMBOL_GPL(panic_timeout); |
38 | 38 | ||
39 | ATOMIC_NOTIFIER_HEAD(panic_notifier_list); | 39 | ATOMIC_NOTIFIER_HEAD(panic_notifier_list); |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index db25707aa41b..6982094a7e74 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -761,6 +761,15 @@ config PANIC_ON_OOPS_VALUE | |||
761 | default 0 if !PANIC_ON_OOPS | 761 | default 0 if !PANIC_ON_OOPS |
762 | default 1 if PANIC_ON_OOPS | 762 | default 1 if PANIC_ON_OOPS |
763 | 763 | ||
764 | config PANIC_TIMEOUT | ||
765 | int "panic timeout" | ||
766 | default 0 | ||
767 | help | ||
768 | Set the timeout value (in seconds) until a reboot occurs when the | ||
769 | the kernel panics. If n = 0, then we wait forever. A timeout | ||
770 | value n > 0 will wait n seconds before rebooting, while a timeout | ||
771 | value n < 0 will reboot immediately. | ||
772 | |||
764 | config SCHED_DEBUG | 773 | config SCHED_DEBUG |
765 | bool "Collect scheduler debugging info" | 774 | bool "Collect scheduler debugging info" |
766 | depends on DEBUG_KERNEL && PROC_FS | 775 | depends on DEBUG_KERNEL && PROC_FS |