[PATCH] tracing: Register static events output early

From: Frederic Weisbecker
Date: Wed May 18 2011 - 19:29:42 EST


Early uses of trace_printk() or trace_dump_stack() won't be
displayed correctly if they are printed before device initcalls
through explicit calls to ftrace_dump() or if there is an early
BUG() and ftrace_dump_on_oops is set. This is because we only
initialize these static events output callbacks at that initcall
level.

Initialize these events output at the earliest initcall state
to make boot debugging possible sooner.

Before:

[ 1.936168] Dumping ftrace buffer:
[ 1.936168] ---------------------------------
[ 1.936168] <idle>-0 3d.s. 2299861us : Unknown type 4
[ 1.936168] ---------------------------------

After:

[ 1.946182] Dumping ftrace buffer:
[ 1.946182] ---------------------------------
[ 1.946182] <idle>-0 3d.s. 2309844us : <stack trace>
[ 1.946182] => tick_setup_sched_timer
[ 1.946182] => hrtimer_run_pending
[ 1.946182] => run_timer_softirq
[ 1.946182] => __do_softirq
[ 1.946182] => call_softirq
[ 1.946182] => do_softirq
[ 1.946182] => irq_exit
[ 1.946182] => smp_apic_timer_interrupt
[ 1.946182] ---------------------------------

Signed-off-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
---
kernel/trace/trace_output.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index cf535cc..ad92d9c 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -1278,4 +1278,4 @@ __init static int init_events(void)

return 0;
}
-device_initcall(init_events);
+early_initcall(init_events);
--
1.7.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/