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 3212
3212
bit 2: print timer info
3213
3213
bit 3: print locks info if CONFIG_LOCKDEP is on
3214
3214
bit 4: print ftrace buffer
3215
+ bit 5: print all printk messages in buffer
3215
3216
3216
3217
panic_on_warn panic() instead of WARN(). Useful to cause kdump
3217
3218
on a WARN().
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ extern void panic_flush_kmsg_end(void)
179
179
kmsg_dump (KMSG_DUMP_PANIC );
180
180
bust_spinlocks (0 );
181
181
debug_locks_off ();
182
- console_flush_on_panic ();
182
+ console_flush_on_panic (CONSOLE_FLUSH_PENDING );
183
183
}
184
184
185
185
static unsigned long oops_begin (struct pt_regs * regs )
Original file line number Diff line number Diff line change @@ -166,6 +166,11 @@ struct console {
166
166
extern int console_set_on_cmdline ;
167
167
extern struct console * early_console ;
168
168
169
+ enum con_flush_mode {
170
+ CONSOLE_FLUSH_PENDING ,
171
+ CONSOLE_REPLAY_ALL ,
172
+ };
173
+
169
174
extern int add_preferred_console (char * name , int idx , char * options );
170
175
extern void register_console (struct console * );
171
176
extern int unregister_console (struct console * );
@@ -175,7 +180,7 @@ extern int console_trylock(void);
175
180
extern void console_unlock (void );
176
181
extern void console_conditional_schedule (void );
177
182
extern void console_unblank (void );
178
- extern void console_flush_on_panic (void );
183
+ extern void console_flush_on_panic (enum con_flush_mode mode );
179
184
extern struct tty_driver * console_device (int * );
180
185
extern void console_stop (struct console * );
181
186
extern void console_start (struct console * );
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ EXPORT_SYMBOL_GPL(panic_timeout);
51
51
#define PANIC_PRINT_TIMER_INFO 0x00000004
52
52
#define PANIC_PRINT_LOCK_INFO 0x00000008
53
53
#define PANIC_PRINT_FTRACE_INFO 0x00000010
54
+ #define PANIC_PRINT_ALL_PRINTK_MSG 0x00000020
54
55
unsigned long panic_print ;
55
56
56
57
ATOMIC_NOTIFIER_HEAD (panic_notifier_list );
@@ -134,6 +135,9 @@ EXPORT_SYMBOL(nmi_panic);
134
135
135
136
static void panic_print_sys_info (void )
136
137
{
138
+ if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG )
139
+ console_flush_on_panic (CONSOLE_REPLAY_ALL );
140
+
137
141
if (panic_print & PANIC_PRINT_TASK_INFO )
138
142
show_state ();
139
143
@@ -277,7 +281,7 @@ void panic(const char *fmt, ...)
277
281
* panic() is not being callled from OOPS.
278
282
*/
279
283
debug_locks_off ();
280
- console_flush_on_panic ();
284
+ console_flush_on_panic (CONSOLE_FLUSH_PENDING );
281
285
282
286
panic_print_sys_info ();
283
287
Original file line number Diff line number Diff line change @@ -2535,10 +2535,11 @@ void console_unblank(void)
2535
2535
2536
2536
/**
2537
2537
* console_flush_on_panic - flush console content on panic
2538
+ * @mode: flush all messages in buffer or just the pending ones
2538
2539
*
2539
2540
* Immediately output all pending messages no matter what.
2540
2541
*/
2541
- void console_flush_on_panic (void )
2542
+ void console_flush_on_panic (enum con_flush_mode mode )
2542
2543
{
2543
2544
/*
2544
2545
* If someone else is holding the console lock, trylock will fail
@@ -2549,6 +2550,15 @@ void console_flush_on_panic(void)
2549
2550
*/
2550
2551
console_trylock ();
2551
2552
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
+ }
2552
2562
console_unlock ();
2553
2563
}
2554
2564
You can’t perform that action at this time.
0 commit comments