[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1460759535-22403-2-git-send-email-hcochran@kernelspring.com>
Date: Fri, 15 Apr 2016 18:32:11 -0400
From: Howard Cochran <hcochran@...nelspring.com>
To: linux-kernel@...r.kernel.org
Cc: Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...hat.com>,
Howard Cochran <cochran@...mark.com>,
Howard Cochran <hcochran@...nelspring.com>
Subject: [PATCH v2 1/5] tracing: Add param to event_trigger_ops.func() for instances
(Non-functional change)
Currently, the traceon, traceoff, stacktrace, and snapshot event
triggers always affect the top level trace buffer, even when the
trigger is enabled in a buffer instance. In order to fix this, the
trigger's .func() needs to receive the struct trace_event_file * so
that it can find the correct trace_array for the instance.
This change adds the neeeded parameter and changes the declarations of
each impementation to match. Changes to actually make use of the
parameter will follow in subsequent commits.
Signed-off-by: Howard Cochran <hcochran@...nelspring.com>
---
kernel/trace/trace.h | 3 ++-
kernel/trace/trace_events_trigger.c | 42 +++++++++++++++++++++++--------------
2 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 3fff4ad..ca4915f 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1230,7 +1230,8 @@ extern int register_event_command(struct event_command *cmd);
*/
struct event_trigger_ops {
void (*func)(struct event_trigger_data *data,
- void *rec);
+ void *rec,
+ struct trace_event_file *file);
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 d67992f..a3336f2 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -75,7 +75,7 @@ event_triggers_call(struct trace_event_file *file, void *rec)
if (data->paused)
continue;
if (!rec) {
- data->ops->func(data, rec);
+ data->ops->func(data, rec, file);
continue;
}
filter = rcu_dereference_sched(data->filter);
@@ -85,7 +85,7 @@ event_triggers_call(struct trace_event_file *file, void *rec)
tt |= data->cmd_ops->trigger_type;
continue;
}
- data->ops->func(data, rec);
+ data->ops->func(data, rec, file);
}
return tt;
}
@@ -115,7 +115,7 @@ event_triggers_post_call(struct trace_event_file *file,
if (data->paused)
continue;
if (data->cmd_ops->trigger_type & tt)
- data->ops->func(data, rec);
+ data->ops->func(data, rec, file);
}
}
EXPORT_SYMBOL_GPL(event_triggers_post_call);
@@ -765,7 +765,8 @@ int set_trigger_filter(char *filter_str,
}
static void
-traceon_trigger(struct event_trigger_data *data, void *rec)
+traceon_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
if (tracing_is_on())
return;
@@ -774,7 +775,8 @@ traceon_trigger(struct event_trigger_data *data, void *rec)
}
static void
-traceon_count_trigger(struct event_trigger_data *data, void *rec)
+traceon_count_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
if (tracing_is_on())
return;
@@ -789,7 +791,8 @@ traceon_count_trigger(struct event_trigger_data *data, void *rec)
}
static void
-traceoff_trigger(struct event_trigger_data *data, void *rec)
+traceoff_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
if (!tracing_is_on())
return;
@@ -798,7 +801,8 @@ traceoff_trigger(struct event_trigger_data *data, void *rec)
}
static void
-traceoff_count_trigger(struct event_trigger_data *data, void *rec)
+traceoff_count_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
if (!tracing_is_on())
return;
@@ -894,13 +898,15 @@ static struct event_command trigger_traceoff_cmd = {
#ifdef CONFIG_TRACER_SNAPSHOT
static void
-snapshot_trigger(struct event_trigger_data *data, void *rec)
+snapshot_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
tracing_snapshot();
}
static void
-snapshot_count_trigger(struct event_trigger_data *data, void *rec)
+snapshot_count_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
if (!data->count)
return;
@@ -908,7 +914,7 @@ snapshot_count_trigger(struct event_trigger_data *data, void *rec)
if (data->count != -1)
(data->count)--;
- snapshot_trigger(data, rec);
+ snapshot_trigger(data, rec, file);
}
static int
@@ -987,13 +993,15 @@ static __init int register_trigger_snapshot_cmd(void) { return 0; }
#define STACK_SKIP 3
static void
-stacktrace_trigger(struct event_trigger_data *data, void *rec)
+stacktrace_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
trace_dump_stack(STACK_SKIP);
}
static void
-stacktrace_count_trigger(struct event_trigger_data *data, void *rec)
+stacktrace_count_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
if (!data->count)
return;
@@ -1001,7 +1009,7 @@ stacktrace_count_trigger(struct event_trigger_data *data, void *rec)
if (data->count != -1)
(data->count)--;
- stacktrace_trigger(data, rec);
+ stacktrace_trigger(data, rec, file);
}
static int
@@ -1072,7 +1080,8 @@ struct enable_trigger_data {
};
static void
-event_enable_trigger(struct event_trigger_data *data, void *rec)
+event_enable_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
struct enable_trigger_data *enable_data = data->private_data;
@@ -1083,7 +1092,8 @@ event_enable_trigger(struct event_trigger_data *data, void *rec)
}
static void
-event_enable_count_trigger(struct event_trigger_data *data, void *rec)
+event_enable_count_trigger(struct event_trigger_data *data, void *rec,
+ struct trace_event_file *file)
{
struct enable_trigger_data *enable_data = data->private_data;
@@ -1097,7 +1107,7 @@ event_enable_count_trigger(struct event_trigger_data *data, void *rec)
if (data->count != -1)
(data->count)--;
- event_enable_trigger(data, rec);
+ event_enable_trigger(data, rec, file);
}
static int
--
1.9.1
Powered by blists - more mailing lists