diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-07-23 22:21:59 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-04 04:50:44 -0400 |
commit | c62771c88704f0814d0fead60eadc0397a5e832f (patch) | |
tree | b0d6fedaa94d8f56ff69227236edde8c74ded190 | |
parent | e55679914313bbfc003dcdf8ff74a16dec2fe24d (diff) |
tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus()
commit 09d8091c024ec88d1541d93eb8ddb2bd5cf10c39 upstream.
Commit a82274151af "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 a82274151af 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>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | kernel/trace/trace.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 073b9e041d32..f7bc3ce6eaf6 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1163,18 +1163,17 @@ void tracing_reset_current(int cpu) | |||
1163 | tracing_reset(&global_trace.trace_buffer, cpu); | 1163 | tracing_reset(&global_trace.trace_buffer, cpu); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | /* Must have trace_types_lock held */ | ||
1166 | void tracing_reset_all_online_cpus(void) | 1167 | void tracing_reset_all_online_cpus(void) |
1167 | { | 1168 | { |
1168 | struct trace_array *tr; | 1169 | struct trace_array *tr; |
1169 | 1170 | ||
1170 | mutex_lock(&trace_types_lock); | ||
1171 | list_for_each_entry(tr, &ftrace_trace_arrays, list) { | 1171 | list_for_each_entry(tr, &ftrace_trace_arrays, list) { |
1172 | tracing_reset_online_cpus(&tr->trace_buffer); | 1172 | tracing_reset_online_cpus(&tr->trace_buffer); |
1173 | #ifdef CONFIG_TRACER_MAX_TRACE | 1173 | #ifdef CONFIG_TRACER_MAX_TRACE |
1174 | tracing_reset_online_cpus(&tr->max_buffer); | 1174 | tracing_reset_online_cpus(&tr->max_buffer); |
1175 | #endif | 1175 | #endif |
1176 | } | 1176 | } |
1177 | mutex_unlock(&trace_types_lock); | ||
1178 | } | 1177 | } |
1179 | 1178 | ||
1180 | #define SAVED_CMDLINES 128 | 1179 | #define SAVED_CMDLINES 128 |