[lkml]   [2013]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[for-next-3.11][PATCH 9/9] tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus()
From: "Steven Rostedt (Red Hat)" <>

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.

Cc: Alexander Z Lam <>
Cc: Vaibhav Nagarnaik <>
Cc: David Sharp <>
Cc: # 3.10
Signed-off-by: Steven Rostedt <>
kernel/trace/trace.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 69cba47..882ec1d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1224,18 +1224,17 @@ void tracing_reset_current(int cpu)
tracing_reset(&global_trace.trace_buffer, cpu);

+/* Must have trace_types_lock held */
void tracing_reset_all_online_cpus(void)
struct trace_array *tr;

- mutex_lock(&trace_types_lock);
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
- mutex_unlock(&trace_types_lock);

#define SAVED_CMDLINES 128

 \ /
  Last update: 2013-07-24 18:21    [W:0.057 / U:2.276 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site