The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] tracing: Register static events output early
@ 2011-05-18 23:29 Frederic Weisbecker
  2011-05-18 23:37 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2011-05-18 23:29 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Frederic Weisbecker, Ingo Molnar

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@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: Register static events output early
  2011-05-18 23:29 [PATCH] tracing: Register static events output early Frederic Weisbecker
@ 2011-05-18 23:37 ` Steven Rostedt
  2011-05-18 23:40   ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2011-05-18 23:37 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: LKML, Ingo Molnar

On Thu, 2011-05-19 at 01:29 +0200, Frederic Weisbecker wrote:

> 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);

Hmm, careful here. The ring buffers are also allocated at early_init().

But you may be OK, as things like trace_printk() don't do anything if
"tracing_disabled" is set, and it's set on bootup and cleared after we
allocate the buffers.

-- Steve



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tracing: Register static events output early
  2011-05-18 23:37 ` Steven Rostedt
@ 2011-05-18 23:40   ` Frederic Weisbecker
  0 siblings, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2011-05-18 23:40 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Ingo Molnar

On Wed, May 18, 2011 at 07:37:19PM -0400, Steven Rostedt wrote:
> On Thu, 2011-05-19 at 01:29 +0200, Frederic Weisbecker wrote:
> 
> > 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);
> 
> Hmm, careful here. The ring buffers are also allocated at early_init().
> 
> But you may be OK, as things like trace_printk() don't do anything if
> "tracing_disabled" is set, and it's set on bootup and cleared after we
> allocate the buffers.

Yep, and the output callback only impact the read side anyway, once the trace
has been already pulled out of the buffer. I hope I'm not missing something in the
way...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-18 23:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-18 23:29 [PATCH] tracing: Register static events output early Frederic Weisbecker
2011-05-18 23:37 ` Steven Rostedt
2011-05-18 23:40   ` Frederic Weisbecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox