]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
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 2d4953f93560cebcaab9f108888b227d741231df..05b176abfd30cbffe335dd49a41b56c0519c30b1 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;
 }
 
 /*