tracing: Add triggers to trace_marker writes
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest14 patches 12 repliesIn review
- v214 patches 15 repliesSuperseded
- v1 RFC10 patches 10 repliesSuperseded
Changes in v3 from the cover letter
- typo fixes in documentation (Tom Zanussi)
- Rename trigger-trace-marker{-hist} in selftest (Masami Hiramatsu)
- Fix onmatch(sched.sched_waking) (Namhyung Kim)
- Rename test to say trace_marker trigger from event trigger (Steven Rostedt)
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | tracing: Do not reference event data in post call triggersinclude/ kernel/ kernel/ | +5 | 0 replies | |
| 2/14 | tracing: Add __find_event_file() to find event files without restrictionskernel/ kernel/ | +20 | 0 replies | |
| 3/14 | tracing: Have event_trace_init() called by trace_init_tracefs()kernel/ kernel/ kernel/ | +4 | 0 replies | |
| 4/14 | tracing: Add brackets in ftrace event dynamic arrayskernel/ | +1 | 0 replies | |
| 5/14 | tracing: Do not show filter file for ftrace internal eventskernel/ | +6 | 0 replies | |
| 6/14 | tracing: Add trigger file for trace_markers tracefs/ftrace/printkernel/ kernel/ kernel/ +1 more | +29 | 0 replies | |
| 7/14 | tracing: Have zero size length in filter logic be full stringkernel/ | +12 | 0 replies | |
| 8/14 | tracing: Prevent further users of zero size static arrays in trace eventsinclude/ | +1 | 0 replies | |
| 9/14 | tracing: Allow histogram triggers to access ftrace internal eventskernel/ | +1 | 0 replies | |
| 10/14 | tracing: Document trace_marker triggersDocumentation/ Documentation/ Documentation/ | +555 | 0 replies | |
| 10/14 | tracing: Document trace_marker triggersDocumentation/ Documentation/ Documentation/ | +554 | 0 replies | |
| 11/14 | ftrace/selftest: Have the reset_trigger code be a bit more carefultools/ | +18 | 0 replies | |
| 12/14 | ftrace/selftest: Fix reset_trigger() to handle triggers with filterstools/ | +2 | 0 replies | |
| 13/14 | tracing/selftest: Add selftests to test trace_marker histogram triggerstools/ tools/ | +115 | 7 replies | |
| 14/14 | tracing/selftest: Add test to test hist trigger between kernel event and trace_markertools/ | +22 | 4 replies |
Reviews trailers per patch
7 of 15 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Masami Hiramatsu | Tom Zanussi | Namhyung Kim |
|---|---|---|---|
| Series | R-b | ||
| 1/14 | R-b | ||
| 2/14 | |||
| 3/14 | |||
| 4/14 | |||
| 5/14 | |||
| 6/14 | |||
| 7/14 | |||
| 8/14 | |||
| 9/14 | |||
| 10/14 | R-b | ||
| 10/14 | R-b | ||
| 11/14 | A-b | ||
| 12/14 | A-b | ||
| 13/14 | A-b A-b | ||
| 14/14 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v3 00/14] tracing: Add triggers to trace_marker writes
A few people have asked for this in the past, and I finally got around to implementing it. What this does is to allow writes into trace_marker to initiate a trigger.
The trace_marker event is described in:
tracefs/events/ftrace/print
Thus the trigger file is added there:
tracefs/events/ftrace/print/trigger
As there's already a "hist" file there, everything appears to work just like any other trigger to an event. See the last patch for documentation on how to use the triggers to a trace_marker write.
By the way, the patch:
tracing: Prevent further users of zero size static arrays in trace events
May prevent your kernel from building if you include Xen. You will need to add this patch to make it work (or include the git repo below).
http://lkml.kernel.org/r/[email protected]
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
ftrace/core
Head SHA1: dded7b759602085b4bd2c5581f58f6b179912d89
Steven Rostedt (VMware) (14):
tracing: Do not reference event data in post call triggers
tracing: Add __find_event_file() to find event files without restrictions
tracing: Have event_trace_init() called by trace_init_tracefs()
tracing: Add brackets in ftrace event dynamic arrays
tracing: Do not show filter file for ftrace internal events
tracing: Add trigger file for trace_markers tracefs/ftrace/print
tracing: Have zero size length in filter logic be full string
tracing: Prevent further users of zero size static arrays in trace events
tracing: Allow histogram triggers to access ftrace internal events
tracing: Document trace_marker triggers
ftrace/selftest: Have the reset_trigger code be a bit more careful ftrace/selftest: Fix reset_trigger() to handle triggers with filters tracing/selftest: Add selftests to test trace_marker histogram triggers tracing/selftest: Add test to test hist trigger between kernel event and trace_marker
----
Changes since v2:
- typo fixes in documentation (Tom Zanussi)
- Rename trigger-trace-marker{-hist} in selftest (Masami Hiramatsu)
- Fix onmatch(sched.sched_waking) (Namhyung Kim)
- Rename test to say trace_marker trigger from event trigger (Steven Rostedt)
Diff from v2 below.
Documentation/trace/events.rst | 6 +- Documentation/trace/ftrace.rst | 5 + Documentation/trace/histogram.txt | 546 ++++++++++++++++++++- include/linux/trace_events.h | 3 +- include/trace/trace_events.h | 1 + kernel/trace/trace.c | 19 + kernel/trace/trace.h | 9 +- kernel/trace/trace_entries.h | 6 +- kernel/trace/trace_events.c | 36 +- kernel/trace/trace_events_filter.c | 23 +- kernel/trace/trace_events_hist.c | 2 +- kernel/trace/trace_events_trigger.c | 6 +- kernel/trace/trace_export.c | 9 +- tools/testing/selftests/ftrace/test.d/functions | 23 +- .../test.d/trigger/trigger-trace-marker-hist.tc | 49 ++ .../trigger/trigger-trace-marker-synthetic.tc | 88 ++++ 16 files changed, 790 insertions(+), 41 deletions(-) create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc
Documentation/trace/histogram.txt +5 -5
@@ -2005,7 +2005,7 @@ and after it wakes up, something like this: static void traceputs(char *str) { - /* tracemark_fd is the trace_marker file descripto */ + /* tracemark_fd is the trace_marker file descriptor */ if (tracemark_fd < 0) return; /* write the tracemark message */
@@ -2048,7 +2048,7 @@ Now running cyclictest with: Note, the -b 1000 is used just to make --tracemark available. -The we can see the histogram created by this with: +Then we can see the histogram created by this with: # cat events/synthetic/latency/hist # event histogram
@@ -2360,7 +2360,7 @@ kernel with trace_marker. The difference this time is that instead of using the trace_marker to start the latency, the sched_waking event is used, matching the common_pid for the -trace_marker write with the pid that is being worken by sched_waking. +trace_marker write with the pid that is being woken by sched_waking. After running cyclictest again with the same parameters, we now have:
@@ -2535,5 +2535,5 @@ Totals: Dropped: 0 This doesn't tell us any information about how late cyclictest may have -worken up, but it does show us a nice histogram of how long it took from -the time that cyclictest was worken to the time it made it into user space. +woken up, but it does show us a nice histogram of how long it took from +the time that cyclictest was woken to the time it made it into user space.
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-hist.tc renamed from tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker.tc +1 -1
@@ -1,6 +1,6 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -# description: event trigger - test histogram trigger +# description: trace_marker trigger - test histogram trigger # flags: instance do_reset() {
tools/testing/selftests/ftrace/test.d/trigger/trigger-trace-marker-synthetic.tc +2 -2
@@ -1,6 +1,6 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -# description: event trigger - test histogram with synthetic event +# description: trace_marker trigger - test histogram with synthetic event # flags: do_reset() {
@@ -72,7 +72,7 @@ echo "Test histogram kernel event to trace_marker latency histogram trigger" echo 'latency u64 lat' > synthetic_events echo 'hist:keys=pid:ts0=common_timestamp.usecs' > events/sched/sched_waking/trigger -echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(ftrace.print).latency($lat)' > events/ftrace/print/trigger +echo 'hist:keys=common_pid:lat=common_timestamp.usecs-$ts0:onmatch(sched.sched_waking).latency($lat)' > events/ftrace/print/trigger echo 'hist:keys=common_pid,lat:sort=lat' > events/synthetic/latency/trigger sleep 1 echo "hello" > trace_marker