[PATCH v8 30/37] tracing: Add hist trigger support for variable reference aliases

2017-12-21 Thread Tom Zanussi
/trigger # echo 'hist:keys=pid:latency=$new_lat: onmatch(sched.sched_switch).wake2($latency,pid)' > /sys/kernel/debug/tracing/events/synthetic/wake1/trigger Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 58 +--- 1 fi

[PATCH v8 24/37] tracing: Add support for 'synthetic' events

2017-12-21 Thread Tom Zanussi
read throughout the kernel, except in this case the trace_ function and its corresponding tracepoint isn't statically generated but defined by the user at run-time. How this can be automatically hooked up via a hist trigger 'action' is discussed in a subsequent patch. Signed-off-by: Tom

[PATCH v8 32/37] tracing: Add inter-event hist trigger Documentation

2017-12-21 Thread Tom Zanussi
Add background and details on inter-event hist triggers, including hist variables, synthetic events, and actions. Signed-off-by: Tom Zanussi Signed-off-by: Baohong Liu --- Documentation/trace/histogram.txt | 381 ++ 1 file changed, 381 insertions(+) diff

[PATCH v8 35/37] tracing: Increase trace_recursive_lock() limit for synthetic events

2017-12-21 Thread Tom Zanussi
additional increment for that as well. Signed-off-by: Tom Zanussi --- kernel/trace/ring_buffer.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index dd35424..2375c5c 100644 --- a/kernel/trace/ring_buffer.c +++ b

[PATCH v8 33/37] tracing: Make tracing_set_clock() non-static

2017-12-21 Thread Tom Zanussi
Allow tracing code outside of trace.c to access tracing_set_clock(). Some applications may require a particular clock in order to function properly, such as latency calculations. Also, add an accessor returning the current clock string. Signed-off-by: Tom Zanussi --- kernel/trace/trace.c | 2

[PATCH v8 36/37] tracing: Add inter-event blurb to HIST_TRIGGERS config option

2017-12-21 Thread Tom Zanussi
So that users know that inter-event tracing is supported as part of the HIST_TRIGGERS option, include text to that effect in the help text. Signed-off-by: Tom Zanussi --- kernel/trace/Kconfig | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/trace/Kconfig b/kernel

[PATCH v8 37/37] selftests: ftrace: Add inter-event hist triggers testcases

2017-12-21 Thread Tom Zanussi
- test inter-event histogram trigger onmax action [PASS] [7] event trigger - test synthetic event create remove [PASS] Signed-off-by: Rajvi Jingar Signed-off-by: Tom Zanussi --- tools/testing/selftests/ftrace/test.d/functions| 7 +++ .../inter-event/trigger-extended-error

[PATCH v8 34/37] tracing: Add a clock attribute for hist triggers

2017-12-21 Thread Tom Zanussi
The default clock if timestamps are used in a histogram is "global". If timestamps aren't used, the clock is irrelevant. Use the "clock=" param only if you want to override the default "global" clock for a histogram with timestamps. Signed-off-by: Tom Z

[PATCH v8 23/37] tracing: Add hist trigger action hook

2017-12-21 Thread Tom Zanussi
s generate another event, or compare and save a maximum. Add a simple framework for doing that; specific actions will be implemented on top of it in later patches. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 106 ++- 1 file changed, 104 insert

[PATCH v8 29/37] tracing: Add cpu field for hist triggers

2017-12-21 Thread Tom Zanussi
A common key to use in a histogram is the cpuid - add a new cpu 'synthetic' field named 'cpu' for that purpose. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 15 +++ kernel/trace/trace_events_hist.c | 28 +++-

[PATCH v8 21/37] tracing: Add hist_field 'type' field

2017-12-21 Thread Tom Zanussi
Future support for synthetic events requires hist_field 'type' information, so add a field for that. Also, make other hist_field attribute usage consistent (size, is_signed, etc). Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 33 +++

[PATCH v8 18/37] tracing: Add simple expression support to hist triggers

2017-12-21 Thread Tom Zanussi
) and for combined latencies (latencies over 3 or more events). In the process, factor out some common code from key and value parsing. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 482 +-- 1 file changed, 409 insertions(+), 73 deletions

[PATCH v8 20/37] tracing: Pass tracing_map_elt to hist_field accessor functions

