tracing: Allow the top level trace_marker to write into another instances
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 8 May 2025 13:56:39 +0000 (09:56 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 9 May 2025 19:19:11 +0000 (15:19 -0400)
commit7b382efd5e8af4c0c67e70ad3fb599dcd2dc0b86
treeaeaffefb516cc9edc88275c4a19a524cead16334
parent6956ea9fdcf706dc6201bf7146af188539eac9b1
tracing: Allow the top level trace_marker to write into another instances

There are applications that have it hard coded to write into the top level
trace_marker instance (/sys/kernel/tracing/trace_marker). This can be
annoying if a profiler is using that instance for other work, or if it
needs all writes to go into a new instance.

A new option is created called "copy_trace_marker". By default, the top
level has this set, as that is the default buffer that writing into the
top level trace_marker file will go to. But now if an instance is created
and sets this option, all writes into the top level trace_marker will also
be written into that instance buffer just as if an application were to
write into the instance's trace_marker file.

If the top level instance disables this option, then writes to its own
trace_marker and trace_marker_raw files will not go into its buffer.

If no instance has this option set, then the write will return an error
and errno will contain ENODEV.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/20250508095639.39f84eda@gandalf.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Documentation/trace/ftrace.rst
kernel/trace/trace.c
kernel/trace/trace.h