[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250116143334.073917300@goodmis.org>
Date: Thu, 16 Jan 2025 09:33:34 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Cc: Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Andrew Morton <akpm@...ux-foundation.org>,
jochensp@...hen.sprickerhof.de,
peter.griffin@...aro.org
Subject: [PATCH 0/3] tracing: Add ':mod:' command to set_event to enable events in modules
I was asked if there was a way to enable events for a module on boot
up. Unfortunately there currently isn't a way to do so. I decided to
added the ":mod:" feature that set_ftrace_filter has to the set_event
file as well as to the kernel command line (which uses the same code
as what the set_event file takes).
Now you can enable events for a given module without having to know
what events that module has.
echo ':mod:<module' > set_event
You can enable some events or event systems for a module too:
echo '<system>:<event>:mod:<module>' > set_event
Where either <system> or <event> can be missing or "*".
For the following:
echo '<match>:mod:<module>' > set_event
It will enable any system or event that has the name <match>.
If the module is not loaded, then the string is saved, and when the
module is loaded, it will be executed on that module before the module
executes. This means any module event that is called in its init
functions will also be traced.
This works on the kernel command line as well:
trace_event=:mod:<module>
Will enable all the events for <module> when it is loaded.
I also added a thorough test to test this feature, although it doest
obviously test the kernel command line.
This is based on top of
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/for-next
Steven Rostedt (3):
tracing: Add ':mod:' command to enabled module events
tracing: Cache ":mod:" events for modules not loaded yet
selftests/ftrace: Add test that tests event :mod: commands
----
Documentation/admin-guide/kernel-parameters.txt | 8 +
Documentation/trace/events.rst | 24 ++
kernel/trace/ftrace.c | 17 --
kernel/trace/trace.c | 28 ++
kernel/trace/trace.h | 12 +
kernel/trace/trace_events.c | 300 +++++++++++++++++++--
.../selftests/ftrace/test.d/event/event-mod.tc | 192 +++++++++++++
7 files changed, 540 insertions(+), 41 deletions(-)
create mode 100644 tools/testing/selftests/ftrace/test.d/event/event-mod.tc
Powered by blists - more mailing lists