mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
tracing: Fix ftrace_boot_snapshot command line logic
The kernel command line ftrace_boot_snapshot by itself is supposed to
trigger a snapshot at the end of boot up of the main top level trace
buffer. A ftrace_boot_snapshot=foo will do the same for an instance called
foo that was created by trace_instance=foo,...
The logic was broken where if ftrace_boot_snapshot was by itself, it would
trigger a snapshot for all instances that had tracing enabled, regardless
if it asked for a snapshot or not.
When a snapshot is requested for a buffer, the buffer's
tr->allocated_snapshot is set to true. Use that to know if a trace buffer
wants a snapshot at boot up or not.
Since the top level buffer is part of the ftrace_trace_arrays list,
there's no reason to treat it differently than the other buffers. Just
iterate the list if ftrace_boot_snapshot was specified.
Link: https://lkml.kernel.org/r/20230405022341.895334039@goodmis.org
Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ross Zwisler <zwisler@google.com>
Fixes: 9c1c251d67
("tracing: Allow boot instances to have snapshot buffers")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
This commit is contained in:
parent
9d52727f80
commit
e94891641c
1 changed files with 7 additions and 6 deletions
|
@ -10393,19 +10393,20 @@ out:
|
||||||
|
|
||||||
void __init ftrace_boot_snapshot(void)
|
void __init ftrace_boot_snapshot(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_TRACER_MAX_TRACE
|
||||||
struct trace_array *tr;
|
struct trace_array *tr;
|
||||||
|
|
||||||
if (snapshot_at_boot) {
|
if (!snapshot_at_boot)
|
||||||
tracing_snapshot();
|
return;
|
||||||
internal_trace_puts("** Boot snapshot taken **\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
|
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
|
||||||
if (tr == &global_trace)
|
if (!tr->allocated_snapshot)
|
||||||
continue;
|
continue;
|
||||||
trace_array_puts(tr, "** Boot snapshot taken **\n");
|
|
||||||
tracing_snapshot_instance(tr);
|
tracing_snapshot_instance(tr);
|
||||||
|
trace_array_puts(tr, "** Boot snapshot taken **\n");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void __init early_trace_init(void)
|
void __init early_trace_init(void)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue