mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
panic: add an option to replay all the printk message in buffer
Currently on panic, kernel will lower the loglevel and print out pending printk msg only with console_flush_on_panic(). Add an option for users to configure the "panic_print" to replay all dmesg in buffer, some of which they may have never seen due to the loglevel setting, which will help panic debugging . [[email protected]: keep the original console_flush_on_panic() inside panic()] Link: http://lkml.kernel.org/r/[email protected] [[email protected]: use logbuf lock to protect the console log index] Link: http://lkml.kernel.org/r/[email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Feng Tang <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Cc: Aaro Koskinen <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Kees Cook <[email protected]> Cc: Borislav Petkov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
5d59aa8f9c
commit
de6da1e8bc
5 changed files with 24 additions and 4 deletions
|
|
@ -2535,10 +2535,11 @@ void console_unblank(void)
|
|||
|
||||
/**
|
||||
* console_flush_on_panic - flush console content on panic
|
||||
* @mode: flush all messages in buffer or just the pending ones
|
||||
*
|
||||
* Immediately output all pending messages no matter what.
|
||||
*/
|
||||
void console_flush_on_panic(void)
|
||||
void console_flush_on_panic(enum con_flush_mode mode)
|
||||
{
|
||||
/*
|
||||
* If someone else is holding the console lock, trylock will fail
|
||||
|
|
@ -2549,6 +2550,15 @@ void console_flush_on_panic(void)
|
|||
*/
|
||||
console_trylock();
|
||||
console_may_schedule = 0;
|
||||
|
||||
if (mode == CONSOLE_REPLAY_ALL) {
|
||||
unsigned long flags;
|
||||
|
||||
logbuf_lock_irqsave(flags);
|
||||
console_seq = log_first_seq;
|
||||
console_idx = log_first_idx;
|
||||
logbuf_unlock_irqrestore(flags);
|
||||
}
|
||||
console_unlock();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue