linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] tracing: fprobe-events: Register fprobe only when the event is enabled
@ 2025-03-16 12:21 Masami Hiramatsu (Google)
  2025-03-16 12:21 ` [PATCH 1/4] tracing: tprobe-events: Remove mod field from tprobe-event Masami Hiramatsu (Google)
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Masami Hiramatsu (Google) @ 2025-03-16 12:21 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
	linux-trace-kernel

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) <mhiramat@kernel.org>

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

end of thread, other threads:[~2025-05-09 23:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-16 12:21 [PATCH 0/4] tracing: fprobe-events: Register fprobe only when the event is enabled Masami Hiramatsu (Google)
2025-03-16 12:21 ` [PATCH 1/4] tracing: tprobe-events: Remove mod field from tprobe-event Masami Hiramatsu (Google)
2025-03-16 12:21 ` [PATCH 2/4] tracing: tprobe-events: Support multiple tprobes on the same tracepoint Masami Hiramatsu (Google)
2025-03-25 17:06   ` Steven Rostedt
2025-03-25 22:08     ` Masami Hiramatsu
2025-03-29 13:35       ` Masami Hiramatsu
2025-03-16 12:21 ` [PATCH 3/4] tracing: fprobe-events: Register fprobe-events only when it is enabled Masami Hiramatsu (Google)
2025-03-25 18:41   ` Steven Rostedt
2025-03-25 21:56     ` Masami Hiramatsu
2025-03-16 12:21 ` [PATCH 4/4] selftests: tracing: Enable fprobe events before checking enable_functions Masami Hiramatsu (Google)
2025-03-25 18:42   ` Steven Rostedt
2025-03-25 21:47     ` Masami Hiramatsu
2025-03-17  8:03 ` [RFC PATCH] tracing: tprobe-events: Register tracepoint when enable tprobe event Masami Hiramatsu (Google)
2025-03-17  8:10   ` Masami Hiramatsu
2025-05-01 15:27   ` Steven Rostedt
2025-05-09 23:41     ` Masami Hiramatsu

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).