linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-doc@vger.kernel.org, mcgrof@kernel.org,
	keescook@chromium.org, yzaikin@google.com,
	akpm@linux-foundation.org, siglesias@igalia.com,
	kernel@gpiccoli.net
Subject: Re: [PATCH 2/3] panic: Add option to dump all CPUs backtraces in panic_print
Date: Tue, 30 Nov 2021 13:12:06 +0800	[thread overview]
Message-ID: <20211130051206.GB89318@shbuild999.sh.intel.com> (raw)
In-Reply-To: <20211109202848.610874-3-gpiccoli@igalia.com>

On Tue, Nov 09, 2021 at 05:28:47PM -0300, Guilherme G. Piccoli wrote:
> Currently the "panic_print" parameter/sysctl allows some interesting debug
> information to be printed during a panic event. This is useful for example
> in cases the user cannot kdump due to resource limits, or if the user
> collects panic logs in a serial output (or pstore) and prefers a fast
> reboot instead of a kdump.
> 
> Happens that currently there's no way to see all CPUs backtraces in
> a panic using "panic_print" on architectures that support that. We do
> have "oops_all_cpu_backtrace" sysctl, but although partially overlapping
> in the functionality, they are orthogonal in nature: "panic_print" is
> a panic tuning (and we have panics without oopses, like direct calls to
> panic() or maybe other paths that don't go through oops_enter()
> function), and the original purpose of "oops_all_cpu_backtrace" is to
> provide more information on oopses for cases in which the users desire
> to continue running the kernel even after an oops, i.e., used in
> non-panic scenarios.
> 
> So, we hereby introduce an additional bit for "panic_print" to allow
> dumping the CPUs backtraces during a panic event.

This looks to be helpful for debugging panic.

Reviewed-by: Feng Tang <feng.tang@intel.com>

Thanks,
Feng


> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 1 +
>  Documentation/admin-guide/sysctl/kernel.rst     | 1 +
>  kernel/panic.c                                  | 4 ++++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 0905d2cdb2d5..569d035c4332 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3690,6 +3690,7 @@
>  			bit 3: print locks info if CONFIG_LOCKDEP is on
>  			bit 4: print ftrace buffer
>  			bit 5: print all printk messages in buffer
> +			bit 6: print all CPUs backtrace (if available in the arch)
>  
>  	panic_on_taint=	Bitmask for conditionally calling panic() in add_taint()
>  			Format: <hex>[,nousertaint]
> diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
> index 70b7df9b081a..1666c1a9dbba 100644
> --- a/Documentation/admin-guide/sysctl/kernel.rst
> +++ b/Documentation/admin-guide/sysctl/kernel.rst
> @@ -796,6 +796,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
> +bit 6: print all CPUs backtrace (if available in the arch)
>  =====  ============================================
>  
>  So for example to print tasks and memory info on panic, user can::
> diff --git a/kernel/panic.c b/kernel/panic.c
> index cefd7d82366f..5da71fa4e5f1 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -65,6 +65,7 @@ EXPORT_SYMBOL_GPL(panic_timeout);
>  #define PANIC_PRINT_LOCK_INFO		0x00000008
>  #define PANIC_PRINT_FTRACE_INFO		0x00000010
>  #define PANIC_PRINT_ALL_PRINTK_MSG	0x00000020
> +#define PANIC_PRINT_ALL_CPU_BT		0x00000040
>  unsigned long panic_print;
>  
>  ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
> @@ -151,6 +152,9 @@ static void panic_print_sys_info(void)
>  	if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
>  		console_flush_on_panic(CONSOLE_REPLAY_ALL);
>  
> +	if (panic_print & PANIC_PRINT_ALL_CPU_BT)
> +		trigger_all_cpu_backtrace();
> +
>  	if (panic_print & PANIC_PRINT_TASK_INFO)
>  		show_state();
>  
> -- 
> 2.33.1

  reply	other threads:[~2021-11-30  5:12 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 20:28 [PATCH 0/3] Some improvements on panic_print Guilherme G. Piccoli
2021-11-09 20:28 ` [PATCH 1/3] docs: sysctl/kernel: Add missing bit to panic_print Guilherme G. Piccoli
2021-11-30  5:09   ` Feng Tang
2021-11-09 20:28 ` [PATCH 2/3] panic: Add option to dump all CPUs backtraces in panic_print Guilherme G. Piccoli
2021-11-30  5:12   ` Feng Tang [this message]
2021-12-03 15:09     ` Guilherme G. Piccoli
2021-12-19 20:11       ` Luis Chamberlain
2021-12-20 12:38         ` Guilherme G. Piccoli
2021-12-21 23:48           ` Andrew Morton
2021-12-22 12:37             ` Guilherme G. Piccoli
2022-01-13  9:31   ` Petr Mladek
2021-11-09 20:28 ` [PATCH 3/3] panic: Allow printing extra panic information on kdump Guilherme G. Piccoli
2021-12-22 11:45   ` Dave Young
2021-12-22 12:34     ` Guilherme G. Piccoli
2021-12-24  1:35       ` Dave Young
2021-12-25 19:21         ` Guilherme G. Piccoli
2021-12-27  1:45           ` Dave Young
2021-12-27  3:14             ` Guilherme G. Piccoli
2022-01-13  9:02   ` Petr Mladek
2022-01-13 13:00     ` Guilherme G. Piccoli
2022-01-27 16:53     ` Guilherme G. Piccoli
2022-02-08 18:12       ` Guilherme G. Piccoli
2022-02-08 21:39         ` Stephen Rothwell
2022-02-09 15:06           ` Guilherme G. Piccoli
2022-02-09 23:26             ` Stephen Rothwell
2022-02-10 12:50               ` Guilherme G. Piccoli
2021-11-26 21:34 ` [PATCH 0/3] Some improvements on panic_print Guilherme G. Piccoli
2021-12-14 16:31   ` Guilherme G. Piccoli

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=20211130051206.GB89318@shbuild999.sh.intel.com \
    --to=feng.tang@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=gpiccoli@igalia.com \
    --cc=keescook@chromium.org \
    --cc=kernel@gpiccoli.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=siglesias@igalia.com \
    --cc=yzaikin@google.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).