From: Mathieu Desnoyers Date: Fri, 9 Oct 2015 16:24:23 +0000 (-0400) Subject: Fix: lttng trace-clock needs to disable preemption X-Git-Tag: v2.8.0-rc1~65 X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;ds=sidebyside;h=0aaa722073d030aad363e70d815c2508e273c570;p=lttng-modules.git Fix: lttng trace-clock needs to disable preemption 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 --- diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h index d2b7f19d..d6439c7f 100644 --- a/wrapper/trace-clock.h +++ b/wrapper/trace-clock.h @@ -93,7 +93,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) { @@ -102,6 +102,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(<tng_last_tsc); last = local_read(last_tsc); /* @@ -115,6 +116,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;