[PATCH v2 08/13] tracing: Improve panic/die notifiers

Steven Rostedt rostedt at goodmis.org
Tue Aug 16 07:14:45 PDT 2022


On Tue, 19 Jul 2022 16:53:21 -0300
"Guilherme G. Piccoli" <gpiccoli at igalia.com> wrote:


Sorry for the late review, but this fell to the bottom of my queue :-/

> +/*
> + * 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;

I really hate gotos that are not for clean ups.

> +
> +	ftrace_dump(ftrace_dump_on_oops);
> +
> +out:
> +	return NOTIFY_DONE;
> +}
> +

Just do:

static int trace_die_panic_handler(struct notifier_block *self,
				unsigned long ev, void *unused)
{
	if (!ftrace_dump_on_oops)
		return NOTIFY_DONE;

	/* The die notifier requires DIE_OOPS to trigger */
	if (self == &trace_die_notifier && ev != DIE_OOPS)
		return NOTIFY_DONE;

	ftrace_dump(ftrace_dump_on_oops);

	return NOTIFY_DONE;
}


Thanks,

Other than that, Acked-by: Steven Rostedt (Google) <rostedt at goodmis.org>

-- Steve



More information about the kexec mailing list