]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ring-buffer: no preempt for sched_clock()
authorSteven Rostedt <rostedt@goodmis.org>
Wed, 12 Nov 2008 05:01:27 +0000 (00:01 -0500)
committerIngo Molnar <mingo@elte.hu>
Wed, 12 Nov 2008 10:23:36 +0000 (11:23 +0100)
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>
kernel/trace/ring_buffer.c

index b08ee9f00c8d2e918a4adc3883a535cd80be760e..231db209fa82137461efbd51eb15a8061d6437a6 100644 (file)
@@ -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)