Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1379494 > unrolled thread
| Started by | Howard Cochran <hcochran@kernelspring.com> |
|---|---|
| First post | 2016-04-15 09:00 +0200 |
| Last post | 2016-04-15 09:00 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCHSET] tracing: Make event triggers affect correct instance Howard Cochran <hcochran@kernelspring.com> - 2016-04-15 09:00 +0200
[PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances Howard Cochran <hcochran@kernelspring.com> - 2016-04-15 09:00 +0200
Re: [PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances kbuild test robot <lkp@intel.com> - 2016-04-15 09:20 +0200
[PATCH 4/5] tracing: Make snapshot trigger affect the correct instance Howard Cochran <hcochran@kernelspring.com> - 2016-04-15 09:00 +0200
| From | Howard Cochran <hcochran@kernelspring.com> |
|---|---|
| Date | 2016-04-15 09:00 +0200 |
| Subject | [PATCHSET] tracing: Make event triggers affect correct instance |
| Message-ID | <ro5Ts-79F-3@gated-at.bofh.it> |
Although all of the trace event triggers can be used in instances, most of them affect the top-level instance even when triggered from within an instance. This patch set makes them affect the instance in which the trigger occurred. The enable_event & disable_event triggers already work within the correct instance, so these are unchanged. The same problem also exists with the function probe triggers, but they will be fixed in a later patch set. Patch 1 is preparatory. Patch 2 fixes the stacktrace event trigger Patch 3 fixes the traceon & traceoff event triggers Patch 4 fixes the snapshot event trigger Patch 5 Makes related warning messages also go to the correct instance kernel/trace/trace.c | 96 +++++++++++++++++++++++++------------ kernel/trace/trace.h | 14 +++++- kernel/trace/trace_events_trigger.c | 62 ++++++++++++++---------- 3 files changed, 113 insertions(+), 59 deletions(-)
[toc] | [next] | [standalone]
| From | Howard Cochran <hcochran@kernelspring.com> |
|---|---|
| Date | 2016-04-15 09:00 +0200 |
| Subject | [PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances |
| Message-ID | <ro5Tt-79F-25@gated-at.bofh.it> |
| In reply to | #1379494 |
(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
[toc] | [prev] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2016-04-15 09:20 +0200 |
| Subject | Re: [PATCH 1/5] tracing: Add param to event_trigger_ops.func() for instances |
| Message-ID | <ro6cO-7AZ-3@gated-at.bofh.it> |
| In reply to | #1379496 |
[Multipart message — attachments visible in raw view] — view raw
Hi Howard,
[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.6-rc3 next-20160414]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Howard-Cochran/tracing-Add-param-to-event_trigger_ops-func-for-instances/20160415-145801
config: i386-randconfig-x000-201615 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
Note: the linux-review/Howard-Cochran/tracing-Add-param-to-event_trigger_ops-func-for-instances/20160415-145801 HEAD 30aa67c47e19ac73897f7683d98b7c49a08cf635 builds fine.
It only hurts bisectibility.
All errors (new ones prefixed by >>):
kernel/trace/trace_events_trigger.c: In function 'snapshot_count_trigger':
>> kernel/trace/trace_events_trigger.c:917:2: error: too few arguments to function 'snapshot_trigger'
snapshot_trigger(data, rec);
^
kernel/trace/trace_events_trigger.c:901:1: note: declared here
snapshot_trigger(struct event_trigger_data *data, void *rec,
^
vim +/snapshot_trigger +917 kernel/trace/trace_events_trigger.c
93e31ffb Tom Zanussi 2013-10-24 911 if (!data->count)
93e31ffb Tom Zanussi 2013-10-24 912 return;
93e31ffb Tom Zanussi 2013-10-24 913
93e31ffb Tom Zanussi 2013-10-24 914 if (data->count != -1)
93e31ffb Tom Zanussi 2013-10-24 915 (data->count)--;
93e31ffb Tom Zanussi 2013-10-24 916
c4a59230 Tom Zanussi 2015-12-10 @917 snapshot_trigger(data, rec);
93e31ffb Tom Zanussi 2013-10-24 918 }
93e31ffb Tom Zanussi 2013-10-24 919
93e31ffb Tom Zanussi 2013-10-24 920 static int
:::::: The code at line 917 was first introduced by commit
:::::: c4a5923055c9e0c87dfc0387f7cda5ee2bbac3c1 tracing: Add event record param to trigger_ops.func()
:::::: TO: Tom Zanussi <tom.zanussi@linux.intel.com>
:::::: CC: Steven Rostedt <rostedt@goodmis.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Howard Cochran <hcochran@kernelspring.com> |
|---|---|
| Date | 2016-04-15 09:00 +0200 |
| Subject | [PATCH 4/5] tracing: Make snapshot trigger affect the correct instance |
| Message-ID | <ro5Ts-79F-19@gated-at.bofh.it> |
| In reply to | #1379494 |
Currently, the snapshot trigger always snapshots the top level instance,
even if it was triggered within an instance. Fixed by using the trace_array
associated with the trace_event_file which fired the trigger.
Signed-off-by: Howard Cochran <hcochran@kernelspring.com>
---
kernel/trace/trace.c | 38 ++++++++++++++++++++++---------------
kernel/trace/trace.h | 1 +
kernel/trace/trace_events_trigger.c | 4 ++--
3 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c78fe42..e98770b 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -620,22 +620,11 @@ EXPORT_SYMBOL_GPL(__trace_bputs);
#ifdef CONFIG_TRACER_SNAPSHOT
/**
- * trace_snapshot - take a snapshot of the current buffer.
- *
- * This causes a swap between the snapshot buffer and the current live
- * tracing buffer. You can use this to take snapshots of the live
- * trace when some condition is triggered, but continue to trace.
- *
- * Note, make sure to allocate the snapshot with either
- * a tracing_snapshot_alloc(), or by doing it manually
- * with: echo 1 > /sys/kernel/debug/tracing/snapshot
- *
- * If the snapshot buffer is not allocated, it will stop tracing.
- * Basically making a permanent snapshot.
+ * trace_snapshot - take a snapshot of a buffer.
+ * @tr: Which tracing buffer (instance) to take a snapshot of
*/
-void tracing_snapshot(void)
+void __tracing_snapshot(struct trace_array *tr)
{
- struct trace_array *tr = &global_trace;
struct tracer *tracer = tr->current_trace;
unsigned long flags;
@@ -648,7 +637,7 @@ void tracing_snapshot(void)
if (!tr->allocated_snapshot) {
internal_trace_puts("*** SNAPSHOT NOT ALLOCATED ***\n");
internal_trace_puts("*** stopping trace here! ***\n");
- tracing_off();
+ tracer_tracing_off(tr);
return;
}
@@ -663,6 +652,25 @@ void tracing_snapshot(void)
update_max_tr(tr, current, smp_processor_id());
local_irq_restore(flags);
}
+
+/**
+ * trace_snapshot - take a snapshot of the top level buffer.
+ *
+ * This causes a swap between the snapshot buffer and the current live
+ * tracing buffer. You can use this to take snapshots of the live
+ * trace when some condition is triggered, but continue to trace.
+ *
+ * Note, make sure to allocate the snapshot with either
+ * a tracing_snapshot_alloc(), or by doing it manually
+ * with: echo 1 > /sys/kernel/debug/tracing/snapshot
+ *
+ * If the snapshot buffer is not allocated, it will stop tracing.
+ * Basically making a permanent snapshot.
+ */
+void tracing_snapshot(void)
+{
+ __tracing_snapshot(&global_trace);
+}
EXPORT_SYMBOL_GPL(tracing_snapshot);
static int resize_buffer_duplicate_size(struct trace_buffer *trace_buf,
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index d3bc0e8..d98d54c 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -717,6 +717,7 @@ enum print_line_t print_trace_line(struct trace_iterator *iter);
extern char trace_find_mark(unsigned long long duration);
void __trace_dump_stack(int skip, struct trace_array *tr);
+void __tracing_snapshot(struct trace_array *tr);
int tracer_tracing_is_on(struct trace_array *tr);
void tracer_tracing_on(struct trace_array *tr);
void tracer_tracing_off(struct trace_array *tr);
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index a73b823..2f7dc19 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -901,7 +901,7 @@ static void
snapshot_trigger(struct event_trigger_data *data, void *rec,
struct trace_event_file *file)
{
- tracing_snapshot();
+ __tracing_snapshot(file->tr);
}
static void
@@ -914,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
--
1.9.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web