diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index b3f1c09870ca29fb75bafd715de5e1ca4f4e9b69..2bfc4f10f7d6f08faccb303a0dd8ca3b4a78e713 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -1907,8 +1907,10 @@ static int __osnoise_tracer_start(struct trace_array *tr) retval = osnoise_hook_events(); if (retval) return retval; + /* - * Make sure NMIs see reseted values. + * Make sure that ftrace_nmi_enter/exit() see reset values + * before enabling trace_osnoise_callback_enabled. */ barrier(); trace_osnoise_callback_enabled = true; @@ -1943,6 +1945,10 @@ static void osnoise_tracer_stop(struct trace_array *tr) return; trace_osnoise_callback_enabled = false; + /* + * Make sure that ftrace_nmi_enter/exit() see + * trace_osnoise_callback_enabled as false before continuing. + */ barrier(); stop_per_cpu_kthreads();