Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

panic: add note that panic_print sysctl interface is deprecated

Add a dedicated core parameter 'panic_console_replay' for controlling
console replay, and add note that 'panic_print' sysctl interface will be
obsoleted by 'panic_sys_info' and 'panic_console_replay'. When it
happens, the SYS_INFO_PANIC_CONSOLE_REPLAY can be removed as well.

Link: https://lkml.kernel.org/r/20250703021004.42328-6-feng.tang@linux.alibaba.com
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
Suggested-by: Petr Mladek <pmladek@suse.com>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: "Paul E . McKenney" <paulmck@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Feng Tang and committed by
Andrew Morton
ee13240c 9743d12d

+17 -8
+4
Documentation/admin-guide/kernel-parameters.txt
··· 4578 4578 4579 4579 This is a human readable alternative to the 'panic_print' option. 4580 4580 4581 + panic_console_replay 4582 + When panic happens, replay all kernel messages on 4583 + consoles at the end of panic. 4584 + 4581 4585 parkbd.port= [HW] Parallel port number the keyboard adapter is 4582 4586 connected to, default is 0. 4583 4587 Format: <parport#>
+13 -8
kernel/panic.c
··· 64 64 unsigned long panic_on_taint; 65 65 bool panic_on_taint_nousertaint = false; 66 66 static unsigned int warn_limit __read_mostly; 67 + static bool panic_console_replay; 67 68 68 69 bool panic_triggering_all_cpu_backtrace; 69 70 ··· 78 77 EXPORT_SYMBOL(panic_notifier_list); 79 78 80 79 #ifdef CONFIG_SYSCTL 80 + static int sysctl_panic_print_handler(const struct ctl_table *table, int write, 81 + void *buffer, size_t *lenp, loff_t *ppos) 82 + { 83 + pr_info_once("Kernel: 'panic_print' sysctl interface will be obsoleted by both 'panic_sys_info' and 'panic_console_replay'\n"); 84 + return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); 85 + } 86 + 81 87 static const struct ctl_table kern_panic_table[] = { 82 88 #ifdef CONFIG_SMP 83 89 { ··· 116 108 .data = &panic_print, 117 109 .maxlen = sizeof(unsigned long), 118 110 .mode = 0644, 119 - .proc_handler = proc_doulongvec_minmax, 111 + .proc_handler = sysctl_panic_print_handler, 120 112 }, 121 113 { 122 114 .procname = "panic_on_warn", ··· 254 246 nmi_panic_self_stop(regs); 255 247 } 256 248 EXPORT_SYMBOL(nmi_panic); 257 - 258 - static void panic_console_replay(void) 259 - { 260 - if (panic_print & SYS_INFO_PANIC_CONSOLE_REPLAY) 261 - console_flush_on_panic(CONSOLE_REPLAY_ALL); 262 - } 263 249 264 250 void check_panic_on_warn(const char *origin) 265 251 { ··· 429 427 debug_locks_off(); 430 428 console_flush_on_panic(CONSOLE_FLUSH_PENDING); 431 429 432 - panic_console_replay(); 430 + if ((panic_print & SYS_INFO_PANIC_CONSOLE_REPLAY) || 431 + panic_console_replay) 432 + console_flush_on_panic(CONSOLE_REPLAY_ALL); 433 433 434 434 if (!panic_blink) 435 435 panic_blink = no_blink; ··· 873 869 core_param(pause_on_oops, pause_on_oops, int, 0644); 874 870 core_param(panic_on_warn, panic_on_warn, int, 0644); 875 871 core_param(crash_kexec_post_notifiers, crash_kexec_post_notifiers, bool, 0644); 872 + core_param(panic_console_replay, panic_console_replay, bool, 0644); 876 873 877 874 static int __init oops_setup(char *s) 878 875 {