From: Howard Cochran <hcochran@kernelspring.com>
To: linux-kernel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
Howard Cochran <cochran@lexmark.com>,
Howard Cochran <hcochran@kernelspring.com>
Subject: [PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances
Date: Fri, 15 Apr 2016 02:53:46 -0400 [thread overview]
Message-ID: <1460703230-13307-2-git-send-email-hcochran@kernelspring.com> (raw)
In-Reply-To: <1460703230-13307-1-git-send-email-hcochran@kernelspring.com>
(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@kernelspring.com>
---
kernel/trace/trace.h | 3 ++-
kernel/trace/trace_events_trigger.c | 40 +++++++++++++++++++++++--------------
2 files changed, 27 insertions(+), 16 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..b69f2a2 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;
@@ -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
next prev parent reply other threads:[~2016-04-15 6:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-15 6:53 [PATCHSET] tracing: Make event triggers affect correct instance Howard Cochran
2016-04-15 6:53 ` Howard Cochran [this message]
2016-04-15 7:10 ` [PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances kbuild test robot
2016-04-15 6:53 ` [PATCH 2/5] tracing: Make stacktrace trigger affect the correct instance Howard Cochran
2016-04-15 6:53 ` [PATCH 3/5] tracing: Make traceon, traceoff " Howard Cochran
2016-04-15 6:53 ` [PATCH 4/5] tracing: Make snapshot " Howard Cochran
2016-04-15 6:53 ` [PATCH 5/5] tracing: Make internal_trace_puts() write to " Howard Cochran
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=1460703230-13307-2-git-send-email-hcochran@kernelspring.com \
--to=hcochran@kernelspring.com \
--cc=cochran@lexmark.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®