Re: ftrace not working?

From: Nikanth Karthikesan
Date: Tue Mar 24 2009 - 13:26:37 EST


On Monday 23 March 2009 20:02:26 Ingo Molnar wrote:
> * KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> > > On Monday 23 March 2009 14:05:33 Ingo Molnar wrote:
> > > > one thing to note:
> > > > | CPU0: Intel QEMU Virtual CPU version 0.9.1 stepping 03
> > > > | Testing tracer nop: PASSED
> > > >
> > > > so it's a Qemu session, right?
> > >
> > > Yes. qemu-kvm.
> >
> > Ah, sorry. I don't know qemu and kvm at all ;)
>
> In terms of tracing it should just look like some weird old CPU with
> few capabilities and long delays. Nothing in ftrace depends on CPU
> capabilities (that wasnt present in pentia) so this is weird.
> Perhaps some timestamping problem? Virtual machines tend to have
> trouble with the TSC. Or code patching problems? But that does not
> explain the lack of explicit scheduler events.
>
> Or perhaps the fact that qemu sessions tend to boot with barely any
> RAM. Maybe the ringbuffer size is very low?
>

Nope, it is not a qemu problem, but ftrace. Most probably, it shouldn't work on
real hardware as well with my config. i.e., CONFIG_CPUMASK_OFFSTACK = y
and NR_CPUS = 4096 via CONFIG_MAXSMP.

The tracing_buffer_mask was getting freed and the bitmask was all zeros. And
for_each_tracing_cpu() never looped. Here is the patch that fixes the issue
for me. Tested only on qemu-kvm. ;)

Steve, Can you merge this.

Thanks
Nikanth

In tracer_alloc_buffers(), do not free tracing_cpumask and tracing_buffer_mask
on success.

Signed-off-by: Nikanth Karthikesan <knikanth@xxxxxxx>

---

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 17bb88d..98f609d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3887,6 +3887,7 @@ __init static int tracer_alloc_buffers(void)

register_die_notifier(&trace_die_notifier);
ret = 0;
+ goto out;

out_free_cpumask:
free_cpumask_var(tracing_cpumask);


--
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/