tracing/ftrace: make nop tracer reset previous entries

If nop tracer is selected, some old entries from the previous tracer
could still be enqueued. Tracing have to be reset.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
diff --git a/kernel/trace/trace_nop.c b/kernel/trace/trace_nop.c
index dafaefb..9fb02c1 100644
--- a/kernel/trace/trace_nop.c
+++ b/kernel/trace/trace_nop.c
@@ -26,8 +26,12 @@
 
 static void nop_trace_init(struct trace_array *tr)
 {
+	int cpu;
 	ctx_trace = tr;
 
+	for_each_online_cpu(cpu)
+		tracing_reset(tr->data[cpu]);
+
 	if (tr->ctrl)
 		start_nop_trace(tr);
 }