Skip to content

tracing: Add ':mod:' command to set_event to enable events in modules

Steven Rostedt linux-kselftest linux-trace-kernel lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3tracing: Add :mod: command to enabled module eventsDocumentation/trace/events.rst kernel/trace/trace.c kernel/trace/trace_events.c+70 -130 replies
2/3tracing: Cache ":mod:" events for modules not loaded yetDocumentation/admin-guide/kernel-parameters.txt Documentation/trace/events.rst kernel/trace/ftrace.c +3 more+279 -290 replies
3/3selftests/ftrace: Add test that tests event :mod: commandstools/testing/selftests/ftrace/test.d/event/event-mod.tc+192 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [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