Skip to content

Commit 09d8091

Browse files
committed
tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus()
Commit a822741 "tracing: Protect ftrace_trace_arrays list in trace_events.c" added taking the trace_types_lock mutex in trace_events.c as there were several locations that needed it for protection. Unfortunately, it also encapsulated a call to tracing_reset_all_online_cpus() which also takes the trace_types_lock, causing a deadlock. This happens when a module has tracepoints and has been traced. When the module is removed, the trace events module notifier will grab the trace_types_lock, do a bunch of clean ups, and also clears the buffer by calling tracing_reset_all_online_cpus. This doesn't happen often which explains why it wasn't caught right away. Commit a822741 was marked for stable, which means this must be sent to stable too. Link: http://lkml.kernel.org/r/51EEC646.7070306@broadcom.com Reported-by: Arend van Spril <arend@broadcom.com> Tested-by: Arend van Spriel <arend@broadcom.com> Cc: Alexander Z Lam <azl@google.com> Cc: Vaibhav Nagarnaik <vnagarnaik@google.com> Cc: David Sharp <dhsharp@google.com> Cc: stable@vger.kernel.org # 3.10 Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 195a8af commit 09d8091

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎kernel/trace/trace.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,18 +1224,17 @@ void tracing_reset_current(int cpu)
12241224
tracing_reset(&global_trace.trace_buffer, cpu);
12251225
}
12261226

1227+
/* Must have trace_types_lock held */
12271228
void tracing_reset_all_online_cpus(void)
12281229
{
12291230
struct trace_array *tr;
12301231

1231-
mutex_lock(&trace_types_lock);
12321232
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
12331233
tracing_reset_online_cpus(&tr->trace_buffer);
12341234
#ifdef CONFIG_TRACER_MAX_TRACE
12351235
tracing_reset_online_cpus(&tr->max_buffer);
12361236
#endif
12371237
}
1238-
mutex_unlock(&trace_types_lock);
12391238
}
12401239

12411240
#define SAVED_CMDLINES 128

0 commit comments

Comments
 (0)