linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/21] tracing/probe: Add multi-probes per event support
@ 2019-05-31 15:16 Masami Hiramatsu
  2019-05-31 15:16 ` [PATCH 01/21] tracing/kprobe: Set print format right after parsed command Masami Hiramatsu
                   ` (20 more replies)
  0 siblings, 21 replies; 31+ messages in thread
From: Masami Hiramatsu @ 2019-05-31 15:16 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Masami Hiramatsu, Ingo Molnar, linux-kernel, Tom Zanussi,
	Ravi Bangoria, Namhyung Kim, Arnaldo Carvalho de Melo

Hello,

This is a series to add multi-probes per event support to probe-event.

For trace-event, we can insert same trace-event on several places
on the code, and those can record similar information as a same event
with same format.

This series implements similar feature on probe-event. Since the probe
event is based on the compiled binary, sometimes we find that the target
source line is complied into several different addresses, e.g. inlined
function, unrolled loop, etc. In those cases, it is useful to put a
same probe-event on different addresses.

With this series, we can append multi probes on one event as below

  # echo p:testevent _do_fork r1=%ax r2=%dx > kprobe_events
  # echo p:testevent fork_idle r1=%ax r2=%cx >> kprobe_events
  # kprobe_events
  p:kprobes/testevent _do_fork r1=%ax r2=%dx
  p:kprobes/testevent fork_idle r1=%ax r2=%cx

This means testevent is hit on both of _do_fork and fork_idle.
As you can see, the appended event must have same number of arguments
and those must have same 'type' and 'name' as original one. This is like
a function signature, it checks whether the appending event has the same
type and name of event arguments and same probe type, but doesn't care
about the assignment.

So, below appending commands will be rejected.

  # echo p:testevent _do_fork r1=%ax r2=%dx > kprobe_events
  # echo p:testevent fork_idle r1=%ax >> kprobe_events
  (No 2nd argument)
  # echo p:testevent fork_idle r1=%ax r2=%ax:x8 >> kprobe_events
  (The type of 2nd argument is different)

If one inlined code has an argument on a register, but another
inlined code has fixed value (as a result of optimization),
you can also specify the fixed immediate value, e.g.

  # echo p:testevent _do_fork r1=%ax r2=%dx > kprobe_events
  # echo p:testevent fork_idle r1=%ax r2=\1 >> kprobe_events

Of course, it is hard to find those assignment changes by manual.
I'm preparing another series of patches for perf-probe, which will
automatically find such "cloned" targets and fold those into one
event.
(Should I merge that series into this series?)

Thank you,

---

Masami Hiramatsu (21):
      tracing/kprobe: Set print format right after parsed command
      tracing/uprobe: Set print format when parsing command
      tracing/probe: Add trace_probe init and free functions
      tracing/probe: Add trace_event_call register API for trace_probe
      tracing/probe: Add trace_event_file access APIs for trace_probe
      tracing/probe: Add trace flag access APIs for trace_probe
      tracing/probe: Add probe event name and group name accesses APIs
      tracing/probe: Add trace_event_call accesses APIs
      tracing/kprobe: Check registered state using kprobe
      tracing/probe: Split trace_event related data from trace_probe
      tracing/dynevent: Delete all matched events
      tracing/dynevent: Pass extra arguments to match operation
      tracing/kprobe: Add multi-probe per event support
      tracing/uprobe: Add multi-probe per uprobe event support
      tracing/kprobe: Add per-probe delete from event
      tracing/uprobe: Add per-probe delete from event
      tracing/probe: Add immediate parameter support
      tracing/probe: Add immediate string parameter support
      selftests/ftrace: Add a testcase for kprobe multiprobe event
      selftests/ftrace: Add syntax error test for immediates
      selftests/ftrace: Add syntax error test for multiprobe


 Documentation/trace/kprobetrace.rst                |    1 
 Documentation/trace/uprobetracer.rst               |    1 
 kernel/trace/trace.c                               |    8 
 kernel/trace/trace_dynevent.c                      |   10 
 kernel/trace/trace_dynevent.h                      |    7 
 kernel/trace/trace_events_hist.c                   |    4 
 kernel/trace/trace_kprobe.c                        |  408 +++++++++++---------
 kernel/trace/trace_probe.c                         |  247 ++++++++++++
 kernel/trace/trace_probe.h                         |  121 +++++-
 kernel/trace/trace_uprobe.c                        |  358 ++++++++++--------
 tools/testing/selftests/ftrace/test.d/functions    |    2 
 .../ftrace/test.d/kprobe/kprobe_multiprobe.tc      |   35 ++
 .../ftrace/test.d/kprobe/kprobe_syntax_errors.tc   |   15 +
 13 files changed, 830 insertions(+), 387 deletions(-)
 create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_multiprobe.tc

--
Masami Hiramatsu (Linaro) <mhiramat@kernel.org>

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

end of thread, other threads:[~2019-06-19  9:19 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31 15:16 [PATCH 00/21] tracing/probe: Add multi-probes per event support Masami Hiramatsu
2019-05-31 15:16 ` [PATCH 01/21] tracing/kprobe: Set print format right after parsed command Masami Hiramatsu
2019-05-31 15:16 ` [PATCH 02/21] tracing/uprobe: Set print format when parsing command Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 03/21] tracing/probe: Add trace_probe init and free functions Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 04/21] tracing/probe: Add trace_event_call register API for trace_probe Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 05/21] tracing/probe: Add trace_event_file access APIs " Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 06/21] tracing/probe: Add trace flag " Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 07/21] tracing/probe: Add probe event name and group name accesses APIs Masami Hiramatsu
2019-05-31 15:17 ` [PATCH 08/21] tracing/probe: Add trace_event_call " Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 09/21] tracing/kprobe: Check registered state using kprobe Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 10/21] tracing/probe: Split trace_event related data from trace_probe Masami Hiramatsu
2019-06-18  1:56   ` Steven Rostedt
2019-06-18 16:14     ` Masami Hiramatsu
2019-06-18 16:23       ` Steven Rostedt
2019-06-18 21:11         ` Steven Rostedt
2019-06-19  2:28           ` Masami Hiramatsu
2019-06-19  9:19             ` Steven Rostedt
2019-06-19  1:11         ` Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 11/21] tracing/dynevent: Delete all matched events Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 12/21] tracing/dynevent: Pass extra arguments to match operation Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 13/21] tracing/kprobe: Add multi-probe per event support Masami Hiramatsu
2019-05-31 15:18 ` [PATCH 14/21] tracing/uprobe: Add multi-probe per uprobe " Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 15/21] tracing/kprobe: Add per-probe delete from event Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 16/21] tracing/uprobe: " Masami Hiramatsu
2019-06-18  2:16   ` Steven Rostedt
2019-06-18 16:18     ` Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 17/21] tracing/probe: Add immediate parameter support Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 18/21] tracing/probe: Add immediate string " Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 19/21] selftests/ftrace: Add a testcase for kprobe multiprobe event Masami Hiramatsu
2019-05-31 15:19 ` [PATCH 20/21] selftests/ftrace: Add syntax error test for immediates Masami Hiramatsu
2019-05-31 15:20 ` [PATCH 21/21] selftests/ftrace: Add syntax error test for multiprobe 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).