From: Steven Rostedt Date: Wed, 12 Nov 2008 05:01:27 +0000 (-0500) Subject: ring-buffer: no preempt for sched_clock() X-Git-Tag: upstream/snapshot3+hdmi~21423^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=47e74f2ba8fbf9fb1378e2524e6cfdc2fb37f160;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git ring-buffer: no preempt for sched_clock() 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 Signed-off-by: Ingo Molnar --- diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index b08ee9f..231db20 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -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)