Skip to content

Commit

Permalink
trace_clock: fix preemption bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Mar 10, 2009
1 parent 2395037 commit 6cc3c6e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kernel/trace/trace_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down

0 comments on commit 6cc3c6e

Please sign in to comment.