2017-12-21 Thread Tom Zanussi
Some accessor functions, such as for variable references, require access to a corrsponding tracing_map_elt. Add a tracing_map_elt param to the function signature and update the accessor functions accordingly. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 91

[PATCH v8 12/37] tracing: Add per-element variable support to tracing_map

2017-12-21 Thread Tom Zanussi
o the 'unset' state, implementing read-once variables, which are also important for event-matching uses. Signed-off-by: Tom Zanussi --- kernel/trace/tracing_map.c | 108 + kernel/trace/tracing_map.h | 11 + 2 files changed, 119 insertions(+

[PATCH v8 16/37] tracing: Account for variables in named trigger compatibility

2017-12-21 Thread Tom Zanussi
: Tom Zanussi --- kernel/trace/trace_events_hist.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index 8f43f24..ba32626 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c

[PATCH v8 07/37] tracing: Add timestamp_mode trace file

2017-12-21 Thread Tom Zanussi
cient). Signed-off-by: Tom Zanussi --- Documentation/trace/ftrace.txt | 24 + kernel/trace/trace.c | 47 ++ 2 files changed, 71 insertions(+) diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index d

[PATCH v8 10/37] tracing: Break out hist trigger assignment parsing

2017-12-21 Thread Tom Zanussi
This will make it easier to add variables, and makes the parsing code cleaner regardless. Signed-off-by: Tom Zanussi Signed-off-by: Rajvi Jingar --- kernel/trace/trace_events_hist.c | 72 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a

[PATCH v8 11/37] tracing: Add hist trigger timestamp support

2017-12-21 Thread Tom Zanussi
ent rather than an offset. This mode will be enabled if and only if a histogram makes use of the "common_timestamp" field. Signed-off-by: Tom Zanussi Signed-off-by: Baohong Liu [kasan use-after-free fix] Signed-off-by: Vedang Patel --- kernel/trace/trace_events_hist.c | 94

[PATCH v8 03/37] tracing: Add support to detect and avoid duplicates

2017-12-21 Thread Tom Zanussi
he threads which failed cmpxchg() from incrementing idx. This way, they will loop around and check if the thread which succeeded in executing cmpxchg() had the same key. [1] http://lkml.kernel.org/r/cover.1498510759.git.tom.zanu...@linux.intel.com Signed-off-by: Vedang Patel Signed-off-by: T

[PATCH v8 00/37] tracing: Inter-event (e.g. latency) support

2017-12-21 Thread Tom Zanussi
# echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> \ /sys/kernel/debug/tracing/events/sched/sched_waking/trigger # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> \ /sys/kernel/d

Re: [PATCH v7 24/37] tracing: Add support for 'synthetic' events

2017-12-12 Thread Tom Zanussi
Hi Namhyung, On Tue, 2017-12-12 at 23:42 +0900, Namhyung Kim wrote: > On Wed, Dec 06, 2017 at 04:38:05PM -0600, Tom Zanussi wrote: > > Synthetic events are user-defined events generated from hist trigger > > variables saved from one or more other events. > > > > To de

Re: [PATCH v7 22/37] tracing: Add variable reference handling to hist triggers

2017-12-11 Thread Tom Zanussi
Hi Namhyung, On Tue, 2017-12-12 at 00:17 +0900, Namhyung Kim wrote: > Hi Tom, > > On Wed, Dec 06, 2017 at 04:38:03PM -0600, Tom Zanussi wrote: > > Add the necessary infrastructure to allow the variables defined on one > > event to be referenced in another. This allo

Re: [PATCH v7 19/37] tracing: Generalize per-element hist trigger data

2017-12-08 Thread Tom Zanussi
Hi Namhyung, On Fri, 2017-12-08 at 22:06 +0900, Namhyung Kim wrote: > On Wed, Dec 06, 2017 at 04:38:00PM -0600, Tom Zanussi wrote: > > Up until now, hist triggers only needed per-element support for saving > > 'comm' data, which was saved directly as a private

Re: [PATCH v7 15/37] tracing: Add variable support to hist triggers

2017-12-08 Thread Tom Zanussi
Hi Namhyung, On Fri, 2017-12-08 at 22:02 +0900, Namhyung Kim wrote: > Hi Tom, > > On Wed, Dec 06, 2017 at 04:37:56PM -0600, Tom Zanussi wrote: > > Add support for saving the value of a current event's event field by > > assigning it to a variable that can be

