From: Baoquan He <bhe@redhat.com>
To: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: akpm@linux-foundation.org, pmladek@suse.com,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-hyperv@vger.kernel.org, netdev@vger.kernel.org,
x86@kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net,
halves@canonical.com, fabiomirmar@gmail.com,
alejandro.j.jimenez@oracle.com,
andriy.shevchenko@linux.intel.com, arnd@arndb.de, bp@alien8.de,
corbet@lwn.net, d.hatayama@jp.fujitsu.com,
dave.hansen@linux.intel.com, dyoung@redhat.com,
feng.tang@intel.com, gregkh@linuxfoundation.org,
mikelley@microsoft.com, hidehiro.kawai.ez@hitachi.com,
jgross@suse.com, john.ogness@linutronix.de,
keescook@chromium.org, luto@kernel.org, mhiramat@kernel.org,
mingo@redhat.com, paulmck@kernel.org, peterz@infradead.org,
rostedt@goodmis.org, senozhatsky@chromium.org,
stern@rowland.harvard.edu, tglx@linutronix.de, vgoyal@redhat.com,
vkuznets@redhat.com, will@kernel.org,
Sergei Shtylyov <sergei.shtylyov@gmail.com>
Subject: Re: [PATCH v2 08/13] tracing: Improve panic/die notifiers
Date: Wed, 3 Aug 2022 17:36:54 +0800 [thread overview]
Message-ID: <YupBtiVkrmE7YQnr@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20220719195325.402745-9-gpiccoli@igalia.com>
On 07/19/22 at 04:53pm, Guilherme G. Piccoli wrote:
> Currently the tracing dump_on_oops feature is implemented
> through separate notifiers, one for die/oops and the other
> for panic - given they have the same functionality, let's
> unify them.
>
> Also improve the function comment and change the priority of
> the notifier to make it execute earlier, avoiding showing useless
> trace data (like the callback names for the other notifiers);
> finally, we also removed an unnecessary header inclusion.
>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Sergei Shtylyov <sergei.shtylyov@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
>
> ---
>
> V2:
> - Different approach; instead of using IDs to distinguish die and
> panic events, rely on address comparison like other notifiers do
> and as per Petr's suggestion;
>
> - Removed ACK from Steven since the code changed.
>
> kernel/trace/trace.c | 55 ++++++++++++++++++++++----------------------
> 1 file changed, 27 insertions(+), 28 deletions(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index b8dd54627075..2a436b645c70 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -19,7 +19,6 @@
> #include <linux/kallsyms.h>
> #include <linux/security.h>
> #include <linux/seq_file.h>
> -#include <linux/notifier.h>
> #include <linux/irqflags.h>
> #include <linux/debugfs.h>
> #include <linux/tracefs.h>
> @@ -9777,40 +9776,40 @@ static __init int tracer_init_tracefs(void)
>
> fs_initcall(tracer_init_tracefs);
>
> -static int trace_panic_handler(struct notifier_block *this,
> - unsigned long event, void *unused)
> -{
> - if (ftrace_dump_on_oops)
> - ftrace_dump(ftrace_dump_on_oops);
> - return NOTIFY_OK;
> -}
> +static int trace_die_panic_handler(struct notifier_block *self,
> + unsigned long ev, void *unused);
>
> static struct notifier_block trace_panic_notifier = {
> - .notifier_call = trace_panic_handler,
> - .next = NULL,
> - .priority = 150 /* priority: INT_MAX >= x >= 0 */
> + .notifier_call = trace_die_panic_handler,
> + .priority = INT_MAX - 1,
> };
>
> -static int trace_die_handler(struct notifier_block *self,
> - unsigned long val,
> - void *data)
> -{
> - switch (val) {
> - case DIE_OOPS:
> - if (ftrace_dump_on_oops)
> - ftrace_dump(ftrace_dump_on_oops);
> - break;
> - default:
> - break;
> - }
> - return NOTIFY_OK;
> -}
> -
> static struct notifier_block trace_die_notifier = {
> - .notifier_call = trace_die_handler,
> - .priority = 200
> + .notifier_call = trace_die_panic_handler,
> + .priority = INT_MAX - 1,
> };
>
> +/*
> + * The idea is to execute the following die/panic callback early, in order
> + * to avoid showing irrelevant information in the trace (like other panic
> + * notifier functions); we are the 2nd to run, after hung_task/rcu_stall
> + * warnings get disabled (to prevent potential log flooding).
> + */
> +static int trace_die_panic_handler(struct notifier_block *self,
> + unsigned long ev, void *unused)
> +{
> + if (!ftrace_dump_on_oops)
> + goto out;
> +
> + if (self == &trace_die_notifier && ev != DIE_OOPS)
> + goto out;
Although the switch-case code of original trace_die_handler() is werid,
this unification is not much more comfortable. Just personal feeling
from code style, not strong opinion. Leave it to trace reviewers.
> +
> + ftrace_dump(ftrace_dump_on_oops);
> +
> +out:
> + return NOTIFY_DONE;
> +}
> +
> /*
> * printk is set to max of 1024, we really don't need it that big.
> * Nothing should be printing 1000 characters anyway.
> --
> 2.37.1
>
next prev parent reply other threads:[~2022-08-03 9:37 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-19 19:53 [PATCH v2 00/13] The panic notifiers refactor strikes back - fixes/clean-ups Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 01/13] ARM: Disable FIQs (but not IRQs) on CPUs shutdown paths Guilherme G. Piccoli
2022-08-07 15:35 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 02/13] notifier: Add panic notifiers info and purge trailing whitespaces Guilherme G. Piccoli
2022-08-03 9:21 ` Baoquan He
2022-07-19 19:53 ` [PATCH v2 03/13] firmware: google: Test spinlock on panic path to avoid lockups Guilherme G. Piccoli
2022-08-07 15:38 ` Guilherme G. Piccoli
2022-08-08 5:07 ` Evan Green
2022-08-08 15:14 ` Guilherme G. Piccoli
2022-08-08 15:26 ` Greg Kroah-Hartman
2022-08-08 15:37 ` Guilherme G. Piccoli
2022-08-10 12:54 ` Greg Kroah-Hartman
2022-07-19 19:53 ` [PATCH v2 04/13] soc: bcm: brcmstb: Document panic notifier action and remove useless header Guilherme G. Piccoli
2022-07-20 23:00 ` Florian Fainelli
2022-07-21 13:17 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 05/13] alpha: Clean-up the panic notifier code Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 06/13] um: Improve panic notifiers consistency and ordering Guilherme G. Piccoli
2022-08-07 15:40 ` Guilherme G. Piccoli
2022-08-09 18:09 ` Johannes Berg
2022-08-09 19:03 ` Guilherme G. Piccoli
2022-08-09 19:08 ` Johannes Berg
2022-08-09 19:45 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 07/13] parisc: Replace regular spinlock with spin_trylock on panic path Guilherme G. Piccoli
2022-07-20 1:43 ` Jeroen Roovers
2022-07-21 13:19 ` Guilherme G. Piccoli
2022-07-21 13:45 ` Helge Deller
2022-07-21 14:00 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 08/13] tracing: Improve panic/die notifiers Guilherme G. Piccoli
2022-08-03 9:36 ` Baoquan He [this message]
2022-08-03 9:52 ` Baoquan He
2022-08-03 11:44 ` Guilherme G. Piccoli
2022-08-07 15:46 ` Guilherme G. Piccoli
2022-08-16 14:14 ` Steven Rostedt
2022-08-16 14:57 ` Alan Stern
2022-08-16 15:52 ` Steven Rostedt
2022-08-16 20:12 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 09/13] notifier: Show function names on notifier routines if DEBUG_NOTIFIERS is set Guilherme G. Piccoli
2022-07-19 20:33 ` Arjan van de Ven
2022-07-19 20:44 ` Guilherme G. Piccoli
2022-07-19 20:48 ` Arjan van de Ven
2022-07-19 21:00 ` Guilherme G. Piccoli
2022-07-19 22:04 ` Arjan van de Ven
2022-07-21 13:20 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 10/13] EDAC/altera: Skip the panic notifier if kdump is loaded Guilherme G. Piccoli
2022-08-07 15:48 ` Guilherme G. Piccoli
2022-08-16 18:44 ` Dinh Nguyen
2022-08-16 20:16 ` Guilherme G. Piccoli
2022-08-17 17:31 ` Borislav Petkov
2022-08-17 18:45 ` Guilherme G. Piccoli
2022-08-17 19:34 ` Borislav Petkov
2022-08-17 20:28 ` Guilherme G. Piccoli
2022-08-17 21:02 ` Borislav Petkov
2022-08-17 21:39 ` Guilherme G. Piccoli
2022-08-17 21:46 ` Borislav Petkov
2022-08-17 21:56 ` Guilherme G. Piccoli
2022-08-17 22:00 ` Borislav Petkov
2022-08-17 22:09 ` Guilherme G. Piccoli
2022-08-17 22:19 ` Borislav Petkov
2022-08-17 22:49 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 11/13] video/hyperv_fb: Avoid taking busy spinlock on panic path Guilherme G. Piccoli
2022-07-25 18:09 ` Michael Kelley (LINUX)
2022-07-25 22:05 ` Guilherme G. Piccoli
2022-07-19 19:53 ` [PATCH v2 12/13] drivers/hv/vmbus, video/hyperv_fb: Untangle and refactor Hyper-V panic notifiers Guilherme G. Piccoli
2022-07-25 18:55 ` Michael Kelley (LINUX)
2022-07-19 19:53 ` [PATCH v2 13/13] panic: Fixes the panic_print NMI backtrace setting 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=YupBtiVkrmE7YQnr@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alejandro.j.jimenez@oracle.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=d.hatayama@jp.fujitsu.com \
--cc=dave.hansen@linux.intel.com \
--cc=dyoung@redhat.com \
--cc=fabiomirmar@gmail.com \
--cc=feng.tang@intel.com \
--cc=gpiccoli@igalia.com \
--cc=gregkh@linuxfoundation.org \
--cc=halves@canonical.com \
--cc=hidehiro.kawai.ez@hitachi.com \
--cc=jgross@suse.com \
--cc=john.ogness@linutronix.de \
--cc=keescook@chromium.org \
--cc=kernel-dev@igalia.com \
--cc=kernel@gpiccoli.net \
--cc=kexec@lists.infradead.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mikelley@microsoft.com \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=sergei.shtylyov@gmail.com \
--cc=stern@rowland.harvard.edu \
--cc=tglx@linutronix.de \
--cc=vgoyal@redhat.com \
--cc=vkuznets@redhat.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/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).