All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Zanussi <tom.zanussi@linux.intel.com>
To: rostedt@goodmis.org
Cc: daniel.wagner@bmw-carit.de, masami.hiramatsu.pt@hitachi.com,
	namhyung@kernel.org, josh@joshtriplett.org, andi@firstfloor.org,
	mathieu.desnoyers@efficios.com, peterz@infradead.org,
	linux-kernel@vger.kernel.org,
	Tom Zanussi <tom.zanussi@linux.intel.com>
Subject: [PATCH v11 04/28] tracing: Add event record param to trigger_ops.func()
Date: Thu, 22 Oct 2015 13:14:08 -0500	[thread overview]
Message-ID: <20513d5fceea1d0ea805b09a1a47b2ade33bbde3.1445530672.git.tom.zanussi@linux.intel.com> (raw)
In-Reply-To: <cover.1445530672.git.tom.zanussi@linux.intel.com>
In-Reply-To: <cover.1445530672.git.tom.zanussi@linux.intel.com>

Some triggers may need access to the trace event, so pass it in.  Also
fix up the existing trigger funcs and their callers.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
---
 include/linux/trace_events.h        |  7 ++++---
 kernel/trace/trace.h                |  6 ++++--
 kernel/trace/trace_events_trigger.c | 36 +++++++++++++++++++-----------------
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index f85693b..b1e938d 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -427,7 +427,8 @@ extern int call_filter_check_discard(struct trace_event_call *call, void *rec,
 extern enum event_trigger_type event_triggers_call(struct trace_event_file *file,
 						   void *rec);
 extern void event_triggers_post_call(struct trace_event_file *file,
-				     enum event_trigger_type tt);
+				     enum event_trigger_type tt,
+				     void *rec);
 
 /**
  * trace_trigger_soft_disabled - do triggers and test if soft disabled
@@ -510,7 +511,7 @@ event_trigger_unlock_commit(struct trace_event_file *file,
 		trace_buffer_unlock_commit(file->tr, buffer, event, irq_flags, pc);
 
 	if (tt)
-		event_triggers_post_call(file, tt);
+		event_triggers_post_call(file, tt, entry);
 }
 
 /**
@@ -543,7 +544,7 @@ event_trigger_unlock_commit_regs(struct trace_event_file *file,
 						irq_flags, pc, regs);
 
 	if (tt)
-		event_triggers_post_call(file, tt);
+		event_triggers_post_call(file, tt, entry);
 }
 
 #ifdef CONFIG_BPF_EVENTS
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index f88e104..bc039bc 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1197,7 +1197,8 @@ extern int register_event_command(struct event_command *cmd);
  * @func: The trigger 'probe' function called when the triggering
  *	event occurs.  The data passed into this callback is the data
  *	that was supplied to the event_command @reg() function that
- *	registered the trigger (see struct event_command).
+ *	registered the trigger (see struct event_command) along with
+ *	the trace record, rec.
  *
  * @init: An optional initialization function called for the trigger
  *	when the trigger is registered (via the event_command reg()
@@ -1222,7 +1223,8 @@ extern int register_event_command(struct event_command *cmd);
  *	(see trace_event_triggers.c).
  */
 struct event_trigger_ops {
-	void			(*func)(struct event_trigger_data *data);
+	void			(*func)(struct event_trigger_data *data,
+					void *rec);
 	int			(*init)(struct event_trigger_ops *ops,
 					struct event_trigger_data *data);
 	void			(*free)(struct event_trigger_ops *ops,
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index 6087052..c3abef6 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -73,7 +73,7 @@ event_triggers_call(struct trace_event_file *file, void *rec)
 
 	list_for_each_entry_rcu(data, &file->triggers, list) {
 		if (!rec) {
-			data->ops->func(data);
+			data->ops->func(data, rec);
 			continue;
 		}
 		filter = rcu_dereference_sched(data->filter);
@@ -83,7 +83,7 @@ event_triggers_call(struct trace_event_file *file, void *rec)
 			tt |= data->cmd_ops->trigger_type;
 			continue;
 		}
-		data->ops->func(data);
+		data->ops->func(data, rec);
 	}
 	return tt;
 }
@@ -93,6 +93,7 @@ EXPORT_SYMBOL_GPL(event_triggers_call);
  * event_triggers_post_call - Call 'post_triggers' for a trace event
  * @file: The trace_event_file associated with the event
  * @tt: enum event_trigger_type containing a set bit for each trigger to invoke
