linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Feng Tang <feng.tang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org,
	Aaro Koskinen <aaro.koskinen@nokia.com>,
	Kees Cook <keescook@chromium.org>, Borislav Petkov <bp@suse.de>
Subject: Re: [PATCH v3] panic: add an option to replay all the printk message in buffer
Date: Thu, 25 Apr 2019 13:05:17 +0200	[thread overview]
Message-ID: <20190425110517.cafkeexdr6r4b25v@pathway.suse.cz> (raw)
In-Reply-To: <1556095872-36838-1-git-send-email-feng.tang@intel.com>

On Wed 2019-04-24 16:51:12, Feng Tang wrote:
> 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 .
> 
> diff --git a/kernel/panic.c b/kernel/panic.c
> index b9f004e..b9c0eb3 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -53,6 +53,7 @@ int panic_suppress_printk;
>  #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);
> @@ -136,6 +137,11 @@ EXPORT_SYMBOL(nmi_panic);
>  
>  static void panic_print_sys_info(void)
>  {
> +	if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
> +		console_flush_on_panic(CONSOLE_REPLAY_ALL);
> +	else
> +		console_flush_on_panic(CONSOLE_FLUSH_PENDING);
> +
>  	if (panic_print & PANIC_PRINT_TASK_INFO)
>  		show_state();
>  
> @@ -279,8 +285,6 @@ void panic(const char *fmt, ...)
>  	 * panic() is not being callled from OOPS.
>  	 */
>  	debug_locks_off();
> -	console_flush_on_panic();

I would prefer if we keep it here. It is a very important
operation that plays a role in many panic/printk related
bugs. We should not hide it in an "unrelated"
function.

The name "panic_print_sys_info" suggests that it
just shows some additional information.

I guess that you wanted to avoid flushing some messages
twice. IMHO, it is not a big deal. In many situations,
console_flush_on_panic(CONSOLE_FLUSH_PENDING) will
do nothing or it would handle just few lines.

Also people might decide to do a forced reboot when
the console is slow and it takes ages to print
everything. Then it might be useful to handle
the few "most" important lines before starting
from beginning.

Other than that I am fine with the patch. I give up
on bike shedding about the header line ;-)

Best Regards,
Petr

  reply	other threads:[~2019-04-25 11:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24  8:51 [PATCH v3] panic: add an option to replay all the printk message in buffer Feng Tang
2019-04-25 11:05 ` Petr Mladek [this message]
2019-04-25 12:44   ` 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=20190425110517.cafkeexdr6r4b25v@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=aaro.koskinen@nokia.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@suse.de \
    --cc=feng.tang@intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).