|
@@ -1406,8 +1406,8 @@ static int subsystem_open(struct inode *inode, struct file *filp)
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
|
|
|
|
/* Make sure the system still exists */
|
|
/* Make sure the system still exists */
|
|
- mutex_lock(&trace_types_lock);
|
|
|
|
mutex_lock(&event_mutex);
|
|
mutex_lock(&event_mutex);
|
|
|
|
+ mutex_lock(&trace_types_lock);
|
|
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
|
|
list_for_each_entry(tr, &ftrace_trace_arrays, list) {
|
|
list_for_each_entry(dir, &tr->systems, list) {
|
|
list_for_each_entry(dir, &tr->systems, list) {
|
|
if (dir == inode->i_private) {
|
|
if (dir == inode->i_private) {
|
|
@@ -1421,8 +1421,8 @@ static int subsystem_open(struct inode *inode, struct file *filp)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
exit_loop:
|
|
exit_loop:
|
|
- mutex_unlock(&event_mutex);
|
|
|
|
mutex_unlock(&trace_types_lock);
|
|
mutex_unlock(&trace_types_lock);
|
|
|
|
+ mutex_unlock(&event_mutex);
|
|
|
|
|
|
if (!system)
|
|
if (!system)
|
|
return -ENODEV;
|
|
return -ENODEV;
|
|
@@ -2294,15 +2294,15 @@ static void __add_event_to_tracers(struct trace_event_call *call);
|
|
int trace_add_event_call(struct trace_event_call *call)
|
|
int trace_add_event_call(struct trace_event_call *call)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
- mutex_lock(&trace_types_lock);
|
|
|
|
mutex_lock(&event_mutex);
|
|
mutex_lock(&event_mutex);
|
|
|
|
+ mutex_lock(&trace_types_lock);
|
|
|
|
|
|
ret = __register_event(call, NULL);
|
|
ret = __register_event(call, NULL);
|
|
if (ret >= 0)
|
|
if (ret >= 0)
|
|
__add_event_to_tracers(call);
|
|
__add_event_to_tracers(call);
|
|
|
|
|
|
- mutex_unlock(&event_mutex);
|
|
|
|
mutex_unlock(&trace_types_lock);
|
|
mutex_unlock(&trace_types_lock);
|
|
|
|
+ mutex_unlock(&event_mutex);
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2356,13 +2356,13 @@ int trace_remove_event_call(struct trace_event_call *call)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- mutex_lock(&trace_types_lock);
|
|
|
|
mutex_lock(&event_mutex);
|
|
mutex_lock(&event_mutex);
|
|
|
|
+ mutex_lock(&trace_types_lock);
|
|
down_write(&trace_event_sem);
|
|
down_write(&trace_event_sem);
|
|
ret = probe_remove_event_call(call);
|
|
ret = probe_remove_event_call(call);
|
|
up_write(&trace_event_sem);
|
|
up_write(&trace_event_sem);
|
|
- mutex_unlock(&event_mutex);
|
|
|
|
mutex_unlock(&trace_types_lock);
|
|
mutex_unlock(&trace_types_lock);
|
|
|
|
+ mutex_unlock(&event_mutex);
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
@@ -2424,8 +2424,8 @@ static int trace_module_notify(struct notifier_block *self,
|
|
{
|
|
{
|
|
struct module *mod = data;
|
|
struct module *mod = data;
|
|
|
|
|
|
- mutex_lock(&trace_types_lock);
|
|
|
|
mutex_lock(&event_mutex);
|
|
mutex_lock(&event_mutex);
|
|
|
|
+ mutex_lock(&trace_types_lock);
|
|
switch (val) {
|
|
switch (val) {
|
|
case MODULE_STATE_COMING:
|
|
case MODULE_STATE_COMING:
|
|
trace_module_add_events(mod);
|
|
trace_module_add_events(mod);
|
|
@@ -2434,8 +2434,8 @@ static int trace_module_notify(struct notifier_block *self,
|
|
trace_module_remove_events(mod);
|
|
trace_module_remove_events(mod);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- mutex_unlock(&event_mutex);
|
|
|
|
mutex_unlock(&trace_types_lock);
|
|
mutex_unlock(&trace_types_lock);
|
|
|
|
+ mutex_unlock(&event_mutex);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -2950,24 +2950,24 @@ create_event_toplevel_files(struct dentry *parent, struct trace_array *tr)
|
|
* creates the event hierachry in the @parent/events directory.
|
|
* creates the event hierachry in the @parent/events directory.
|
|
*
|
|
*
|
|
* Returns 0 on success.
|
|
* Returns 0 on success.
|
|
|
|
+ *
|
|
|
|
+ * Must be called with event_mutex held.
|
|
*/
|
|
*/
|
|
int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr)
|
|
int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
- mutex_lock(&event_mutex);
|
|
|
|
|
|
+ lockdep_assert_held(&event_mutex);
|
|
|
|
|
|
ret = create_event_toplevel_files(parent, tr);
|
|
ret = create_event_toplevel_files(parent, tr);
|
|
if (ret)
|
|
if (ret)
|
|
- goto out_unlock;
|
|
|
|
|
|
+ goto out;
|
|
|
|
|
|
down_write(&trace_event_sem);
|
|
down_write(&trace_event_sem);
|
|
__trace_add_event_dirs(tr);
|
|
__trace_add_event_dirs(tr);
|
|
up_write(&trace_event_sem);
|
|
up_write(&trace_event_sem);
|
|
|
|
|
|
- out_unlock:
|
|
|
|
- mutex_unlock(&event_mutex);
|
|
|
|
-
|
|
|
|
|
|
+ out:
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2996,9 +2996,10 @@ early_event_add_tracer(struct dentry *parent, struct trace_array *tr)
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/* Must be called with event_mutex held */
|
|
int event_trace_del_tracer(struct trace_array *tr)
|
|
int event_trace_del_tracer(struct trace_array *tr)
|
|
{
|
|
{
|
|
- mutex_lock(&event_mutex);
|
|
|
|
|
|
+ lockdep_assert_held(&event_mutex);
|
|
|
|
|
|
/* Disable any event triggers and associated soft-disabled events */
|
|
/* Disable any event triggers and associated soft-disabled events */
|
|
clear_event_triggers(tr);
|
|
clear_event_triggers(tr);
|
|
@@ -3019,8 +3020,6 @@ int event_trace_del_tracer(struct trace_array *tr)
|
|
|
|
|
|
tr->event_dir = NULL;
|
|
tr->event_dir = NULL;
|
|
|
|
|
|
- mutex_unlock(&event_mutex);
|
|
|
|
-
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|