aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ftrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r--kernel/trace/ftrace.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4f228024055b..02bece4a99ea 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -18,7 +18,7 @@
18#include <linux/kallsyms.h> 18#include <linux/kallsyms.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/suspend.h> 20#include <linux/suspend.h>
21#include <linux/debugfs.h> 21#include <linux/tracefs.h>
22#include <linux/hardirq.h> 22#include <linux/hardirq.h>
23#include <linux/kthread.h> 23#include <linux/kthread.h>
24#include <linux/uaccess.h> 24#include <linux/uaccess.h>
@@ -249,6 +249,19 @@ static void update_function_graph_func(void);
249static inline void update_function_graph_func(void) { } 249static inline void update_function_graph_func(void) { }
250#endif 250#endif
251 251
252
253static ftrace_func_t ftrace_ops_get_list_func(struct ftrace_ops *ops)
254{
255 /*
256 * If this is a dynamic ops or we force list func,
257 * then it needs to call the list anyway.
258 */
259 if (ops->flags & FTRACE_OPS_FL_DYNAMIC || FTRACE_FORCE_LIST_FUNC)
260 return ftrace_ops_list_func;
261
262 return ftrace_ops_get_func(ops);
263}
264
252static void update_ftrace_function(void) 265static void update_ftrace_function(void)
253{ 266{
254 ftrace_func_t func; 267 ftrace_func_t func;
@@ -270,7 +283,7 @@ static void update_ftrace_function(void)
270 * then have the mcount trampoline call the function directly. 283 * then have the mcount trampoline call the function directly.
271 */ 284 */
272 } else if (ftrace_ops_list->next == &ftrace_list_end) { 285 } else if (ftrace_ops_list->next == &ftrace_list_end) {
273 func = ftrace_ops_get_func(ftrace_ops_list); 286 func = ftrace_ops_get_list_func(ftrace_ops_list);
274 287
275 } else { 288 } else {
276 /* Just use the default ftrace_ops */ 289 /* Just use the default ftrace_ops */
@@ -1008,7 +1021,7 @@ static struct tracer_stat function_stats __initdata = {
1008 .stat_show = function_stat_show 1021 .stat_show = function_stat_show
1009}; 1022};
1010 1023
1011static __init void ftrace_profile_debugfs(struct dentry *d_tracer) 1024static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
1012{ 1025{
1013 struct ftrace_profile_stat *stat; 1026 struct ftrace_profile_stat *stat;
1014 struct dentry *entry; 1027 struct dentry *entry;
@@ -1044,15 +1057,15 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
1044 } 1057 }
1045 } 1058 }
1046 1059
1047 entry = debugfs_create_file("function_profile_enabled", 0644, 1060 entry = tracefs_create_file("function_profile_enabled", 0644,
1048 d_tracer, NULL, &ftrace_profile_fops); 1061 d_tracer, NULL, &ftrace_profile_fops);
1049 if (!entry) 1062 if (!entry)
1050 pr_warning("Could not create debugfs " 1063 pr_warning("Could not create tracefs "
1051 "'function_profile_enabled' entry\n"); 1064 "'function_profile_enabled' entry\n");
1052} 1065}
1053 1066
1054#else /* CONFIG_FUNCTION_PROFILER */ 1067#else /* CONFIG_FUNCTION_PROFILER */
1055static __init void ftrace_profile_debugfs(struct dentry *d_tracer) 1068static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
1056{ 1069{
1057} 1070}
1058#endif /* CONFIG_FUNCTION_PROFILER */ 1071#endif /* CONFIG_FUNCTION_PROFILER */
@@ -4712,7 +4725,7 @@ void ftrace_destroy_filter_files(struct ftrace_ops *ops)
4712 mutex_unlock(&ftrace_lock); 4725 mutex_unlock(&ftrace_lock);
4713} 4726}
4714 4727
4715static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer) 4728static __init int ftrace_init_dyn_tracefs(struct dentry *d_tracer)
4716{ 4729{
4717 4730
4718 trace_create_file("available_filter_functions", 0444, 4731 trace_create_file("available_filter_functions", 0444,
@@ -5020,7 +5033,7 @@ static int __init ftrace_nodyn_init(void)
5020} 5033}
5021core_initcall(ftrace_nodyn_init); 5034core_initcall(ftrace_nodyn_init);
5022 5035
5023static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; } 5036static inline int ftrace_init_dyn_tracefs(struct dentry *d_tracer) { return 0; }
5024static inline void ftrace_startup_enable(int command) { } 5037static inline void ftrace_startup_enable(int command) { }
5025static inline void ftrace_startup_all(int command) { } 5038static inline void ftrace_startup_all(int command) { }
5026/* Keep as macros so we do not need to define the commands */ 5039/* Keep as macros so we do not need to define the commands */
@@ -5209,13 +5222,6 @@ static void ftrace_ops_recurs_func(unsigned long ip, unsigned long parent_ip,
5209ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops) 5222ftrace_func_t ftrace_ops_get_func(struct ftrace_ops *ops)
5210{ 5223{
5211 /* 5224 /*
5212 * If this is a dynamic ops or we force list func,
5213 * then it needs to call the list anyway.
5214 */
5215 if (ops->flags & FTRACE_OPS_FL_DYNAMIC || FTRACE_FORCE_LIST_FUNC)
5216 return ftrace_ops_list_func;
5217
5218 /*
5219 * If the func handles its own recursion, call it directly. 5225 * If the func handles its own recursion, call it directly.
5220 * Otherwise call the recursion protected function that 5226 * Otherwise call the recursion protected function that
5221 * will call the ftrace ops function. 5227 * will call the ftrace ops function.
@@ -5473,7 +5479,7 @@ static const struct file_operations ftrace_pid_fops = {
5473 .release = ftrace_pid_release, 5479 .release = ftrace_pid_release,
5474}; 5480};
5475 5481
5476static __init int ftrace_init_debugfs(void) 5482static __init int ftrace_init_tracefs(void)
5477{ 5483{
5478 struct dentry *d_tracer; 5484 struct dentry *d_tracer;
5479 5485
@@ -5481,16 +5487,16 @@ static __init int ftrace_init_debugfs(void)
5481 if (IS_ERR(d_tracer)) 5487 if (IS_ERR(d_tracer))
5482 return 0; 5488 return 0;
5483 5489
5484 ftrace_init_dyn_debugfs(d_tracer); 5490 ftrace_init_dyn_tracefs(d_tracer);
5485 5491
5486 trace_create_file("set_ftrace_pid", 0644, d_tracer, 5492 trace_create_file("set_ftrace_pid", 0644, d_tracer,
5487 NULL, &ftrace_pid_fops); 5493 NULL, &ftrace_pid_fops);
5488 5494
5489 ftrace_profile_debugfs(d_tracer); 5495 ftrace_profile_tracefs(d_tracer);
5490 5496
5491 return 0; 5497 return 0;
5492} 5498}
5493fs_initcall(ftrace_init_debugfs); 5499fs_initcall(ftrace_init_tracefs);
5494 5500
5495/** 5501/**
5496 * ftrace_kill - kill ftrace 5502 * ftrace_kill - kill ftrace