tracing: Cache ":mod:" events for modules not loaded yet
authorSteven Rostedt <rostedt@goodmis.org>
Thu, 16 Jan 2025 14:33:36 +0000 (09:33 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Thu, 16 Jan 2025 14:41:08 +0000 (09:41 -0500)
commitb355247df104ef6644288884afd2c08b7bf49897
tree406357f21e131a66d537375f882cb6d91c247c2d
parent4c86bc531e60900053384867c082675bba82c29f
tracing: Cache ":mod:" events for modules not loaded yet

When the :mod: command is written into /sys/kernel/tracing/set_event (or
that file within an instance), if the module specified after the ":mod:"
is not yet loaded, it will store that string internally. When the module
is loaded, it will enable the events as if the module was loaded when the
string was written into the set_event file.

This can also be useful to enable events that are in the init section of
the module, as the events are enabled before the init section is executed.

This also works on the kernel command line:

 trace_event=:mod:<module>

Will enable the events for <module> when it is loaded.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lore.kernel.org/20250116143533.514730995@goodmis.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Documentation/admin-guide/kernel-parameters.txt
Documentation/trace/events.rst
kernel/trace/ftrace.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events.c