File tree Expand file tree Collapse file tree 5 files changed +24
-4
lines changed
Documentation/admin-guide Expand file tree Collapse file tree 5 files changed +24
-4
lines changed Original file line number Diff line number Diff line change 32123212 bit 2: print timer info
32133213 bit 3: print locks info if CONFIG_LOCKDEP is on
32143214 bit 4: print ftrace buffer
3215+ bit 5: print all printk messages in buffer
32153216
32163217 panic_on_warn panic() instead of WARN(). Useful to cause kdump
32173218 on a WARN().
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ extern void panic_flush_kmsg_end(void)
179179 kmsg_dump (KMSG_DUMP_PANIC );
180180 bust_spinlocks (0 );
181181 debug_locks_off ();
182- console_flush_on_panic ();
182+ console_flush_on_panic (CONSOLE_FLUSH_PENDING );
183183}
184184
185185static unsigned long oops_begin (struct pt_regs * regs )
Original file line number Diff line number Diff line change @@ -166,6 +166,11 @@ struct console {
166166extern int console_set_on_cmdline ;
167167extern struct console * early_console ;
168168
169+ enum con_flush_mode {
170+ CONSOLE_FLUSH_PENDING ,
171+ CONSOLE_REPLAY_ALL ,
172+ };
173+
169174extern int add_preferred_console (char * name , int idx , char * options );
170175extern void register_console (struct console * );
171176extern int unregister_console (struct console * );
@@ -175,7 +180,7 @@ extern int console_trylock(void);
175180extern void console_unlock (void );
176181extern void console_conditional_schedule (void );
177182extern void console_unblank (void );
178- extern void console_flush_on_panic (void );
183+ extern void console_flush_on_panic (enum con_flush_mode mode );
179184extern struct tty_driver * console_device (int * );
180185extern void console_stop (struct console * );
181186extern void console_start (struct console * );
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ EXPORT_SYMBOL_GPL(panic_timeout);
5151#define PANIC_PRINT_TIMER_INFO 0x00000004
5252#define PANIC_PRINT_LOCK_INFO 0x00000008
5353#define PANIC_PRINT_FTRACE_INFO 0x00000010
54+ #define PANIC_PRINT_ALL_PRINTK_MSG 0x00000020
5455unsigned long panic_print ;
5556
5657ATOMIC_NOTIFIER_HEAD (panic_notifier_list );
@@ -134,6 +135,9 @@ EXPORT_SYMBOL(nmi_panic);
134135
135136static void panic_print_sys_info (void )
136137{
138+ if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG )
139+ console_flush_on_panic (CONSOLE_REPLAY_ALL );
140+
137141 if (panic_print & PANIC_PRINT_TASK_INFO )
138142 show_state ();
139143
@@ -277,7 +281,7 @@ void panic(const char *fmt, ...)
277281 * panic() is not being callled from OOPS.
278282 */
279283 debug_locks_off ();
280- console_flush_on_panic ();
284+ console_flush_on_panic (CONSOLE_FLUSH_PENDING );
281285
282286 panic_print_sys_info ();
283287
Original file line number Diff line number Diff line change @@ -2535,10 +2535,11 @@ void console_unblank(void)
25352535
25362536/**
25372537 * console_flush_on_panic - flush console content on panic
2538+ * @mode: flush all messages in buffer or just the pending ones
25382539 *
25392540 * Immediately output all pending messages no matter what.
25402541 */
2541- void console_flush_on_panic (void )
2542+ void console_flush_on_panic (enum con_flush_mode mode )
25422543{
25432544 /*
25442545 * If someone else is holding the console lock, trylock will fail
@@ -2549,6 +2550,15 @@ void console_flush_on_panic(void)
25492550 */
25502551 console_trylock ();
25512552 console_may_schedule = 0 ;
2553+
2554+ if (mode == CONSOLE_REPLAY_ALL ) {
2555+ unsigned long flags ;
2556+
2557+ logbuf_lock_irqsave (flags );
2558+ console_seq = log_first_seq ;
2559+ console_idx = log_first_idx ;
2560+ logbuf_unlock_irqrestore (flags );
2561+ }
25522562 console_unlock ();
25532563}
25542564
You can’t perform that action at this time.
0 commit comments