[PATCH v7 02/37] tracing: Add Documentation for log2 modifier

2017-12-06 Thread Tom Zanussi
Add a line for the log2 modifier, to keep it aligned with tracing/README. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/trace/histogram.txt b/Documentation/trace/histogram.txt index b2145f4..a4143f04a 100644

[PATCH v7 03/37] tracing: Add support to detect and avoid duplicates

2017-12-06 Thread Tom Zanussi
he threads which failed cmpxchg() from incrementing idx. This way, they will loop around and check if the thread which succeeded in executing cmpxchg() had the same key. [1] http://lkml.kernel.org/r/cover.1498510759.git.tom.zanu...@linux.intel.com Signed-off-by: Vedang Patel Signed-off-by: T

[PATCH v7 05/37] ring-buffer: Add interface for setting absolute time stamps

2017-12-06 Thread Tom Zanussi
Define a new function, tracing_set_time_stamp_abs(), which can be used to enable or disable the use of absolute timestamps rather than time deltas for a trace array. Only the interface is added here; a subsequent patch will add the underlying implementation. Signed-off-by: Tom Zanussi Signed

[PATCH v7 04/37] tracing: Remove code which merges duplicates

2017-12-06 Thread Tom Zanussi
condition which might cause duplicates does not go unnoticed. Signed-off-by: Vedang Patel Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 11 -- kernel/trace/tracing_map.c | 83 +++- kernel/trace/tracing_map.h | 7 3 files

[PATCH v7 06/37] ring-buffer: Redefine the unimplemented RINGBUF_TYPE_TIME_STAMP

2017-12-06 Thread Tom Zanussi
ccess way, for purposes other than serial event printing. To set/reset this mode, use tracing_set_timestamp_abs() from the previous interface patch. Signed-off-by: Tom Zanussi --- include/linux/ring_buffer.h | 12 ++--- kernel/trace/ring_buffer.c | 104 --

[PATCH v7 08/37] tracing: Give event triggers access to ring_buffer_event

2017-12-06 Thread Tom Zanussi
The ring_buffer event can provide a timestamp that may be useful to various triggers - pass it into the handlers for that purpose. Signed-off-by: Tom Zanussi --- include/linux/trace_events.h| 14 ++- kernel/trace/trace.h| 9 +++ kernel/trace

[PATCH v7 07/37] tracing: Add timestamp_mode trace file

2017-12-06 Thread Tom Zanussi
cient). Signed-off-by: Tom Zanussi --- Documentation/trace/ftrace.txt | 24 + kernel/trace/trace.c | 47 ++ 2 files changed, 71 insertions(+) diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index d

[PATCH v7 09/37] tracing: Add ring buffer event param to hist field functions

2017-12-06 Thread Tom Zanussi
Some events such as timestamps require access to a ring_buffer_event struct; add a param so that hist field functions can access that. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 39 --- 1 file changed, 24 insertions(+), 15 deletions

[PATCH v7 13/37] tracing: Add hist_data member to hist_field

2017-12-06 Thread Tom Zanussi
Allow hist_data access via hist_field. Some users of hist_fields require or will require more access to the associated hist_data. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/trace

[PATCH v7 18/37] tracing: Add simple expression support to hist triggers

2017-12-06 Thread Tom Zanussi
) and for combined latencies (latencies over 3 or more events). In the process, factor out some common code from key and value parsing. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 482 +-- 1 file changed, 409 insertions(+), 73 deletions

[PATCH v7 15/37] tracing: Add variable support to hist triggers

2017-12-06 Thread Tom Zanussi
ingle) variables can also be assigned at the same time using separate assignments: # echo 'hist:keys=pid:vals=$ts0:ts0=common_timestamp:b=field1:c=field2 ... Variables set as above can be used by being referenced from another event, as described in a subsequent patch. Signed-o

[PATCH v7 16/37] tracing: Account for variables in named trigger compatibility

2017-12-06 Thread Tom Zanussi
: Tom Zanussi --- kernel/trace/trace_events_hist.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index c385e56..10b79ec 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c

[PATCH v7 23/37] tracing: Add hist trigger action hook

2017-12-06 Thread Tom Zanussi
s generate another event, or compare and save a maximum. Add a simple framework for doing that; specific actions will be implemented on top of it in later patches. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 106 ++- 1 file changed, 104 insert

[PATCH v7 25/37] tracing: Add support for 'field variables'

2017-12-06 Thread Tom Zanussi
akeup_lat,next_pid,prio) >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 531 ++- 1 file changed, 530 insertions(+), 1 deletion(-) diff --git a/ker

[PATCH v7 26/37] tracing: Add 'onmatch' hist trigger action support

2017-12-06 Thread Tom Zanussi
st a matter of using the fields and new synthetic event in the tracing/events/synthetic directory, as usual: # echo 'hist:keys=pid,prio:sort=pid,prio' >> \ /sys/kernel/debug/tracing/events/synthetic/wakeup_new_test/trigger Signed-off-by: Tom Zanussi Signed-off-by: Rajvi Jing

[PATCH v7 29/37] tracing: Add cpu field for hist triggers

2017-12-06 Thread Tom Zanussi
A common key to use in a histogram is the cpuid - add a new cpu 'synthetic' field named 'cpu' for that purpose. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 15 +++ kernel/trace/trace_events_hist.c | 28 +++-

[PATCH v7 30/37] tracing: Add hist trigger support for variable reference aliases

2017-12-06 Thread Tom Zanussi
/trigger # echo 'hist:keys=pid:latency=$new_lat: onmatch(sched.sched_switch).wake2($latency,pid)' > /sys/kernel/debug/tracing/events/synthetic/wake1/trigger Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 58 +--- 1 fi

[PATCH v7 27/37] tracing: Add 'onmax' hist trigger action support

2017-12-06 Thread Tom Zanussi
prev_prio:120 prev_comm: swapper/0 Totals: Hits: 3493 Entries: 3 Dropped: 0 Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 331 ++- 1 file changed, 296 insertions(+), 35 deletions(-) diff --git a/k

[PATCH v7 35/37] tracing: Increase trace_recursive_lock() limit for synthetic events

2017-12-06 Thread Tom Zanussi
additional increment for that as well. Signed-off-by: Tom Zanussi --- kernel/trace/ring_buffer.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 763b3fb..8c862ea 100644 --- a/kernel/trace/ring_buffer.c +++ b

[PATCH v7 34/37] tracing: Add a clock attribute for hist triggers

2017-12-06 Thread Tom Zanussi
The default clock if timestamps are used in a histogram is "global". If timestamps aren't used, the clock is irrelevant. Use the "clock=" param only if you want to override the default "global" clock for a histogram with timestamps. Signed-off-by: Tom Z

[PATCH v7 37/37] selftests: ftrace: Add inter-event hist triggers testcases

2017-12-06 Thread Tom Zanussi
- test inter-event histogram trigger onmax action [PASS] [7] event trigger - test synthetic event create remove [PASS] Signed-off-by: Rajvi Jingar Signed-off-by: Tom Zanussi --- tools/testing/selftests/ftrace/test.d/functions| 7 +++ .../inter-event/trigger-extended-error

[PATCH v7 33/37] tracing: Make tracing_set_clock() non-static

2017-12-06 Thread Tom Zanussi
Allow tracing code outside of trace.c to access tracing_set_clock(). Some applications may require a particular clock in order to function properly, such as latency calculations. Also, add an accessor returning the current clock string. Signed-off-by: Tom Zanussi --- kernel/trace/trace.c | 2

[PATCH v7 31/37] tracing: Add 'last error' error facility for hist triggers

2017-12-06 Thread Tom Zanussi
# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist ERROR: Couldn't yyy: zzz Last command: xxx Also add specific error messages for variable and action errors. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 20 + k

[PATCH v7 36/37] tracing: Add inter-event blurb to HIST_TRIGGERS config option

2017-12-06 Thread Tom Zanussi
So that users know that inter-event tracing is supported as part of the HIST_TRIGGERS option, include text to that effect in the help text. Signed-off-by: Tom Zanussi --- kernel/trace/Kconfig | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/trace/Kconfig b/kernel

[PATCH v7 32/37] tracing: Add inter-event hist trigger Documentation

2017-12-06 Thread Tom Zanussi
Add background and details on inter-event hist triggers, including hist variables, synthetic events, and actions. Signed-off-by: Tom Zanussi Signed-off-by: Baohong Liu --- Documentation/trace/histogram.txt | 381 ++ 1 file changed, 381 insertions(+) diff

[PATCH v7 20/37] tracing: Pass tracing_map_elt to hist_field accessor functions

2017-12-06 Thread Tom Zanussi
Some accessor functions, such as for variable references, require access to a corrsponding tracing_map_elt. Add a tracing_map_elt param to the function signature and update the accessor functions accordingly. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 91

[PATCH v7 22/37] tracing: Add variable reference handling to hist triggers

2017-12-06 Thread Tom Zanussi
amp is saved into the variable ts0. In the next line, ts0 is subtracted from the second event's timestamp to produce the latency. Further users of variable references will be described in subsequent patches, such as for instance how the 'wakeup_lat' variable above can be displaye

[PATCH v7 28/37] tracing: Allow whitespace to surround hist trigger filter

2017-12-06 Thread Tom Zanussi
max) where spaces are more natural e.g. spaces after commas in param lists. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 37 - 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/ke

[PATCH v7 24/37] tracing: Add support for 'synthetic' events

2017-12-06 Thread Tom Zanussi
read throughout the kernel, except in this case the trace_ function and its corresponding tracepoint isn't statically generated but defined by the user at run-time. How this can be automatically hooked up via a hist trigger 'action' is discussed in a subsequent patch. Signed-off-by: Tom

[PATCH v7 21/37] tracing: Add hist_field 'type' field

2017-12-06 Thread Tom Zanussi
Future support for synthetic events requires hist_field 'type' information, so add a field for that. Also, make other hist_field attribute usage consistent (size, is_signed, etc). Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 33 +++

[PATCH v7 17/37] tracing: Move get_hist_field_flags()

2017-12-06 Thread Tom Zanussi
Move get_hist_field_flags() to make it more easily accessible for new code (and keep the move separate from new functionality). Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 44 1 file changed, 22 insertions(+), 22 deletions(-) diff

[PATCH v7 11/37] tracing: Add hist trigger timestamp support

2017-12-06 Thread Tom Zanussi
ent rather than an offset. This mode will be enabled if and only if a histogram makes use of the "common_timestamp" field. Signed-off-by: Tom Zanussi Signed-off-by: Baohong Liu [kasan use-after-free fix] Signed-off-by: Vedang Patel --- kernel/trace/trace_events_hist.c | 94

[PATCH v7 10/37] tracing: Break out hist trigger assignment parsing

2017-12-06 Thread Tom Zanussi
This will make it easier to add variables, and makes the parsing code cleaner regardless. Signed-off-by: Tom Zanussi Signed-off-by: Rajvi Jingar --- kernel/trace/trace_events_hist.c | 72 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a

[PATCH v7 19/37] tracing: Generalize per-element hist trigger data

2017-12-06 Thread Tom Zanussi
omm'-related code over to that. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 76 +++- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index f75f7b

[PATCH v7 14/37] tracing: Add usecs modifier for hist trigger timestamps

2017-12-06 Thread Tom Zanussi
;hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0 ... This also adds an external trace_clock_in_ns() to trace.c for the timestamp conversion. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 1 + kernel/trace/trace.c | 13 +++-- kernel/trace/trace.h

[PATCH v7 12/37] tracing: Add per-element variable support to tracing_map