+ * @rec: The trace entry for the event
  *
  * For each trigger associated with an event, invoke the trigger
  * function registered with the associated trigger command, if the
@@ -103,13 +104,14 @@ EXPORT_SYMBOL_GPL(event_triggers_call);
  */
 void
 event_triggers_post_call(struct trace_event_file *file,
-			 enum event_trigger_type tt)
+			 enum event_trigger_type tt,
+			 void *rec)
 {
 	struct event_trigger_data *data;
 
 	list_for_each_entry_rcu(data, &file->triggers, list) {
 		if (data->cmd_ops->trigger_type & tt)
-			data->ops->func(data);
+			data->ops->func(data, rec);
 	}
 }
 EXPORT_SYMBOL_GPL(event_triggers_post_call);
@@ -750,7 +752,7 @@ int set_trigger_filter(char *filter_str,
 }
 
 static void
-traceon_trigger(struct event_trigger_data *data)
+traceon_trigger(struct event_trigger_data *data, void *rec)
 {
 	if (tracing_is_on())
 		return;
@@ -759,7 +761,7 @@ traceon_trigger(struct event_trigger_data *data)
 }
 
 static void
-traceon_count_trigger(struct event_trigger_data *data)
+traceon_count_trigger(struct event_trigger_data *data, void *rec)
 {
 	if (tracing_is_on())
 		return;
@@ -774,7 +776,7 @@ traceon_count_trigger(struct event_trigger_data *data)
 }
 
 static void
-traceoff_trigger(struct event_trigger_data *data)
+traceoff_trigger(struct event_trigger_data *data, void *rec)
 {
 	if (!tracing_is_on())
 		return;
@@ -783,7 +785,7 @@ traceoff_trigger(struct event_trigger_data *data)
 }
 
 static void
-traceoff_count_trigger(struct event_trigger_data *data)
+traceoff_count_trigger(struct event_trigger_data *data, void *rec)
 {
 	if (!tracing_is_on())
 		return;
@@ -879,13 +881,13 @@ static struct event_command trigger_traceoff_cmd = {
 
 #ifdef CONFIG_TRACER_SNAPSHOT
 static void
-snapshot_trigger(struct event_trigger_data *data)
+snapshot_trigger(struct event_trigger_data *data, void *rec)
 {
 	tracing_snapshot();
 }
 
 static void
-snapshot_count_trigger(struct event_trigger_data *data)
+snapshot_count_trigger(struct event_trigger_data *data, void *rec)
 {
 	if (!data->count)
 		return;
@@ -893,7 +895,7 @@ snapshot_count_trigger(struct event_trigger_data *data)
 	if (data->count != -1)
 		(data->count)--;
 
-	snapshot_trigger(data);
+	snapshot_trigger(data, rec);
 }
 
 static int
@@ -972,13 +974,13 @@ static __init int register_trigger_snapshot_cmd(void) { return 0; }
 #define STACK_SKIP 3
 
 static void
-stacktrace_trigger(struct event_trigger_data *data)
+stacktrace_trigger(struct event_trigger_data *data, void *rec)
 {
 	trace_dump_stack(STACK_SKIP);
 }
 
 static void
-stacktrace_count_trigger(struct event_trigger_data *data)
+stacktrace_count_trigger(struct event_trigger_data *data, void *rec)
 {
 	if (!data->count)
 		return;
@@ -986,7 +988,7 @@ stacktrace_count_trigger(struct event_trigger_data *data)
 	if (data->count != -1)
 		(data->count)--;
 
-	stacktrace_trigger(data);
+	stacktrace_trigger(data, rec);
 }
 
 static int
@@ -1057,7 +1059,7 @@ struct enable_trigger_data {
 };
 
 static void
-event_enable_trigger(struct event_trigger_data *data)
+event_enable_trigger(struct event_trigger_data *data, void *rec)
 {
 	struct enable_trigger_data *enable_data = data->private_data;
 
@@ -1068,7 +1070,7 @@ event_enable_trigger(struct event_trigger_data *data)
 }
 
 static void
-event_enable_count_trigger(struct event_trigger_data *data)
+event_enable_count_trigger(struct event_trigger_data *data, void *rec)
 {
 	struct enable_trigger_data *enable_data = data->private_data;
 
@@ -1082,7 +1084,7 @@ event_enable_count_trigger(struct event_trigger_data *data)
 	if (data->count != -1)
 		(data->count)--;
 
-	event_enable_trigger(data);
+	event_enable_trigger(data, rec);
 }
 
 static int
-- 
1.9.3


  parent reply	other threads:[~2015-10-22 18:27 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 18:14 [PATCH 00/28] tracing: 'hist' triggers Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 01/28] tracing: Update cond flag when enabling or disabling a trigger Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 02/28] tracing: Make ftrace_event_field checking functions available Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 03/28] tracing: Make event trigger " Tom Zanussi
