linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] tracing: Add ':mod:' command to set_event to enable events in modules
@ 2025-01-16 14:33 Steven Rostedt
  2025-01-16 14:33 ` [PATCH 1/3] tracing: Add :mod: command to enabled module events Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Steven Rostedt @ 2025-01-16 14:33 UTC (permalink / raw)
  To: linux-kernel, linux-trace-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	jochensp, peter.griffin


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-16 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-16 14:33 [PATCH 0/3] tracing: Add ':mod:' command to set_event to enable events in modules Steven Rostedt
2025-01-16 14:33 ` [PATCH 1/3] tracing: Add :mod: command to enabled module events Steven Rostedt
2025-01-16 14:33 ` [PATCH 2/3] tracing: Cache ":mod:" events for modules not loaded yet Steven Rostedt
2025-01-16 14:33 ` [PATCH 3/3] selftests/ftrace: Add test that tests event :mod: commands Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).