Pārlūkot izejas kodu

Merge branch 'tip/tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/urgent

Ingo Molnar 15 gadi atpakaļ
vecāks
revīzija
0087aabd6a
3 mainītis faili ar 20 papildinājumiem un 0 dzēšanām
  1. 2 0
      include/linux/kernel.h
  2. 16 0
      kernel/trace/trace.c
  3. 2 0
      kernel/trace/trace_irqsoff.c

+ 2 - 0
include/linux/kernel.h

@@ -492,6 +492,8 @@ extern int
 __trace_printk(unsigned long ip, const char *fmt, ...)
 __trace_printk(unsigned long ip, const char *fmt, ...)
 	__attribute__ ((format (printf, 2, 3)));
 	__attribute__ ((format (printf, 2, 3)));
 
 
+extern void trace_dump_stack(void);
+
 /*
 /*
  * The double __builtin_constant_p is because gcc will give us an error
  * The double __builtin_constant_p is because gcc will give us an error
  * if we try to allocate the static variable to fmt if it is not a
  * if we try to allocate the static variable to fmt if it is not a

+ 16 - 0
kernel/trace/trace.c

@@ -1150,6 +1150,22 @@ void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
 	__ftrace_trace_stack(tr->buffer, flags, skip, pc);
 	__ftrace_trace_stack(tr->buffer, flags, skip, pc);
 }
 }
 
 
+/**
+ * trace_dump_stack - record a stack back trace in the trace buffer
+ */
+void trace_dump_stack(void)
+{
+	unsigned long flags;
+
+	if (tracing_disabled || tracing_selftest_running)
+		return 0;
+
+	local_save_flags(flags);
+
+	/* skipping 3 traces, seems to get us at the caller of this function */
+	__ftrace_trace_stack(global_trace.buffer, flags, 3, preempt_count());
+}
+
 void
 void
 ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc)
 {
 {

+ 2 - 0
kernel/trace/trace_irqsoff.c

@@ -151,6 +151,8 @@ check_critical_timing(struct trace_array *tr,
 		goto out_unlock;
 		goto out_unlock;
 
 
 	trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc);
 	trace_function(tr, CALLER_ADDR0, parent_ip, flags, pc);
+	/* Skip 5 functions to get to the irq/preempt enable function */
+	__trace_stack(tr, flags, 5, pc);
 
 
 	if (data->critical_sequence != max_sequence)
 	if (data->critical_sequence != max_sequence)
 		goto out_unlock;
 		goto out_unlock;