summaryrefslogtreecommitdiff
path: root/kernel/trace/trace_functions.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-20 18:59:18 +0300
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2017-04-21 05:06:49 +0300
commitdcc19d28091a86d5baf78e3fbb32e3fc3de524be (patch)
tree1b0675f001e161897b22acf17f1a10b53343a476 /kernel/trace/trace_functions.c
parent2290f2c589285d0031e3b7445afff8949f3fdbb6 (diff)
downloadlinux-dcc19d28091a86d5baf78e3fbb32e3fc3de524be.tar.xz
tracing/ftrace: Allow for instances to trigger their own stacktrace probes
Have the stacktrace function trigger probe trigger stack traces within the instance that they were added to in the set_ftrace_filter. ># cd /sys/kernel/debug/tracing ># mkdir instances/foo ># cd instances/foo ># echo schedule:stacktrace:1 > set_ftrace_filter ># cat trace # tracer: nop # # entries-in-buffer/entries-written: 1/1 #P:4 # # _-----=> irqs-off # / _----=> need-resched # | / _---=> hardirq/softirq # || / _--=> preempt-depth # ||| / delay # TASK-PID CPU# |||| TIMESTAMP FUNCTION # | | | |||| | | <idle>-0 [001] .N.2 202.585010: <stack trace> => => schedule => schedule_preempt_disabled => do_idle => cpu_startup_entry => start_secondary => verify_cpu Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_functions.c')
-rw-r--r--kernel/trace/trace_functions.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 8c30ca733a5c..a3bddbfd0874 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -375,12 +375,23 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip,
*/
#define STACK_SKIP 4
+static __always_inline void trace_stack(struct trace_array *tr)
+{
+ unsigned long flags;
+ int pc;
+
+ local_save_flags(flags);
+ pc = preempt_count();
+
+ __trace_stack(tr, flags, STACK_SKIP, pc);
+}
+
static void
ftrace_stacktrace(unsigned long ip, unsigned long parent_ip,
struct trace_array *tr, struct ftrace_probe_ops *ops,
void *data)
{
- trace_dump_stack(STACK_SKIP);
+ trace_stack(tr);
}
static void
@@ -398,7 +409,7 @@ ftrace_stacktrace_count(unsigned long ip, unsigned long parent_ip,
/* unlimited? */
if (!mapper) {
- trace_dump_stack(STACK_SKIP);
+ trace_stack(tr);
return;
}
@@ -417,7 +428,7 @@ ftrace_stacktrace_count(unsigned long ip, unsigned long parent_ip,
new_count = old_count - 1;
new_count = cmpxchg(count, old_count, new_count);
if (new_count == old_count)
- trace_dump_stack(STACK_SKIP);
+ trace_stack(tr);
if (!tracing_is_on())
return;