diff options
author | Steven Rostedt (Google) <rostedt@goodmis.org> | 2023-01-04 22:14:12 +0100 |
---|---|---|
committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2023-01-24 17:27:29 +0100 |
commit | 3bb06eb6e9acf7c4a3e1b5bc87aed398ff8e2253 (patch) | |
tree | 87572db01e62df0acc3101e1acb409f6050ed0c6 /fs/afs/misc.c | |
parent | ftrace: Export ftrace_free_filter() to modules (diff) | |
download | linux-3bb06eb6e9acf7c4a3e1b5bc87aed398ff8e2253.tar.xz linux-3bb06eb6e9acf7c4a3e1b5bc87aed398ff8e2253.zip |
tracing: Make sure trace_printk() can output as soon as it can be used
Currently trace_printk() can be used as soon as early_trace_init() is
called from start_kernel(). But if a crash happens, and
"ftrace_dump_on_oops" is set on the kernel command line, all you get will
be:
[ 0.456075] <idle>-0 0dN.2. 347519us : Unknown type 6
[ 0.456075] <idle>-0 0dN.2. 353141us : Unknown type 6
[ 0.456075] <idle>-0 0dN.2. 358684us : Unknown type 6
This is because the trace_printk() event (type 6) hasn't been registered
yet. That gets done via an early_initcall(), which may be early, but not
early enough.
Instead of registering the trace_printk() event (and other ftrace events,
which are not trace events) via an early_initcall(), have them registered at
the same time that trace_printk() can be used. This way, if there is a
crash before early_initcall(), then the trace_printk()s will actually be
useful.
Link: https://lkml.kernel.org/r/20230104161412.019f6c55@gandalf.local.home
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: e725c731e3bb1 ("tracing: Split tracing initialization into two for early initialization")
Reported-by: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Tested-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions