tracing: Add needs_rec flag to event triggers
authorTom Zanussi <tom.zanussi@linux.intel.com>
Thu, 10 Dec 2015 18:50:48 +0000 (12:50 -0600)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 8 Mar 2016 16:19:34 +0000 (11:19 -0500)
Add a new needs_rec flag for triggers that require unconditional
access to trace records in order to function.

Normally a trigger requires access to the contents of a trace record
only if it has a filter associated with it (since filters need the
contents of a record in order to make a filtering decision).  Some
types of triggers, such as 'hist' triggers, require access to trace
record contents independent of the presence of filters, so add a new
flag for those triggers.

Link: http://lkml.kernel.org/r/7be8fa38f9b90fdb6c47ca0f98d20a07b9fd512b.1449767187.git.tom.zanussi@linux.intel.com
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace.h
kernel/trace/trace_events_trigger.c

index f186867..8c6aefb 100644 (file)
@@ -1292,6 +1292,12 @@ struct event_trigger_ops {
  *     itself logs to the trace buffer, this flag should be set,
  *     otherwise it can be left unspecified.
  *
+ * @needs_rec: A flag that says whether or not this command needs
+ *     access to the trace record in order to perform its function,
+ *     regardless of whether or not it has a filter associated with
+ *     it (filters make a trigger require access to the trace record
+ *     but are not always present).
+ *
  * All the methods below, except for @set_filter(), must be
  * implemented.
  *
@@ -1332,6 +1338,7 @@ struct event_command {
        char                    *name;
        enum event_trigger_type trigger_type;
        bool                    post_trigger;
+       bool                    needs_rec;
        int                     (*func)(struct event_command *cmd_ops,
                                        struct trace_event_file *file,
                                        char *glob, char *cmd, char *params);
index e4d8b37..a11bb47 100644 (file)
@@ -493,7 +493,8 @@ void update_cond_flag(struct trace_event_file *file)
        bool set_cond = false;
 
        list_for_each_entry_rcu(data, &file->triggers, list) {
-               if (data->filter || data->cmd_ops->post_trigger) {
+               if (data->filter || data->cmd_ops->post_trigger ||
+                   data->cmd_ops->needs_rec) {
                        set_cond = true;
                        break;
                }