build in panic_timeout value
Subsystems (3)
v3 cover build in panic_timeout value
Hi,
I've now separated out the arch bits into separate patches. Hopefully, it makes review easier. I also didn't address moving the 'panic_timeout' command-line parameter up as an 'early_param()'. I think it might make sense to move it up, especially for distro kernels, but its not a need here, so I didn't want to just shove it in. If needed, I think it can come in separately, as it shoudn't affect this series.
Thanks,
-Jason
v3:
-separate arch bits
-drop mips settings of panic_timeout as per Ralf Baechle
v2:
-restrict arch defaults to arch/ code
-add set_arch_panic_timeout(), in case .config specifies a non-default timeout
Jason Baron (2):
panic: Make panic_timeout configurable
powerpc: cleanup panic_timeout
Ralf Baechle (1):
mips: remove panic_timeout settings.
arch/mips/ar7/setup.c | 1 - arch/mips/emma/markeins/setup.c | 3 --- arch/mips/netlogic/xlp/setup.c | 1 - arch/mips/netlogic/xlr/setup.c | 1 - arch/mips/sibyte/swarm/setup.c | 2 -- arch/powerpc/Kconfig | 4 ++++ arch/powerpc/include/asm/setup.h | 1 + arch/powerpc/kernel/setup_32.c | 3 --- arch/powerpc/kernel/setup_64.c | 3 --- arch/powerpc/platforms/pseries/setup.c | 2 +- include/linux/kernel.h | 9 +++++++++ kernel/panic.c | 2 +- lib/Kconfig.debug | 9 +++++++++ 13 files changed, 25 insertions(+), 16 deletions(-)
Signature · 1 line
1.8.2
PATCH v3 1/3 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.
--- include/linux/kernel.h | 9 +++++++++ kernel/panic.c | 2 +- lib/Kconfig.debug | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-)
include/linux/kernel.h +9 -0
@@ -393,6 +393,15 @@ extern int panic_on_oops;extern int panic_on_unrecovered_nmi;extern int panic_on_io_nmi;extern int sysctl_panic_on_stackoverflow; +/* +* Only to be used by arch init code. If the user over-wrote the default +* CONFIG_PANIC_TIMEOUT, honor it. +*/ +static inline void set_arch_panic_timeout (int timeout,int arch_default_timeout) +{ +if (panic_timeout == arch_default_timeout) + panic_timeout = timeout; +}extern const char *print_tainted (void );enum lockdep_ok {LOCKDEP_STILL_OK ,
kernel/panic.c +1 -1
@@ -33,7 +33,7 @@ static int pause_on_oops;static int pause_on_oops_flag;static DEFINE_SPINLOCK (pause_on_oops_lock); -int panic_timeout; +int panic_timeout =CONFIG_PANIC_TIMEOUT ;EXPORT_SYMBOL_GPL (panic_timeout);ATOMIC_NOTIFIER_HEAD (panic_notifier_list);
lib/Kconfig.debug +9 -0
@@ -761,6 +761,15 @@ config PANIC_ON_OOPS_VALUE default 0 if !PANIC_ON_OOPS default 1 if PANIC_ON_OOPS +config PANIC_TIMEOUT + int "panic timeout" + default 0 + help + Set the timeout value (in seconds) until a reboot occurs when the + the kernel panics. If n = 0, then we wait forever. A timeout + value n > 0 will wait n seconds before rebooting, while a timeout + value n < 0 will reboot immediately. + config SCHED_DEBUG bool "Collect scheduler debugging info" depends on DEBUG_KERNEL && PROC_FS
Signature · 1 line
1.8.2
PATCH v3 3/3 powerpc: cleanup panic_timeout
In reply to Jason BaronDefault CONFIG_PANIC_TIMEOUT to 180 seconds on powerpc. The pSeries continue to set the timeout to 10 seconds at run-time. Thus, there's a small window where we don't have the correct value on pSeries, but if this is only run-time discoverable we don't have a better option. In any case, if the user changes the default setting of 180 seconds, we honor that user setting.
--- arch/powerpc/Kconfig | 4 ++++ arch/powerpc/include/asm/setup.h | 1 + arch/powerpc/kernel/setup_32.c | 3 --- arch/powerpc/kernel/setup_64.c | 3 --- arch/powerpc/platforms/pseries/setup.c | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-)
arch/powerpc/Kconfig +4 -0
@@ -147,6 +147,10 @@ config EARLY_PRINTK bool default y +config PANIC_TIMEOUT + int + default 180 + config COMPAT bool default y if PPC64
arch/powerpc/include/asm/setup.h +1 -0
@@ -26,6 +26,7 @@ extern void reloc_got2(unsigned long);void check_for_initrd (void );void do_init_bootmem (void );void setup_panic (void ); +#define ARCH_PANIC_TIMEOUT 180#endif /* !__ASSEMBLY__ */
arch/powerpc/kernel/setup_32.c +0 -3
@@ -296,9 +296,6 @@ void __init setup_arch(char **cmdline_p)if (cpu_has_feature (CPU_FTR_UNIFIED_ID_CACHE )) ucache_bsize = icache_bsize = dcache_bsize; -/* reboot on panic */ - panic_timeout =180 ; -if (ppc_md.panic)setup_panic ();
arch/powerpc/kernel/setup_64.c +0 -3
@@ -588,9 +588,6 @@ void __init setup_arch(char **cmdline_p) dcache_bsize = ppc64_caches.dline_size; icache_bsize = ppc64_caches.iline_size; -/* reboot on panic */ - panic_timeout =180 ; -if (ppc_md.panic)setup_panic ();
arch/powerpc/platforms/pseries/setup.c +1 -1
@@ -470,7 +470,7 @@ static long pseries_little_endian_exceptions(void)static void __init pSeries_setup_arch (void ) { - panic_timeout =10 ; +set_arch_panic_timeout (10 ,ARCH_PANIC_TIMEOUT );/* Discover PIC type and setup ppc_md accordingly */ pseries_discover_pic ();
Signature · 1 line
1.8.2
PATCH v3 2/3 mips: remove panic_timeout settings
In reply to Jason BaronFrom: Ralf Baechle <[email protected]>
Now that we have a CONFIG_PANIC_TIMEOUT=x setting, remove the mips settings. The default is 0, which means don't reboot on panic.
--- arch/mips/ar7/setup.c | 1 - arch/mips/emma/markeins/setup.c | 3 --- arch/mips/netlogic/xlp/setup.c | 1 - arch/mips/netlogic/xlr/setup.c | 1 - arch/mips/sibyte/swarm/setup.c | 2 -- 5 files changed, 8 deletions(-)
arch/mips/ar7/setup.c +0 -1
@@ -92,7 +92,6 @@ void __init plat_mem_setup(void) _machine_restart = ar7_machine_restart; _machine_halt = ar7_machine_halt; pm_power_off = ar7_machine_power_off; - panic_timeout =3 ; io_base = (unsigned long )ioremap (AR7_REGS_BASE ,0x10000 );if (!io_base)
arch/mips/emma/markeins/setup.c +0 -3
@@ -111,9 +111,6 @@ void __init plat_mem_setup(void) iomem_resource.start =EMMA2RH_IO_BASE ; iomem_resource.end =EMMA2RH_ROM_BASE -1 ; -/* Reboot on panic */ - panic_timeout =180 ; -markeins_sio_setup (); }
arch/mips/netlogic/xlp/setup.c +0 -1
@@ -92,7 +92,6 @@ static void __init xlp_init_mem_from_bars(void)void __init plat_mem_setup (void ) { - panic_timeout =5 ; _machine_restart = (void (*)(char *))nlm_linux_exit; _machine_halt = nlm_linux_exit; pm_power_off = nlm_linux_exit;
arch/mips/netlogic/xlr/setup.c +0 -1
@@ -92,7 +92,6 @@ static void nlm_linux_exit(void)void __init plat_mem_setup (void ) { - panic_timeout =5 ; _machine_restart = (void (*)(char *))nlm_linux_exit; _machine_halt = nlm_linux_exit; pm_power_off = nlm_linux_exit;
arch/mips/sibyte/swarm/setup.c +0 -2
@@ -134,8 +134,6 @@ void __init plat_mem_setup(void)#error invalid SiByte board configuration#endif - panic_timeout =5 ;/* For debug. */ - board_be_handler = swarm_be_handler;if (xicor_probe ())
Signature · 1 line
1.8.2
Quoted 9 lines · Jason Baron
Hi,
I've now separated out the arch bits into separate patches. Hopefully, it makes review easier. I also didn't address moving the '
panic_timeout' command-line parameter up as an 'early_param()'. I think it might make sense to move it up, especially for distro kernels, but its not a need here, so I didn't want to just shove it in. If needed, I think it can come in separately, as it shoudn't affect this series.
The series looks good to me, I've applied the patches to tip:core/debug.
If Felipe Contreras's fix patch looks good to you then it would also be nice if you could send me that as well, on top of your patches.
That fix patch had only one remaining bug/problem, last I checked: if panic_timeout is turned into an early_param() then pause_on_oops should obviously also be turned into an early param. Changing just one of these parameters would be inconsistent and would lead to assymetric behavior in the early-crash case.
Thanks,
Ingo
tip-bot for Jason Baron
merge bot[tip:core/debug] panic: Make panic_timeout configurable
In reply to Jason Baronpanic: Make panic_timeout configurable
Commit-ID: 5800dc3cff87c3a1548382298bb16e1fb4ec7e32 Gitweb: http://git.kernel.org/tip/5800dc3cff87c3a1548382298bb16e1fb4ec7e32 Author: Jason Baron <[email protected]> AuthorDate: Mon, 25 Nov 2013 23:23:04 +0000 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 26 Nov 2013 12:12:26 +0100
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.
--- include/linux/kernel.h | 9 +++++++++ kernel/panic.c | 2 +- lib/Kconfig.debug | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-)
include/linux/kernel.h +9 -0
@@ -393,6 +393,15 @@ extern int panic_on_oops;extern int panic_on_unrecovered_nmi;extern int panic_on_io_nmi;extern int sysctl_panic_on_stackoverflow; +/* +* Only to be used by arch init code. If the user over-wrote the default +* CONFIG_PANIC_TIMEOUT, honor it. +*/ +static inline void set_arch_panic_timeout (int timeout,int arch_default_timeout) +{ +if (panic_timeout == arch_default_timeout) + panic_timeout = timeout; +}extern const char *print_tainted (void );enum lockdep_ok {LOCKDEP_STILL_OK ,
kernel/panic.c +1 -1
@@ -33,7 +33,7 @@ static int pause_on_oops;static int pause_on_oops_flag;static DEFINE_SPINLOCK (pause_on_oops_lock); -int panic_timeout; +int panic_timeout =CONFIG_PANIC_TIMEOUT ;EXPORT_SYMBOL_GPL (panic_timeout);ATOMIC_NOTIFIER_HEAD (panic_notifier_list);
lib/Kconfig.debug +9 -0
@@ -761,6 +761,15 @@ config PANIC_ON_OOPS_VALUE default 0 if !PANIC_ON_OOPS default 1 if PANIC_ON_OOPS +config PANIC_TIMEOUT + int "panic timeout" + default 0 + help + Set the timeout value (in seconds) until a reboot occurs when the + the kernel panics. If n = 0, then we wait forever. A timeout + value n > 0 will wait n seconds before rebooting, while a timeout + value n < 0 will reboot immediately. + config SCHED_DEBUG bool "Collect scheduler debugging info" depends on DEBUG_KERNEL && PROC_FS
tip-bot for Jason Baron
merge bot[tip:core/debug] powerpc: Clean up panic_timeout usage
In reply to Jason Baronpowerpc: Clean up panic_timeout usage
Commit-ID: b71d47c14fba6270c0b5a0d56639bf042017025b Gitweb: http://git.kernel.org/tip/b71d47c14fba6270c0b5a0d56639bf042017025b Author: Jason Baron <[email protected]> AuthorDate: Mon, 25 Nov 2013 23:23:11 +0000 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 26 Nov 2013 12:12:28 +0100
powerpc: Clean up panic_timeout usage
Default CONFIG_PANIC_TIMEOUT to 180 seconds on powerpc. The pSeries continue to set the timeout to 10 seconds at run-time.
Thus, there's a small window where we don't have the correct value on pSeries, but if this is only run-time discoverable we don't have a better option. In any case, if the user changes the default setting of 180 seconds, we honor that user setting.
--- arch/powerpc/Kconfig | 4 ++++ arch/powerpc/include/asm/setup.h | 1 + arch/powerpc/kernel/setup_32.c | 3 --- arch/powerpc/kernel/setup_64.c | 3 --- arch/powerpc/platforms/pseries/setup.c | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-)
arch/powerpc/Kconfig +4 -0
@@ -147,6 +147,10 @@ config EARLY_PRINTK bool default y +config PANIC_TIMEOUT + int + default 180 + config COMPAT bool default y if PPC64
arch/powerpc/include/asm/setup.h +1 -0
@@ -26,6 +26,7 @@ extern void reloc_got2(unsigned long);void check_for_initrd (void );void do_init_bootmem (void );void setup_panic (void ); +#define ARCH_PANIC_TIMEOUT 180#endif /* !__ASSEMBLY__ */
arch/powerpc/kernel/setup_32.c +0 -3
@@ -296,9 +296,6 @@ void __init setup_arch(char **cmdline_p)if (cpu_has_feature (CPU_FTR_UNIFIED_ID_CACHE )) ucache_bsize = icache_bsize = dcache_bsize; -/* reboot on panic */ - panic_timeout =180 ; -if (ppc_md.panic)setup_panic ();
arch/powerpc/kernel/setup_64.c +0 -3
@@ -588,9 +588,6 @@ void __init setup_arch(char **cmdline_p) dcache_bsize = ppc64_caches.dline_size; icache_bsize = ppc64_caches.iline_size; -/* reboot on panic */ - panic_timeout =180 ; -if (ppc_md.panic)setup_panic ();
arch/powerpc/platforms/pseries/setup.c +1 -1
@@ -470,7 +470,7 @@ static long pseries_little_endian_exceptions(void)static void __init pSeries_setup_arch (void ) { - panic_timeout =10 ; +set_arch_panic_timeout (10 ,ARCH_PANIC_TIMEOUT );/* Discover PIC type and setup ppc_md accordingly */ pseries_discover_pic ();
tip-bot for Ralf Baechle
merge bot[tip:core/debug] MIPS: Remove panic_timeout settings
In reply to Jason BaronMIPS: Remove panic_timeout settings
Commit-ID: 7972e966b032939afe63d8db22975240879dfd2a Gitweb: http://git.kernel.org/tip/7972e966b032939afe63d8db22975240879dfd2a Author: Ralf Baechle <[email protected]> AuthorDate: Mon, 25 Nov 2013 23:23:07 +0000 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 26 Nov 2013 12:12:27 +0100
MIPS: Remove panic_timeout settings
Now that we have a CONFIG_PANIC_TIMEOUT=x setting, remove the mips settings. The default is 0, which means don't reboot on panic.
--- arch/mips/ar7/setup.c | 1 - arch/mips/emma/markeins/setup.c | 3 --- arch/mips/netlogic/xlp/setup.c | 1 - arch/mips/netlogic/xlr/setup.c | 1 - arch/mips/sibyte/swarm/setup.c | 2 -- 5 files changed, 8 deletions(-)
arch/mips/ar7/setup.c +0 -1
@@ -92,7 +92,6 @@ void __init plat_mem_setup(void) _machine_restart = ar7_machine_restart; _machine_halt = ar7_machine_halt; pm_power_off = ar7_machine_power_off; - panic_timeout =3 ; io_base = (unsigned long )ioremap (AR7_REGS_BASE ,0x10000 );if (!io_base)
arch/mips/emma/markeins/setup.c +0 -3
@@ -111,9 +111,6 @@ void __init plat_mem_setup(void) iomem_resource.start =EMMA2RH_IO_BASE ; iomem_resource.end =EMMA2RH_ROM_BASE -1 ; -/* Reboot on panic */ - panic_timeout =180 ; -markeins_sio_setup (); }
arch/mips/netlogic/xlp/setup.c +0 -1
@@ -92,7 +92,6 @@ static void __init xlp_init_mem_from_bars(void)void __init plat_mem_setup (void ) { - panic_timeout =5 ; _machine_restart = (void (*)(char *))nlm_linux_exit; _machine_halt = nlm_linux_exit; pm_power_off = nlm_linux_exit;
arch/mips/netlogic/xlr/setup.c +0 -1
@@ -92,7 +92,6 @@ static void nlm_linux_exit(void)void __init plat_mem_setup (void ) { - panic_timeout =5 ; _machine_restart = (void (*)(char *))nlm_linux_exit; _machine_halt = nlm_linux_exit; pm_power_off = nlm_linux_exit;
arch/mips/sibyte/swarm/setup.c +0 -2
@@ -134,8 +134,6 @@ void __init plat_mem_setup(void)#error invalid SiByte board configuration#endif - panic_timeout =5 ;/* For debug. */ - board_be_handler = swarm_be_handler;if (xicor_probe ())
Quoted 10 lines · Ingo Molnar
Quoted 7 lines · Jason Baron
I've now separated out the arch bits into separate patches. Hopefully, it makes review easier. I also didn't address moving the '
panic_timeout' command-line parameter up as an 'early_param()'. I think it might make sense to move it up, especially for distro kernels, but its not a need here, so I didn't want to just shove it in. If needed, I think it can come in separately, as it shoudn't affect this series.
Quoted 5 lines
The series looks good to me, I've applied the patches to tip:core/debug.
If Felipe Contreras's fix patch looks good to you then it would also be nice if you could send me that as well, on top of your patches.
Why? Because for ad hominem reasons you wouldn't take the patch itself even though it's obviously good?
Quoted 3 lines
That fix patch had only one remaining bug/problem, last I checked: if
panic_timeoutis turned into anearly_param()thenpause_on_oopsshould obviously also be turned into an early param.
That is not a "problem" with the patch itself, and it's the first time this "problem" has been mentioned at all.
Signature · 1 line
Felipe Contreras