2017-12-06 Thread Tom Zanussi
o the 'unset' state, implementing read-once variables, which are also important for event-matching uses. Signed-off-by: Tom Zanussi --- kernel/trace/tracing_map.c | 108 + kernel/trace/tracing_map.h | 11 + 2 files changed, 119 insertions(+

[PATCH v7 00/37] tracing: Inter-event (e.g. latency) support

2017-12-06 Thread Tom Zanussi
t:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> \ /sys/kernel/debug/tracing/events/sched/sched_waking/trigger # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> \ /sys/kernel/debug/tracing/

Re: [PATCH v6 29/37] tracing: Add cpu field for hist triggers

2017-11-29 Thread Tom Zanussi
Hi Namhyung, On Thu, 2017-11-23 at 14:25 +0900, Namhyung Kim wrote: > On Fri, Nov 17, 2017 at 02:33:08PM -0600, Tom Zanussi wrote: > > A common key to use in a histogram is the cpuid - add a new cpu > > 'synthetic' field for that purpose. This field is named cp

Re: [PATCH v6 27/37] tracing: Add 'onmax' hist trigger action support

2017-11-29 Thread Tom Zanussi
Hi Namhyung, Sorry for the delayed response - was out on vacation.. On Thu, 2017-11-23 at 14:09 +0900, Namhyung Kim wrote: > On Fri, Nov 17, 2017 at 02:33:06PM -0600, Tom Zanussi wrote: > > Add an 'onmax(var).save(field,...)' hist trigger action which is > > invoked when

[PATCH v6 08/37] tracing: Give event triggers access to ring_buffer_event

2017-11-17 Thread Tom Zanussi
The ring_buffer event can provide a timestamp that may be useful to various triggers - pass it into the handlers for that purpose. Signed-off-by: Tom Zanussi --- include/linux/trace_events.h| 14 ++- kernel/trace/trace.h| 9 +++ kernel/trace

[PATCH v6 15/37] tracing: Add variable support to hist triggers

2017-11-17 Thread Tom Zanussi
(or single) variables can also be assigned at the same time using separate assignments: # echo 'hist:keys=pid:vals=$ts0:ts0=$common_timestamp:b=field1:c=field2 ... Variables set as above can be used by being referenced from another event, as described in a subsequent patch. Signed-o

[PATCH v6 09/37] tracing: Add ring buffer event param to hist field functions

2017-11-17 Thread Tom Zanussi
Some events such as timestamps require access to a ring_buffer_event struct; add a param so that hist field functions can access that. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 39 --- 1 file changed, 24 insertions(+), 15 deletions

[PATCH v6 10/37] tracing: Break out hist trigger assignment parsing

2017-11-17 Thread Tom Zanussi
This will make it easier to add variables, and makes the parsing code cleaner regardless. Signed-off-by: Tom Zanussi Signed-off-by: Rajvi Jingar --- kernel/trace/trace_events_hist.c | 72 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a

[PATCH v6 11/37] tracing: Add hist trigger timestamp support

2017-11-17 Thread Tom Zanussi
which saves the complete timestamp for each event rather than an offset. This mode will be enabled if and only if a histogram makes use of the "$common_timestamp" field. Signed-off-by: Tom Zanussi Signed-off-by: Baohong Liu --- kernel/trace/trace_events_hist.c | 94 ++

[PATCH v6 13/37] tracing: Add hist_data member to hist_field

2017-11-17 Thread Tom Zanussi
Allow hist_data access via hist_field. Some users of hist_fields require or will require more access to the associated hist_data. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/trace

[PATCH v6 12/37] tracing: Add per-element variable support to tracing_map

2017-11-17 Thread Tom Zanussi
o the 'unset' state, implementing read-once variables, which are also important for event-matching uses. Signed-off-by: Tom Zanussi --- kernel/trace/tracing_map.c | 108 + kernel/trace/tracing_map.h | 11 + 2 files changed, 119 insertions(+

[PATCH v6 14/37] tracing: Add usecs modifier for hist trigger timestamps

2017-11-17 Thread Tom Zanussi
;hist:keys=next_pid:wakeup_lat=$common_timestamp.usecs-$ts0 ... This also adds an external trace_clock_in_ns() to trace.c for the timestamp conversion. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 1 + kernel/trace/trace.c | 13 +++-- kernel/trace/trace.h

[PATCH v6 17/37] tracing: Move get_hist_field_flags()

2017-11-17 Thread Tom Zanussi
Move get_hist_field_flags() to make it more easily accessible for new code (and keep the move separate from new functionality). Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 44 1 file changed, 22 insertions(+), 22 deletions(-) diff

[PATCH v6 16/37] tracing: Account for variables in named trigger compatibility

2017-11-17 Thread Tom Zanussi
: Tom Zanussi --- kernel/trace/trace_events_hist.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index eccfe07..0e4f829 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c

[PATCH v6 20/37] tracing: Pass tracing_map_elt to hist_field accessor functions

2017-11-17 Thread Tom Zanussi
Some accessor functions, such as for variable references, require access to a corrsponding tracing_map_elt. Add a tracing_map_elt param to the function signature and update the accessor functions accordingly. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 91

[PATCH v6 21/37] tracing: Add hist_field 'type' field

2017-11-17 Thread Tom Zanussi
Future support for synthetic events requires hist_field 'type' information, so add a field for that. Also, make other hist_field attribute usage consistent (size, is_signed, etc). Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 33 +++

[PATCH v6 18/37] tracing: Add simple expression support to hist triggers

2017-11-17 Thread Tom Zanussi
) and for combined latencies (latencies over 3 or more events). In the process, factor out some common code from key and value parsing. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 513 +-- 1 file changed, 440 insertions(+), 73 deletions

[PATCH v6 19/37] tracing: Generalize per-element hist trigger data

2017-11-17 Thread Tom Zanussi
omm'-related code over to that. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 76 +++- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c index f6c59a

[PATCH v6 22/37] tracing: Add variable reference handling to hist triggers

2017-11-17 Thread Tom Zanussi
7;s timetamp is saved into the variable ts0. In the next line, ts0 is subtracted from the second event's timestamp to produce the latency. Further users of variable references will be described in subsequent patches, such as for instance how the 'wakeup_lat' variable above can be displaye

[PATCH v6 05/37] ring-buffer: Add interface for setting absolute time stamps

2017-11-17 Thread Tom Zanussi
Define a new function, tracing_set_time_stamp_abs(), which can be used to enable or disable the use of absolute timestamps rather than time deltas for a trace array. Only the interface is added here; a subsequent patch will add the underlying implementation. Signed-off-by: Tom Zanussi Signed

[PATCH v6 23/37] tracing: Add hist trigger action hook

2017-11-17 Thread Tom Zanussi
s generate another event, or compare and save a maximum. Add a simple framework for doing that; specific actions will be implemented on top of it in later patches. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 108 +-- 1 file changed, 105 insert

[PATCH v6 24/37] tracing: Add support for 'synthetic' events

2017-11-17 Thread Tom Zanussi
read throughout the kernel, except in this case the trace_ function and its corresponding tracepoint isn't statically generated but defined by the user at run-time. How this can be automatically hooked up via a hist trigger 'action' is discussed in a subsequent patch. Signed-off-by: Tom

[PATCH v6 25/37] tracing: Add support for 'field variables'

2017-11-17 Thread Tom Zanussi
akeup_lat,next_pid,prio) >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 536 ++- 1 file changed, 535 insertions(+), 1 deletion(-) diff --git a/ker

