Skip to content

Commit 6d02eef

Browse files
committed
tracing: Fix ifdef of snapshots to not prevent last_boot_info file
The mapping of the ring buffer to memory allocated at boot up will also expose a "last_boot_info" to help tooling to read the raw data from the last boot. As instances that have their ring buffer mapped to fixed memory cannot perform snapshots, they can either have the "snapshot" file or the "last_boot_info" file, but not both. The code that added the "last_boot_info" file failed to notice that the "snapshot" creation was inside a "#ifdef CONFIG_TRACER_SNAPSHOT" and incorrectly placed the creation of the "last_boot_info" file within the ifdef block. Not only does it cause a warning when CONFIG_TRACER_SNAPSHOT is not enabled, it also incorrectly prevents the file from appearing. Link: https://lore.kernel.org/all/[email protected]/ Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Reported-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 7a1d1e4 ("tracing/ring-buffer: Add last_boot_info file to boot instance") Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent ee057c8 commit 6d02eef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/trace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9828,15 +9828,15 @@ init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
98289828
if (ftrace_create_function_files(tr, d_tracer))
98299829
MEM_FAIL(1, "Could not allocate function filter files");
98309830

9831-
#ifdef CONFIG_TRACER_SNAPSHOT
98329831
if (tr->range_addr_start) {
98339832
trace_create_file("last_boot_info", TRACE_MODE_READ, d_tracer,
98349833
tr, &last_boot_fops);
9834+
#ifdef CONFIG_TRACER_SNAPSHOT
98359835
} else {
98369836
trace_create_file("snapshot", TRACE_MODE_WRITE, d_tracer,
98379837
tr, &snapshot_fops);
9838-
}
98399838
#endif
9839+
}
98409840

98419841
trace_create_file("error_log", TRACE_MODE_WRITE, d_tracer,
98429842
tr, &tracing_err_log_fops);

0 commit comments

Comments
 (0)