[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1460759535-22403-3-git-send-email-hcochran@kernelspring.com>
Date: Fri, 15 Apr 2016 18:32:12 -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 2/5] tracing: Make stacktrace trigger affect the correct instance
Currently, the stacktrace trigger always dumps the stack into the top
level buffer, 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@...nelspring.com>
---
kernel/trace/trace.c | 21 +++++++++++++++++----
kernel/trace/trace.h | 2 ++
kernel/trace/trace_events_trigger.c | 2 +-
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a2f0b9f..5541517 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1900,14 +1900,15 @@ void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
}
/**
- * trace_dump_stack - record a stack back trace in the trace buffer
+ * __trace_dump_stack - record a stack back trace in the given trace buffer
* @skip: Number of functions to skip (helper handlers)
+ * @tr: Which trace buffer (instance) to write to
*/
-void trace_dump_stack(int skip)
+void __trace_dump_stack(int skip, struct trace_array *tr)
{
unsigned long flags;
- if (tracing_disabled || tracing_selftest_running)
+ if (tracing_disabled || tr->buffer_disabled || tracing_selftest_running)
return;
local_save_flags(flags);
@@ -1917,10 +1918,22 @@ void trace_dump_stack(int skip)
* this function.
*/
skip += 3;
- __ftrace_trace_stack(global_trace.trace_buffer.buffer,
+ __ftrace_trace_stack(tr->trace_buffer.buffer,
flags, skip, preempt_count(), NULL);
}
+/**
+ * trace_dump_stack - record a stack back trace in the top-level trace buffer
+ * @skip: Number of functions to skip (helper handlers)
+ */
+void trace_dump_stack(int skip)
+{
+ /* This wrapper function deepens the stack one level */
+ skip += 1;
+
+ __trace_dump_stack(skip, &global_trace);
+}
+
static DEFINE_PER_CPU(int, user_stack_count);
void
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index ca4915f..00a5419 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -716,6 +716,8 @@ 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);
+
/* Standard output formatting function used for function return traces */
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_events_trigger.c
index a3336f2..670aa05 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -996,7 +996,7 @@ static void
stacktrace_trigger(struct event_trigger_data *data, void *rec,
struct trace_event_file *file)
{
- trace_dump_stack(STACK_SKIP);
+ __trace_dump_stack(STACK_SKIP, file->tr);
}
static void
--
1.9.1
Powered by blists - more mailing lists