Skip to content

Commit 897aea3

Browse files
committed
Merge branch 'core-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core debug changes from Ingo Molnar: "Currently there are two methods to set the panic_timeout: via 'panic=X' boot commandline option, or via /proc/sys/kernel/panic. This tree adds a third panic_timeout configuration method: configuration via Kconfig, via CONFIG_PANIC_TIMEOUT=X - useful to distros that generally want their kernel defaults to come with the .config. CONFIG_PANIC_TIMEOUT defaults to 0, which was the previous default value of panic_timeout. Doing that unearthed a few arch trickeries regarding arch-special panic_timeout values and related complications - hopefully all resolved to the satisfaction of everyone" * 'core-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: powerpc: Clean up panic_timeout usage MIPS: Remove panic_timeout settings panic: Make panic_timeout configurable
2 parents 9451ee2 + b71d47c commit 897aea3

File tree

13 files changed

+25
-16
lines changed

13 files changed

+25
-16
lines changed

arch/mips/ar7/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ void __init plat_mem_setup(void)
9292
_machine_restart = ar7_machine_restart;
9393
_machine_halt = ar7_machine_halt;
9494
pm_power_off = ar7_machine_power_off;
95-
panic_timeout = 3;
9695

9796
io_base = (unsigned long)ioremap(AR7_REGS_BASE, 0x10000);
9897
if (!io_base)

arch/mips/emma/markeins/setup.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ void __init plat_mem_setup(void)
111111
iomem_resource.start = EMMA2RH_IO_BASE;
112112
iomem_resource.end = EMMA2RH_ROM_BASE - 1;
113113

114-
/* Reboot on panic */
115-
panic_timeout = 180;
116-
117114
markeins_sio_setup();
118115
}
119116

arch/mips/netlogic/xlp/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ static void __init xlp_init_mem_from_bars(void)
9292

9393
void __init plat_mem_setup(void)
9494
{
95-
panic_timeout = 5;
9695
_machine_restart = (void (*)(char *))nlm_linux_exit;
9796
_machine_halt = nlm_linux_exit;
9897
pm_power_off = nlm_linux_exit;

arch/mips/netlogic/xlr/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ static void nlm_linux_exit(void)
9292

9393
void __init plat_mem_setup(void)
9494
{
95-
panic_timeout = 5;
9695
_machine_restart = (void (*)(char *))nlm_linux_exit;
9796
_machine_halt = nlm_linux_exit;
9897
pm_power_off = nlm_linux_exit;

arch/mips/sibyte/swarm/setup.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,6 @@ void __init plat_mem_setup(void)
134134
#error invalid SiByte board configuration
135135
#endif
136136

137-
panic_timeout = 5; /* For debug. */
138-
139137
board_be_handler = swarm_be_handler;
140138

141139
if (xicor_probe())

arch/powerpc/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ config EARLY_PRINTK
147147
bool
148148
default y
149149

150+
config PANIC_TIMEOUT
151+
int
152+
default 180
153+
150154
config COMPAT
151155
bool
152156
default y if PPC64

arch/powerpc/include/asm/setup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern void reloc_got2(unsigned long);
2626
void check_for_initrd(void);
2727
void do_init_bootmem(void);
2828
void setup_panic(void);
29+
#define ARCH_PANIC_TIMEOUT 180
2930

3031
#endif /* !__ASSEMBLY__ */
3132

arch/powerpc/kernel/setup_32.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,6 @@ void __init setup_arch(char **cmdline_p)
296296
if (cpu_has_feature(CPU_FTR_UNIFIED_ID_CACHE))
297297
ucache_bsize = icache_bsize = dcache_bsize;
298298

299-
/* reboot on panic */
300-
panic_timeout = 180;
301-
302299
if (ppc_md.panic)
303300
setup_panic();
304301

arch/powerpc/kernel/setup_64.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,6 @@ void __init setup_arch(char **cmdline_p)
588588
dcache_bsize = ppc64_caches.dline_size;
589589
icache_bsize = ppc64_caches.iline_size;
590590

591-
/* reboot on panic */
592-
panic_timeout = 180;
593-
594591
if (ppc_md.panic)
595592
setup_panic();
596593

arch/powerpc/platforms/pseries/setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ static long pseries_little_endian_exceptions(void)
470470

471471
static void __init pSeries_setup_arch(void)
472472
{
473-
panic_timeout = 10;
473+
set_arch_panic_timeout(10, ARCH_PANIC_TIMEOUT);
474474

475475
/* Discover PIC type and setup ppc_md accordingly */
476476
pseries_discover_pic();

include/linux/kernel.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,15 @@ extern int panic_on_oops;
394394
extern int panic_on_unrecovered_nmi;
395395
extern int panic_on_io_nmi;
396396
extern int sysctl_panic_on_stackoverflow;
397+
/*
398+
* Only to be used by arch init code. If the user over-wrote the default
399+
* CONFIG_PANIC_TIMEOUT, honor it.
400+
*/
401+
static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
402+
{
403+
if (panic_timeout == arch_default_timeout)
404+
panic_timeout = timeout;
405+
}
397406
extern const char *print_tainted(void);
398407
enum lockdep_ok {
399408
LOCKDEP_STILL_OK,

kernel/panic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ static int pause_on_oops;
3333
static int pause_on_oops_flag;
3434
static DEFINE_SPINLOCK(pause_on_oops_lock);
3535

36-
int panic_timeout;
36+
int panic_timeout = CONFIG_PANIC_TIMEOUT;
3737
EXPORT_SYMBOL_GPL(panic_timeout);
3838

3939
ATOMIC_NOTIFIER_HEAD(panic_notifier_list);

lib/Kconfig.debug

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,15 @@ config PANIC_ON_OOPS_VALUE
761761
default 0 if !PANIC_ON_OOPS
762762
default 1 if PANIC_ON_OOPS
763763

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+
764773
config SCHED_DEBUG
765774
bool "Collect scheduler debugging info"
766775
depends on DEBUG_KERNEL && PROC_FS

0 commit comments

Comments
 (0)