Skip to content

Commit ac5e916

Browse files
rostedtintel-lab-lkp
authored andcommitted
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. Cc: stable@vger.kernel.org Fixes: 9c1c251 ("tracing: Allow boot instances to have snapshot buffers") Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent b4f8604 commit ac5e916

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

kernel/trace/trace.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10395,16 +10395,15 @@ void __init ftrace_boot_snapshot(void)
1039510395
{
1039610396
struct trace_array *tr;
1039710397

10398-
if (snapshot_at_boot) {
10399-
tracing_snapshot();
10400-
internal_trace_puts("** Boot snapshot taken **\n");
10401-
}
10398+
if (!snapshot_at_boot)
10399+
return;
1040210400

1040310401
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
10404-
if (tr == &global_trace)
10402+
if (!tr->allocated_snapshot)
1040510403
continue;
10406-
trace_array_puts(tr, "** Boot snapshot taken **\n");
10404+
1040710405
tracing_snapshot_instance(tr);
10406+
trace_array_puts(tr, "** Boot snapshot taken **\n");
1040810407
}
1040910408
}
1041010409

0 commit comments

Comments
 (0)