diff options
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 2b3e23991c8a..dcee546f21bc 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -436,6 +436,9 @@ static int remove_ftrace_list_ops(struct ftrace_ops **list, | |||
436 | 436 | ||
437 | static int __register_ftrace_function(struct ftrace_ops *ops) | 437 | static int __register_ftrace_function(struct ftrace_ops *ops) |
438 | { | 438 | { |
439 | if (ops->flags & FTRACE_OPS_FL_DELETED) | ||
440 | return -EINVAL; | ||
441 | |||
439 | if (FTRACE_WARN_ON(ops == &global_ops)) | 442 | if (FTRACE_WARN_ON(ops == &global_ops)) |
440 | return -EINVAL; | 443 | return -EINVAL; |
441 | 444 | ||
@@ -4112,6 +4115,36 @@ static const struct file_operations ftrace_graph_notrace_fops = { | |||
4112 | }; | 4115 | }; |
4113 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 4116 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
4114 | 4117 | ||
4118 | void ftrace_create_filter_files(struct ftrace_ops *ops, | ||
4119 | struct dentry *parent) | ||
4120 | { | ||
4121 | |||
4122 | trace_create_file("set_ftrace_filter", 0644, parent, | ||
4123 | ops, &ftrace_filter_fops); | ||
4124 | |||
4125 | trace_create_file("set_ftrace_notrace", 0644, parent, | ||
4126 | ops, &ftrace_notrace_fops); | ||
4127 | } | ||
4128 | |||
4129 | /* | ||
4130 | * The name "destroy_filter_files" is really a misnomer. Although | ||
4131 | * in the future, it may actualy delete the files, but this is | ||
4132 | * really intended to make sure the ops passed in are disabled | ||
4133 | * and that when this function returns, the caller is free to | ||
4134 | * free the ops. | ||
4135 | * | ||
4136 | * The "destroy" name is only to match the "create" name that this | ||
4137 | * should be paired with. | ||
4138 | */ | ||
4139 | void ftrace_destroy_filter_files(struct ftrace_ops *ops) | ||
4140 | { | ||
4141 | mutex_lock(&ftrace_lock); | ||
4142 | if (ops->flags & FTRACE_OPS_FL_ENABLED) | ||
4143 | ftrace_shutdown(ops, 0); | ||
4144 | ops->flags |= FTRACE_OPS_FL_DELETED; | ||
4145 | mutex_unlock(&ftrace_lock); | ||
4146 | } | ||
4147 | |||
4115 | static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer) | 4148 | static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer) |
4116 | { | 4149 | { |
4117 | 4150 | ||
@@ -4121,11 +4154,7 @@ static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer) | |||
4121 | trace_create_file("enabled_functions", 0444, | 4154 | trace_create_file("enabled_functions", 0444, |
4122 | d_tracer, NULL, &ftrace_enabled_fops); | 4155 | d_tracer, NULL, &ftrace_enabled_fops); |
4123 | 4156 | ||
4124 | trace_create_file("set_ftrace_filter", 0644, d_tracer, | 4157 | ftrace_create_filter_files(&global_ops, d_tracer); |
4125 | &global_ops, &ftrace_filter_fops); | ||
4126 | |||
4127 | trace_create_file("set_ftrace_notrace", 0644, d_tracer, | ||
4128 | &global_ops, &ftrace_notrace_fops); | ||
4129 | 4158 | ||
4130 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | 4159 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
4131 | trace_create_file("set_graph_function", 0444, d_tracer, | 4160 | trace_create_file("set_graph_function", 0444, d_tracer, |