History

tracing: Remove locking trace_types_lock from tracing_reset_all_online_cpus()

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

Steven Rostedt (Red Hat) committed 13 years ago

Commit 09d80911 parent 195a8af1 file · +1 −2Browse files

Unified · Split

kernel/trace/trace.c+1−2
@@ -1224,18 +1224,17 @@ void tracing_reset_current(int cpu) · 1223 unmodified lines
1224 tracing_reset(&global_trace.trace_buffer, cpu);1224 tracing_reset(&global_trace.trace_buffer, cpu);
1225}1225}
1226 1226
1227/* Must have trace_types_lock held */
1227void tracing_reset_all_online_cpus(void)1228void tracing_reset_all_online_cpus(void)
1228{1229{
1229 struct trace_array *tr;1230 struct trace_array *tr;
1230 1231
1231 mutex_lock(&trace_types_lock);
1232 list_for_each_entry(tr, &ftrace_trace_arrays, list) {1232 list_for_each_entry(tr, &ftrace_trace_arrays, list) {
1233 tracing_reset_online_cpus(&tr->trace_buffer);1233 tracing_reset_online_cpus(&tr->trace_buffer);
1234#ifdef CONFIG_TRACER_MAX_TRACE1234#ifdef CONFIG_TRACER_MAX_TRACE
1235 tracing_reset_online_cpus(&tr->max_buffer);1235 tracing_reset_online_cpus(&tr->max_buffer);
1236#endif1236#endif
1237 }1237 }
1238 mutex_unlock(&trace_types_lock);
1239}1238}
1240 1239
1241#define SAVED_CMDLINES 1281240#define SAVED_CMDLINES 128

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t