[PATCH v6 26/37] tracing: Add 'onmatch' hist trigger action support

2017-11-17 Thread Tom Zanussi
st a matter of using the fields and new synthetic event in the tracing/events/synthetic directory, as usual: # echo 'hist:keys=pid,prio:sort=pid,prio' >> \ /sys/kernel/debug/tracing/events/synthetic/wakeup_new_test/trigger Signed-off-by: Tom Zanussi Signed-off-by: Rajvi Jing

[PATCH v6 28/37] tracing: Allow whitespace to surround hist trigger filter

2017-11-17 Thread Tom Zanussi
max) where spaces are more natural e.g. spaces after commas in param lists. Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 37 - 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/ke

[PATCH v6 35/37] tracing: Increase trace_recursive_lock() limit for synthetic events

2017-11-17 Thread Tom Zanussi
additional increment for that as well. Signed-off-by: Tom Zanussi --- kernel/trace/ring_buffer.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 763b3fb..8c862ea 100644 --- a/kernel/trace/ring_buffer.c +++ b

[PATCH v6 36/37] tracing: Add inter-event blurb to HIST_TRIGGERS config option

2017-11-17 Thread Tom Zanussi
So that users know that inter-event tracing is supported as part of the HIST_TRIGGERS option, include text to that effect in the help text. Signed-off-by: Tom Zanussi --- kernel/trace/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig

[PATCH v6 37/37] selftests: ftrace: Add inter-event hist triggers testcases

2017-11-17 Thread Tom Zanussi
- test inter-event histogram trigger onmax action [PASS] [7] event trigger - test synthetic event create remove [PASS] Signed-off-by: Rajvi Jingar Signed-off-by: Tom Zanussi --- tools/testing/selftests/ftrace/test.d/functions| 7 +++ .../inter-event/trigger-extended-error

[PATCH v6 31/37] tracing: Add 'last error' error facility for hist triggers

2017-11-17 Thread Tom Zanussi
# cat /sys/kernel/debug/tracing/events/sched/sched_wakeup/hist ERROR: Couldn't yyy: zzz Last command: xxx Also add specific error messages for variable and action errors. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 20 + k

[PATCH v6 34/37] tracing: Add a clock attribute for hist triggers

2017-11-17 Thread Tom Zanussi
The default clock if timestamps are used in a histogram is "global". If timestamps aren't used, the clock is irrelevant. Use the "clock=" param only if you want to override the default "global" clock for a histogram with timestamps. Signed-off-by: Tom Z

