public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Petr Mladek <pmladek@suse.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>, Borislav Petkov <bp@suse.de>,
	Feng Tang <feng.tang@intel.com>
Subject: [PATCH 2/2] panic: Enable to print out all printk msg in buffer
Date: Mon,  1 Apr 2019 18:48:04 +0800	[thread overview]
Message-ID: <1554115684-26846-2-git-send-email-feng.tang@intel.com> (raw)
In-Reply-To: <1554115684-26846-1-git-send-email-feng.tang@intel.com>

Currently on panic, kernel will lower the loglevel and print out
new printk msg only. With this patch, user can configure the
"panic_print" to see all dmesg in buffer, some of which they may
have never seen due to the loglevel setting.

Signed-off-by: Feng Tang <feng.tang@intel.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 1 +
 kernel/panic.c                                  | 9 ++++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 2b8ee90..7b15c94 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3135,6 +3135,7 @@
 			bit 2: print timer info
 			bit 3: print locks info if CONFIG_LOCKDEP is on
 			bit 4: print ftrace buffer
+			bit 5: print all printk messages in buffer
 
 	panic_on_warn	panic() instead of WARN().  Useful to cause kdump
 			on a WARN().
diff --git a/kernel/panic.c b/kernel/panic.c
index fb77e01..afe023e 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -51,6 +51,7 @@ EXPORT_SYMBOL_GPL(panic_timeout);
 #define PANIC_PRINT_TIMER_INFO		0x00000004
 #define PANIC_PRINT_LOCK_INFO		0x00000008
 #define PANIC_PRINT_FTRACE_INFO		0x00000010
+#define PANIC_PRINT_ALL_PRINTK_MSG	0x00000020
 unsigned long panic_print;
 
 ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
@@ -134,6 +135,13 @@ EXPORT_SYMBOL(nmi_panic);
 
 static void panic_print_sys_info(void)
 {
+	bool flush_all_dmesg = false;
+
+	if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
+		flush_all_dmesg = true;
+
+	console_flush_on_panic(flush_all_dmesg);
+
 	if (panic_print & PANIC_PRINT_TASK_INFO)
 		show_state();
 
@@ -277,7 +285,6 @@ void panic(const char *fmt, ...)
 	 * panic() is not being callled from OOPS.
 	 */
 	debug_locks_off();
-	console_flush_on_panic(false);
 
 	panic_print_sys_info();
 
-- 
2.7.4


  reply	other threads:[~2019-04-01 10:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 10:48 [PATCH 1/2] printk: Add an option to flush all messages on panic Feng Tang
2019-04-01 10:48 ` Feng Tang [this message]
2019-04-09 14:14   ` [PATCH 2/2] panic: Enable to print out all printk msg in buffer Petr Mladek
2019-04-10  1:59     ` Sergey Senozhatsky
2019-04-10  8:02       ` Petr Mladek
2019-04-10  8:16         ` Sergey Senozhatsky
2019-04-10 10:12     ` Feng Tang
2019-04-01 11:50 ` [PATCH 1/2] printk: Add an option to flush all messages on panic Mukesh Ojha
2019-04-02  2:47   ` Feng Tang
2019-04-02  2:14 ` Sergey Senozhatsky
2019-04-02  2:28   ` Feng Tang
2019-04-02  2:29     ` Sergey Senozhatsky
2019-04-09 13:41       ` Petr Mladek
2019-04-10  1:47         ` Sergey Senozhatsky
2019-04-10  2:21           ` Feng Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1554115684-26846-2-git-send-email-feng.tang@intel.com \
    --to=feng.tang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox