aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kernel.h2
-rw-r--r--kernel/trace/trace.c16
-rw-r--r--kernel/trace/trace_irqsoff.c2
3 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3fa4c590cf12..5ad4199fb073 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -492,6 +492,8 @@ extern int
492__trace_printk(unsigned long ip, const char *fmt, ...) 492__trace_printk(unsigned long ip, const char *fmt, ...)
493 __attribute__ ((format (printf, 2, 3))); 493 __attribute__ ((format (printf, 2, 3)));
494 494
495extern void trace_dump_stack(void);
496
495/* 497/*
496 * The double __builtin_constant_p is because gcc will give us an error 498 * The double __builtin_constant_p is because gcc will give us an error
497 * if we try to allocate the static variable to fmt if it is not a 499 * if we try to allocate the static variable to fmt if it is not a
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 05076008f371..bd7b969a729a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1150,6 +1150,22 @@ void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
1150 __ftrace_trace_stack(tr->buffer, flags, skip, pc); 1150 __ftrace_trace_stack(tr->buffer, flags, skip, pc);
1151} 1151}
1152 1152
1153/**
1154 * trace_dump_stack - record a stack back trace in the trace buffer
1155 */
1156void trace_dump_stack(void)
1157{
1158 unsigned long flags;
1159
1160 if (tracing_disabled || tracing_selftest_running)
1161 return 0;
1162
1163 local_save_flags(flags);
1164
1165 /* skipping 3 traces, seems to get us at the caller of this function */
1166 __ftrace_trace_stack(global_trace.buffer, flags, 3, preempt_count());
1167}
1168
1153void 1169void
1154ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) 1170ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
1155{ 1171{
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 3aa7eaa2114c..2974bc7538c7 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -151,6 +151,8 @@ check_critical_timing(struct trace_array *tr,
151 goto out_unlock; 151 goto out_unlock;
152 152
153 trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc); 153 trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc);
154 /* Skip 5 functions to get to the irq/preempt enable function */
155 __trace_stack(tr, flags, 5, pc);
154 156
155 if (data->critical_sequence != max_sequence) 157 if (data->critical_sequence != max_sequence)
156 goto out_unlock; 158 goto out_unlock;