[PATCH v6 29/37] tracing: Add cpu field for hist triggers

2017-11-17 Thread Tom Zanussi
e for the same thing. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 17 + kernel/trace/trace_events_hist.c | 28 +++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/Documentation/trace/histogram.txt b/Documentation

[PATCH v6 27/37] tracing: Add 'onmax' hist trigger action support

2017-11-17 Thread Tom Zanussi
0 \ prev_prio:120 prev_comm: swapper/0 Totals: Hits: 3493 Entries: 3 Dropped: 0 Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 331 ++- 1 file changed, 296 insertions(+), 35 deletions(-) diff --git a/k

[PATCH v6 33/37] tracing: Make tracing_set_clock() non-static

2017-11-17 Thread Tom Zanussi
Allow tracing code outside of trace.c to access tracing_set_clock(). Some applications may require a particular clock in order to function properly, such as latency calculations. Also, add an accessor returning the current clock string. Signed-off-by: Tom Zanussi --- kernel/trace/trace.c | 2

[PATCH v6 32/37] tracing: Add inter-event hist trigger Documentation

2017-11-17 Thread Tom Zanussi
Add background and details on inter-event hist triggers, including hist variables, synthetic events, and actions. Signed-off-by: Tom Zanussi Signed-off-by: Baohong Liu --- Documentation/trace/histogram.txt | 382 ++ 1 file changed, 382 insertions(+) diff

[PATCH v6 30/37] tracing: Add hist trigger support for variable reference aliases

2017-11-17 Thread Tom Zanussi
/trigger # echo 'hist:keys=pid:latency=$new_lat: onmatch(sched.sched_switch).wake2($latency,pid)' > /sys/kernel/debug/tracing/events/synthetic/wake1/trigger Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 58 +--- 1 fi

[PATCH v6 07/37] tracing: Add timestamp_mode trace file

2017-11-17 Thread Tom Zanussi
cient). Signed-off-by: Tom Zanussi --- Documentation/trace/ftrace.txt | 24 + kernel/trace/trace.c | 47 ++ 2 files changed, 71 insertions(+) diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index d

[PATCH v6 04/37] tracing: Remove code which merges duplicates

2017-11-17 Thread Tom Zanussi
condition which might cause duplicates does not go unnoticed. Signed-off-by: Vedang Patel Signed-off-by: Tom Zanussi --- kernel/trace/trace_events_hist.c | 11 -- kernel/trace/tracing_map.c | 83 +++- kernel/trace/tracing_map.h | 7 3 files

[PATCH v6 03/37] tracing: Add support to detect and avoid duplicates

2017-11-17 Thread Tom Zanussi
he threads which failed cmpxchg() from incrementing idx. This way, they will loop around and check if the thread which succeeded in executing cmpxchg() had the same key. [1] http://lkml.kernel.org/r/cover.1498510759.git.tom.zanu...@linux.intel.com Signed-off-by: Vedang Patel Signed-off-by: T

[PATCH v6 06/37] ring-buffer: Redefine the unimplemented RINGBUF_TYPE_TIME_STAMP

2017-11-17 Thread Tom Zanussi
ccess way, for purposes other than serial event printing. To set/reset this mode, use tracing_set_timestamp_abs() from the previous interface patch. Signed-off-by: Tom Zanussi --- include/linux/ring_buffer.h | 12 ++--- kernel/trace/ring_buffer.c | 104 --

[PATCH v6 02/37] tracing: Add Documentation for log2 modifier

2017-11-17 Thread Tom Zanussi
Add a line for the log2 modifier, to keep it aligned with tracing/README. Signed-off-by: Tom Zanussi --- Documentation/trace/histogram.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/trace/histogram.txt b/Documentation/trace/histogram.txt index b2145f4..a4143f04a 100644

[PATCH v6 00/37] tracing: Inter-event (e.g. latency) support

2017-11-17 Thread Tom Zanussi
see a message to that effect at the bottom of the file: # echo 'hist:keys=pid:ts0=$common_timestamp.usecs if comm=="cyclictest"' >> \ /sys/kernel/debug/tracing/events/sched/sched_waking/trigger # echo 'hist:keys=pid:ts0=$common_timestamp.use

<    3   4   5   6   7   8   9   10   11   12   >