Skip to content

tracing: fprobe-events: Register fprobe only when the event is enabled

Masami Hiramatsu (Google) linux-trace-kernel lkml 1 version In review

Get series with b4
b4 am 174212767109.348872.18231451508464729427.stgit@devnote2

Versions newest first

  1. v1 Latest4 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4tracing: tprobe-events: Remove mod field from tprobe-eventkernel/trace/trace_fprobe.c+1 -80 replies
2/4tracing: tprobe-events: Support multiple tprobes on the same tracepointinclude/linux/module.h kernel/trace/trace_fprobe.c+208 -553 replies
3/4tracing: fprobe-events: Register fprobe-events only when it is enabledinclude/linux/fprobe.h kernel/trace/fprobe.c kernel/trace/trace_fprobe.c+140 -1312 replies
4/4selftests: tracing: Enable fprobe events before checking enable_functionstools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe.tc+19 -112 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/4] tracing: fprobe-events: Register fprobe only when the event is enabled

Hi,
Here is a series of patches to register fprobe only when the fprobe event is enabled. Steve suggested the fprobe-events are always registered when it is defined, even if it is disabled and that makes system overhead. This series registeres the fprobes only when the event is enabled.

NOTE: tracepoint has a AB-BA locking issue[*], so it is still enabled when the event is defined. That should be eventually solved, but it may need more complicated change. Thus this series focuses on registering fprobe when the event is enabled.

(*) AB-BA lock if we enable tracepoint when enabling tprobe event:

[event enable]
__ftrace_event_enable_disable() ----> event_mutex
__regsiter_tracepoint_fprobe()

    find_tracepoint()
      for_each_module_tracepoint() ----> tracepoint_module_list_mutex

[module loading]
prepare_coming_module()
tracepoint_module_notify()

    tracepoint_module_coming() ----> tracepoint_module_list_mutex
      __tracepoint_probe_module_cb() ---> event_mutex 

I have an idea to defer fprobe event enablement when module loading so that we can avoid taking event_mutex in __tracepoint_probe_module_cb(), but it needs to introduce another list of tracepoint_user and another mutex.

Thank you,

---

Masami Hiramatsu (Google) (4):
tracing: tprobe-events: Remove mod field from tprobe-event
tracing: tprobe-events: Support multiple tprobes on the same tracepoint
tracing: fprobe-events: Register fprobe-events only when it is enabled
selftests: tracing: Enable fprobe events before checking enable_functions

 include/linux/fprobe.h                             |    8 
 include/linux/module.h                             |    4 
 kernel/trace/fprobe.c                              |   29 +
 kernel/trace/trace_fprobe.c                        |  490 +++++++++++++-------
 .../ftrace/test.d/dynevent/add_remove_fprobe.tc    |   30 +
 5 files changed, 362 insertions(+), 199 deletions(-)

--
Masami Hiramatsu (Google) <[email protected]>