Commit fc800a1
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>1 parent 547cd9e commit fc800a1
File tree
3 files changed
+40
-20
lines changed- include/linux
- kernel/trace
3 files changed
+40
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
529 | 529 | | |
530 | 530 | | |
531 | 531 | | |
| 532 | + | |
| 533 | + | |
532 | 534 | | |
533 | 535 | | |
534 | 536 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2305 | 2305 | | |
2306 | 2306 | | |
2307 | 2307 | | |
2308 | | - | |
2309 | | - | |
| 2308 | + | |
2310 | 2309 | | |
2311 | 2310 | | |
2312 | | - | |
| 2311 | + | |
| 2312 | + | |
2313 | 2313 | | |
2314 | 2314 | | |
2315 | 2315 | | |
2316 | 2316 | | |
2317 | 2317 | | |
2318 | 2318 | | |
2319 | 2319 | | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
2320 | 2330 | | |
2321 | 2331 | | |
2322 | 2332 | | |
| |||
2366 | 2376 | | |
2367 | 2377 | | |
2368 | 2378 | | |
2369 | | - | |
2370 | | - | |
| 2379 | + | |
| 2380 | + | |
2371 | 2381 | | |
2372 | 2382 | | |
2373 | 2383 | | |
2374 | | - | |
| 2384 | + | |
| 2385 | + | |
2375 | 2386 | | |
2376 | 2387 | | |
2377 | 2388 | | |
2378 | 2389 | | |
2379 | 2390 | | |
| 2391 | + | |
| 2392 | + | |
| 2393 | + | |
| 2394 | + | |
| 2395 | + | |
| 2396 | + | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
| 2400 | + | |
| 2401 | + | |
2380 | 2402 | | |
2381 | 2403 | | |
2382 | 2404 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
915 | | - | |
| 915 | + | |
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
| |||
936 | 936 | | |
937 | 937 | | |
938 | 938 | | |
939 | | - | |
| 939 | + | |
940 | 940 | | |
941 | 941 | | |
942 | 942 | | |
| |||
1013 | 1013 | | |
1014 | 1014 | | |
1015 | 1015 | | |
1016 | | - | |
1017 | 1016 | | |
1018 | 1017 | | |
1019 | 1018 | | |
1020 | 1019 | | |
1021 | | - | |
1022 | 1020 | | |
1023 | 1021 | | |
1024 | 1022 | | |
| |||
1030 | 1028 | | |
1031 | 1029 | | |
1032 | 1030 | | |
| 1031 | + | |
1033 | 1032 | | |
1034 | 1033 | | |
1035 | 1034 | | |
| |||
1102 | 1101 | | |
1103 | 1102 | | |
1104 | 1103 | | |
1105 | | - | |
1106 | | - | |
1107 | 1104 | | |
1108 | 1105 | | |
1109 | 1106 | | |
| |||
1113 | 1110 | | |
1114 | 1111 | | |
1115 | 1112 | | |
| 1113 | + | |
| 1114 | + | |
1116 | 1115 | | |
1117 | 1116 | | |
1118 | 1117 | | |
1119 | 1118 | | |
| 1119 | + | |
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
| |||
1127 | 1127 | | |
1128 | 1128 | | |
1129 | 1129 | | |
1130 | | - | |
1131 | 1130 | | |
1132 | 1131 | | |
1133 | 1132 | | |
1134 | | - | |
1135 | | - | |
| 1133 | + | |
1136 | 1134 | | |
1137 | 1135 | | |
1138 | 1136 | | |
| |||
1142 | 1140 | | |
1143 | 1141 | | |
1144 | 1142 | | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
| 1143 | + | |
1150 | 1144 | | |
1151 | 1145 | | |
1152 | 1146 | | |
1153 | 1147 | | |
1154 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
1155 | 1151 | | |
1156 | 1152 | | |
1157 | 1153 | | |
| |||
0 commit comments