trace_clock: fix preemption bug
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Tue, 10 Mar 2009 18:03:43 +0000 (19:03 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 10 Mar 2009 19:03:01 +0000 (20:03 +0100)
Using the function_graph tracer in recent kernels generates a spew of
preemption BUGs. Fix this by not requiring trace_clock_local() users
to disable preemption themselves.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace_clock.c

index 2d4953f..05b176a 100644 (file)
  */
 u64 notrace trace_clock_local(void)
 {
+       unsigned long flags;
+       u64 clock;
+
        /*
         * sched_clock() is an architecture implemented, fast, scalable,
         * lockless clock. It is not guaranteed to be coherent across
         * CPUs, nor across CPU idle events.
         */
-       return sched_clock();
+       raw_local_irq_save(flags);
+       clock = sched_clock();
+       raw_local_irq_restore(flags);
+
+       return clock;
 }
 
 /*