Fix: lttng trace-clock needs to disable preemption
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 9 Oct 2015 16:24:23 +0000 (12:24 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 21 Oct 2015 19:41:06 +0000 (15:41 -0400)
We use a per-cpu data structure, and some contexts (e.g. buffer create)
call this function with preemption enabled. This is the case also for
buffer flush operation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
wrapper/trace-clock.h

index d7d18429ba1c1f17d22d35c4ce6ec8484aef422e..561094b3ae924a6545cf795f0ba838040c1273fe 100644 (file)
@@ -90,7 +90,7 @@ static inline u64 trace_clock_fixup(u64 src_now, u64 last)
 #endif /* #else #if (BITS_PER_LONG == 32) */
 
 /*
- * Always called with preemption disabled. Can be interrupted.
+ * Sometimes called with preemption enabled. Can be interrupted.
  */
 static inline u64 trace_clock_monotonic_wrapper(void)
 {
@@ -99,6 +99,7 @@ static inline u64 trace_clock_monotonic_wrapper(void)
        local_t *last_tsc;
 
        /* Use fast nmi-safe monotonic clock provided by the Linux kernel. */
+       preempt_disable();
        last_tsc = lttng_this_cpu_ptr(&lttng_last_tsc);
        last = local_read(last_tsc);
        /*
@@ -112,6 +113,7 @@ static inline u64 trace_clock_monotonic_wrapper(void)
        if (((long) now - (long) last) < 0)
                now = trace_clock_fixup(now, last);
        result = local_cmpxchg(last_tsc, last, (unsigned long) now);
+       preempt_enable();
        if (result == last) {
                /* Update done. */
                return now;
This page took 0.026216 seconds and 4 git commands to generate.