2015-10-22 18:14 ` Tom Zanussi [this message]
2015-10-22 18:14 ` [PATCH v11 05/28] tracing: Add get_syscall_name() Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 06/28] tracing: Add a per-event-trigger 'paused' field Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 07/28] tracing: Add needs_rec flag to event triggers Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 08/28] tracing: Add lock-free tracing_map Tom Zanussi
2015-10-29  8:31   ` Namhyung Kim
2015-10-29 18:35     ` Tom Zanussi
2015-11-02  7:08       ` Namhyung Kim
2015-11-04  1:47         ` Tom Zanussi
2015-11-04  2:26           ` Namhyung Kim
2015-11-04  2:56             ` Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 09/28] tracing: Add 'hist' event trigger command Tom Zanussi
2015-10-29  9:11   ` Namhyung Kim
2015-10-29 18:37     ` Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 10/28] tracing: Add hist trigger support for multiple values ('vals=' param) Tom Zanussi
2015-11-02  7:42   ` Namhyung Kim
2015-10-22 18:14 ` [PATCH v11 11/28] tracing: Add hist trigger support for compound keys Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 12/28] tracing: Add hist trigger support for user-defined sorting ('sort=' param) Tom Zanussi
2015-11-02  8:03   ` Namhyung Kim
2015-10-22 18:14 ` [PATCH v11 13/28] tracing: Add hist trigger support for pausing and continuing a trace Tom Zanussi
2015-11-03  8:38   ` Namhyung Kim
2015-11-04  1:53     ` Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 14/28] tracing: Add hist trigger support for clearing " Tom Zanussi
2015-11-03  8:43   ` Namhyung Kim
2015-10-22 18:14 ` [PATCH v11 15/28] tracing: Add hist trigger 'hex' modifier for displaying numeric fields Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 16/28] tracing: Add hist trigger 'sym' and 'sym-offset' modifiers Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 17/28] tracing: Add hist trigger 'execname' modifier Tom Zanussi
2015-11-02 14:10   ` Namhyung Kim
2015-11-04  2:37     ` Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 18/28] tracing: Add hist trigger 'syscall' modifier Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 19/28] tracing: Add hist trigger support for stacktraces as keys Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 20/28] tracing: Support string type key properly Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 21/28] tracing: Remove restriction on string position in hist trigger keys Tom Zanussi
2015-11-02 14:40   ` Namhyung Kim
2015-10-22 18:14 ` [PATCH v11 22/28] tracing: Add enable_hist/disable_hist triggers Tom Zanussi
2015-11-03  8:55   ` Namhyung Kim
2015-11-04  1:58     ` Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 23/28] tracing: Add 'hist' trigger Documentation Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 24/28] tracing: Add support for multiple hist triggers per event Tom Zanussi
2015-11-03  0:34   ` Namhyung Kim
2015-11-04  1:52     ` Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 25/28] tracing: Add support for named triggers Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 26/28] tracing: Add support for named hist triggers Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 27/28] kselftests/ftrace : Add event trigger testcases Tom Zanussi
2015-10-22 18:14 ` [PATCH v11 28/28] kselftests/ftrace: Add hist " Tom Zanussi
2015-10-22 18:21 ` [PATCH 00/28] tracing: 'hist' triggers Steven Rostedt
2015-10-22 18:31   ` Tom Zanussi
2015-11-05 14:43 ` Namhyung Kim
2015-11-05 14:59   ` 平松雅巳 / HIRAMATU,MASAMI
2015-11-05 22:13   ` Tom Zanussi
2015-11-05 23:18     ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20513d5fceea1d0ea805b09a1a47b2ade33bbde3.1445530672.git.tom.zanussi@linux.intel.com \
    --to=tom.zanussi@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=daniel.wagner@bmw-carit.de \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.