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 <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

authored by Steven Rostedt and committed by Ingo Molnar 47e74f2b c1e7abbc

+7 -1
+7 -1
kernel/trace/ring_buffer.c
··· 51 51 /* FIXME!!! */ 52 52 u64 ring_buffer_time_stamp(int cpu) 53 53 { 54 + u64 time; 55 + 56 + preempt_disable_notrace(); 54 57 /* shift to debug/test normalization and TIME_EXTENTS */ 55 - return sched_clock() << DEBUG_SHIFT; 58 + time = sched_clock() << DEBUG_SHIFT; 59 + preempt_enable_notrace(); 60 + 61 + return time; 56 62 } 57 63 58 64 void ring_buffer_normalize_time_stamp(int cpu, u64 *ts)