[PATCH v7 00/10] tracing: Creation of event probe

From: Steven Rostedt
Date: Thu Aug 19 2021 - 00:18:45 EST


The first 5 patches of this series has had Masami's updates as well as his
acks, and will no longer be in future series, as I'll be pushing them into
my linux-next queue.

Patch 6 received an ack from Masami, but I updated it, by pulling more out
of the old patch 7 and into that patch, adding more of the enum logic into
the internal processing of the set_print_fmt() code. This way, it adds the
switch statement, such that the addition of the eprobe only needs to add a
new case.

I pulled out the code from the old patch 7 that converts the parameter for
process_fetch_insn() regs into a void pointer called rec. I figured that
should be a separate patch as it's more set up for the eprobe code, then
having to do with the eprobe code itself.

For the eprobe code, I incorporated more of Masami's comments as well as
found some minor bugs. Those updates were:

Masami's suggestions:

- Remove "return" for void function calls in trace_event_put_ref()
- Used bit mask over checking separate bits of flags one at a time.
- Check for duplicate eprobes.

Fixes:

- Check for NULL pointer for probe_cleanup as there was an error path that
could call it with a NULL pointer.
- Check on create that it's for an eprobe (check for 'e'). Was breaking
updates to kprobes and uprobes that were added by dynamic_events.
- Add paranoid check of by enum to print_fmt call.
- Fixed error_log ^ index handling

Other updates:

- Updated the README to include eprobes
- Added clear_dynamic_events() to selftests, to remove them even when
there's a dependency between them.
- Added a selftest to test the eprobes.


Steven Rostedt (VMware) (9):
tracing: Add DYNAMIC flag for dynamic events
tracing: Have dynamic events have a ref counter
tracing/probe: Have traceprobe_parse_probe_arg() take a const arg
tracing/probes: Allow for dot delimiter as well as slash for system names
tracing/probes: Use struct_size() instead of defining custom macros
tracing/probe: Change traceprobe_set_print_fmt() to take a type
tracing/probes: Have process_fetch_insn() take a void * instead of pt_regs
selftests/ftrace: Add clear_dynamic_events() to test cases
selftests/ftrace: Add selftest for testing eprobe events

Tzvetomir Stoyanov (VMware) (1):
tracing: Add a probe that attaches to trace events

----
include/linux/trace_events.h | 52 +-
kernel/trace/Makefile | 1 +
kernel/trace/trace.c | 9 +-
kernel/trace/trace.h | 18 +
kernel/trace/trace_dynevent.c | 38 +
kernel/trace/trace_dynevent.h | 4 +-
kernel/trace/trace_eprobe.c | 932 +++++++++++++++++++++
kernel/trace/trace_event_perf.c | 6 +-
kernel/trace/trace_events.c | 22 +-
kernel/trace/trace_events_synth.c | 21 +-
kernel/trace/trace_events_trigger.c | 20 +-
kernel/trace/trace_kprobe.c | 43 +-
kernel/trace/trace_probe.c | 84 +-
kernel/trace/trace_probe.h | 15 +-
kernel/trace/trace_probe_tmpl.h | 6 +-
kernel/trace/trace_uprobe.c | 34 +-
.../ftrace/test.d/dynevent/add_remove_eprobe.tc | 53 ++
tools/testing/selftests/ftrace/test.d/functions | 22 +
18 files changed, 1275 insertions(+), 105 deletions(-)
create mode 100644 kernel/trace/trace_eprobe.c
create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/add_remove_eprobe.tc