linux-stable/kernel/trace
Masami Hiramatsu fc800a10be tracing: Lock event_mutex before synth_event_mutex
synthetic event is using synth_event_mutex for protecting
synth_event_list, and event_trigger_write() path acquires
locks as below order.

event_trigger_write(event_mutex)
  ->trigger_process_regex(trigger_cmd_mutex)
    ->event_hist_trigger_func(synth_event_mutex)

On the other hand, synthetic event creation and deletion paths
call trace_add_event_call() and trace_remove_event_call()
which acquires event_mutex. In that case, if we keep the
synth_event_mutex locked while registering/unregistering synthetic
events, its dependency will be inversed.

To avoid this issue, current synthetic event is using a 2 phase
process to create/delete events. For example, it searches existing
events under synth_event_mutex to check for event-name conflicts, and
unlocks synth_event_mutex, then registers a new event under event_mutex
locked. Finally, it locks synth_event_mutex and tries to add the
new event to the list. But it can introduce complexity and a chance
for name conflicts.

To solve this simpler, this introduces trace_add_event_call_nolock()
and trace_remove_event_call_nolock() which don't acquire
event_mutex inside. synthetic event can lock event_mutex before
synth_event_mutex to solve the lock dependency issue simpler.

Link: http://lkml.kernel.org/r/154140844377.17322.13781091165954002713.stgit@devbox

Reviewed-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Tested-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
2018-12-08 20:54:09 -05:00
..
blktrace.c blkcg: revert blkcg cleanups series 2018-11-01 19:59:53 -06:00
bpf_trace.c tracing: Add SPDX License format to bpf_trace.c 2018-08-16 19:07:36 -04:00
fgraph.c function_graph: Have profiler use new helper ftrace_graph_get_ret_stack() 2018-12-08 20:54:07 -05:00
ftrace.c function_graph: Have profiler use new helper ftrace_graph_get_ret_stack() 2018-12-08 20:54:07 -05:00
ftrace_internal.h ftrace: Create new ftrace_internal.h header 2018-12-08 20:54:06 -05:00
Kconfig Masami found an off by one bug in the code that keeps "notrace" functions 2018-08-23 13:07:00 -07:00
Makefile fgraph: Create a fgraph.c file to store function graph infrastructure 2018-11-29 23:38:34 -05:00
power-traces.c
preemptirq_delay_test.c tracing: Use trace_clock_local() for looping in preemptirq_delay_test.c 2018-10-17 15:35:33 -04:00
ring_buffer.c tracing: Add tracefs file buffer_percentage 2018-12-08 20:54:08 -05:00
ring_buffer_benchmark.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
rpm-traces.c
trace.c tracing: Change default buffer_percent to 50 2018-12-08 20:54:08 -05:00
trace.h tracing: Add tracefs file buffer_percentage 2018-12-08 20:54:08 -05:00
trace_benchmark.c rcu: Rename cond_resched_rcu_qs() to cond_resched_tasks_rcu_qs() 2018-05-15 10:27:29 -07:00
trace_benchmark.h tracing: Fix SPDX format headers to use C++ style comments 2018-08-16 19:08:06 -04:00
trace_branch.c
trace_clock.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
trace_entries.h tracing: Fix SPDX format headers to use C++ style comments 2018-08-16 19:08:06 -04:00
trace_event_perf.c trace_uprobe: support reference counter in fd-based uprobe 2018-10-10 22:14:17 -04:00
trace_events.c tracing: Lock event_mutex before synth_event_mutex 2018-12-08 20:54:09 -05:00
trace_events_filter.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
trace_events_filter_test.h tracing: Fix SPDX format headers to use C++ style comments 2018-08-16 19:08:06 -04:00
trace_events_hist.c tracing: Lock event_mutex before synth_event_mutex 2018-12-08 20:54:09 -05:00
trace_events_trigger.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
trace_export.c tracing: Add trigger file for trace_markers tracefs/ftrace/print 2018-05-29 08:28:53 -04:00
trace_functions.c
trace_functions_graph.c function_graph: Move ftrace_graph_ret_addr() to fgraph.c 2018-12-08 20:54:07 -05:00
trace_hwlat.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
trace_irqsoff.c fgraph: Add new fgraph_ops structure to enable function graph hooks 2018-12-08 20:54:07 -05:00
trace_kdb.c
trace_kprobe.c tracing/kprobes: Allow kprobe-events to record module symbol 2018-10-10 22:19:12 -04:00
trace_kprobe_selftest.c selftest/ftrace: Move kprobe selftest function to separate compile unit 2018-07-30 18:41:04 -04:00
trace_kprobe_selftest.h tracing: Fix SPDX format headers to use C++ style comments 2018-08-16 19:08:06 -04:00
trace_mmiotrace.c
trace_nop.c
trace_output.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
trace_output.h tracing: Fix SPDX format headers to use C++ style comments 2018-08-16 19:08:06 -04:00
trace_preemptirq.c tracing: More reverting of "tracing: Centralize preemptirq tracepoints and unify their usage" 2018-08-10 15:12:00 -04:00
trace_printk.c tracing: Trivia spelling fix containerof() -> container_of() 2018-09-26 12:21:00 +03:00
trace_probe.c tracing/kprobes: Fix strpbrk() argument order 2018-11-05 09:47:14 -05:00
trace_probe.h tracing/kprobes: Allow kprobe-events to record module symbol 2018-10-10 22:19:12 -04:00
trace_probe_tmpl.h tracing: probeevent: Add array type support 2018-10-10 22:19:10 -04:00
trace_sched_switch.c
trace_sched_wakeup.c fgraph: Add new fgraph_ops structure to enable function graph hooks 2018-12-08 20:54:07 -05:00
trace_selftest.c fgraph: Add new fgraph_ops structure to enable function graph hooks 2018-12-08 20:54:07 -05:00
trace_selftest_dynamic.c
trace_seq.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
trace_stack.c tracing: Have trace_stack nr_entries compare not be so subtle 2018-12-08 20:54:07 -05:00
trace_stat.c
trace_stat.h tracing: Fix SPDX format headers to use C++ style comments 2018-08-16 19:08:06 -04:00
trace_syscalls.c
trace_uprobe.c tracing/uprobes: Add busy check when cleanup all uprobes 2018-12-08 20:54:08 -05:00
tracing_map.c tracing: Add SPDX License format tags to tracing files 2018-08-16 19:08:06 -04:00
tracing_map.h tracing: Fix SPDX format headers to use C++ style comments 2018-08-16 19:08:06 -04:00