Skip to content

Commit

Permalink
ring-buffer: no preempt for sched_clock()
Browse files Browse the repository at this point in the history
Impact: disable preemption when calling sched_clock()

The ring_buffer_time_stamp still uses sched_clock as its counter.
But it is a bug to call it with preemption enabled. This requirement
should not be pushed to the ring_buffer_time_stamp callers, so
the ring_buffer_time_stamp needs to disable preemption when calling
sched_clock.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
rostedt authored and Ingo Molnar committed Nov 12, 2008
1 parent c1e7abb commit 47e74f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion kernel/trace/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ void tracing_off(void)
/* FIXME!!! */
u64 ring_buffer_time_stamp(int cpu)
{
u64 time;

preempt_disable_notrace();
/* shift to debug/test normalization and TIME_EXTENTS */
return sched_clock() << DEBUG_SHIFT;
time = sched_clock() << DEBUG_SHIFT;
preempt_enable_notrace();

return time;
}

void ring_buffer_normalize_time_stamp(int cpu, u64 *ts)
Expand Down

0 comments on commit 47e74f2

Please sign in to comment.