Re: [PATCH V2] panic: Add sysctl/cmdline to dump all CPUs backtraces on oops event

From: Randy Dunlap
Date: Mon Mar 23 2020 - 19:40:06 EST


Hi-
(same)

On 3/23/20 3:30 PM, Guilherme G. Piccoli wrote:

>
> V2: Implemented grammar suggestions from Randy, Andrew and
> Matthew. Thanks in advance for the reviews!
> Cheers,
>
> Guilherme
>
>
> .../admin-guide/kernel-parameters.txt | 8 +++++++
> Documentation/admin-guide/sysctl/kernel.rst | 17 +++++++++++++++
> include/linux/kernel.h | 6 ++++++
> kernel/panic.c | 21 +++++++++++++++++++
> kernel/sysctl.c | 11 ++++++++++
> 5 files changed, 63 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index 7a14caac6c94..7db622028c00 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3333,6 +3333,14 @@
> This will also cause panics on machine check exceptions.
> Useful together with panic=30 to trigger a reboot.
>
> + oops_all_cpu_backtrace=
> + [KNL] Should kernel generate backtraces on all cpus

CPUs

> + when oops occurs - this should be a last measure resort
> + in case a kdump cannot be collected, for example.
> + Defaults to 0 and can be controlled by the sysctl
> + kernel.oops_all_cpu_backtrace.
> + Format: <integer>
> +
> page_alloc.shuffle=
> [KNL] Boolean flag to control whether the page allocator
> should randomize its free lists. The randomization may
> diff --git a/Documentation/admin-guide/sysctl/kernel.rst b/Documentation/admin-guide/sysctl/kernel.rst
> index 8b4ff69d2348..8660001d3a3e 100644
> --- a/Documentation/admin-guide/sysctl/kernel.rst
> +++ b/Documentation/admin-guide/sysctl/kernel.rst
> @@ -57,6 +57,7 @@ show up in /proc/sys/kernel:
> - msgmnb
> - msgmni
> - nmi_watchdog
> +- oops_all_cpu_backtrace
> - osrelease
> - ostype
> - overflowgid
> @@ -572,6 +573,22 @@ numa_balancing_scan_size_mb is how many megabytes worth of pages are
> scanned for a given scan.
>
>
> +oops_all_cpu_backtrace:
> +================
> +
> +If this option is set, the kernel will send an NMI to all CPUs to dump
> +their backtraces when an oops event occurs. It should be used as a last
> +resort in case a panic cannot be triggered (to protect VMs running, for
> +example) or kdump can't be collected. This file shows up if CONFIG_SMP
> +is enabled.
> +
> +0: Won't show all CPUs backtraces when an oops is detected.
> +This is the default behavior.
> +
> +1: Will non-maskably interrupt all CPUs and dump their backtraces when
> +an oops event is detected.
> +
> +
> osrelease, ostype & version:
> ============================
>
thanks.

--
~Randy