From: Peter Zijlstra Date: Tue, 10 Mar 2009 18:03:43 +0000 (+0100) Subject: trace_clock: fix preemption bug X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=6cc3c6e12bb039047974ad2e7e2d46d15a1b762f;p=linux-2.6-omap-h63xx.git trace_clock: fix preemption bug 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 Cc: Steven Rostedt Cc: Frederic Weisbecker Signed-off-by: Ingo Molnar --- diff --git a/kernel/trace/trace_clock.c b/kernel/trace/trace_clock.c index 2d4953f9356..05b176abfd3 100644 --- a/kernel/trace/trace_clock.c +++ b/kernel/trace/trace_clock.c @@ -27,12 +27,19 @@ */ 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; } /*