aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-01-20 12:13:40 -0500
committerSteven Rostedt <rostedt@goodmis.org>2015-02-03 12:48:41 -0500
commit8434dc9340cd2e117fc944cf7526263bf490a52a (patch)
tree189d9f437a1b0c01d32bff18afdc4f7cb8093a00
parent4282d60689d4f21b40692029080440cc58e8a17d (diff)
tracing: Convert the tracing facility over to use tracefs
debugfs was fine for the tracing facility as a quick way to get an interface. Now that tracing has matured, it should separate itself from debugfs such that it can be mounted separately without needing to mount all of debugfs with it. That is, users resist using tracing because it requires mounting debugfs. Having tracing have its own file system lets users get the features of tracing without needing to bring in the rest of the kernel's debug infrastructure. Another reason for tracefs is that debubfs does not support mkdir. Currently, to create instances, one does a mkdir in the tracing/instance directory. This is implemented via a hack that forces debugfs to do something it is not intended on doing. By converting over to tracefs, this hack can be removed and mkdir can be properly implemented. This patch does not address this yet, but it lays the ground work for that to be done. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/trace/ftrace.c22
-rw-r--r--kernel/trace/trace.c55
-rw-r--r--kernel/trace/trace.h2
-rw-r--r--kernel/trace/trace_events.c32
-rw-r--r--kernel/trace/trace_functions_graph.c7
-rw-r--r--kernel/trace/trace_kprobe.c10
-rw-r--r--kernel/trace/trace_probe.h2
-rw-r--r--kernel/trace/trace_stat.c10
8 files changed, 74 insertions, 66 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 45e5cb143d17..fcc0e7052a79 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>
@@ -1008,7 +1008,7 @@ static struct tracer_stat function_stats __initdata = {
1008 .stat_show = function_stat_show 1008 .stat_show = function_stat_show
1009}; 1009};
1010 1010
1011static __init void ftrace_profile_debugfs(struct dentry *d_tracer) 1011static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
1012{ 1012{
1013 struct ftrace_profile_stat *stat; 1013 struct ftrace_profile_stat *stat;
1014 struct dentry *entry; 1014 struct dentry *entry;
@@ -1044,15 +1044,15 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
1044 } 1044 }
1045 } 1045 }
1046 1046
1047 entry = debugfs_create_file("function_profile_enabled", 0644, 1047 entry = tracefs_create_file("function_profile_enabled", 0644,
1048 d_tracer, NULL, &ftrace_profile_fops); 1048 d_tracer, NULL, &ftrace_profile_fops);
1049 if (!entry) 1049 if (!entry)
1050 pr_warning("Could not create debugfs " 1050 pr_warning("Could not create tracefs "
1051 "'function_profile_enabled' entry\n"); 1051 "'function_profile_enabled' entry\n");
1052} 1052}
1053 1053
1054#else /* CONFIG_FUNCTION_PROFILER */ 1054#else /* CONFIG_FUNCTION_PROFILER */
1055static __init void ftrace_profile_debugfs(struct dentry *d_tracer) 1055static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
1056{ 1056{
1057} 1057}
1058#endif /* CONFIG_FUNCTION_PROFILER */ 1058#endif /* CONFIG_FUNCTION_PROFILER */
@@ -4690,7 +4690,7 @@ void ftrace_destroy_filter_files(struct ftrace_ops *ops)
4690 mutex_unlock(&ftrace_lock); 4690 mutex_unlock(&ftrace_lock);
4691} 4691}
4692 4692
4693static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer) 4693static __init int ftrace_init_dyn_tracefs(struct dentry *d_tracer)
4694{ 4694{
4695 4695
4696 trace_create_file("available_filter_functions", 0444, 4696 trace_create_file("available_filter_functions", 0444,
@@ -4998,7 +4998,7 @@ static int __init ftrace_nodyn_init(void)
4998} 4998}
4999core_initcall(ftrace_nodyn_init); 4999core_initcall(ftrace_nodyn_init);
5000 5000
5001static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; } 5001static inline int ftrace_init_dyn_tracefs(struct dentry *d_tracer) { return 0; }
5002static inline void ftrace_startup_enable(int command) { } 5002static inline void ftrace_startup_enable(int command) { }
5003static inline void ftrace_startup_all(int command) { } 5003static inline void ftrace_startup_all(int command) { }
5004/* Keep as macros so we do not need to define the commands */ 5004/* Keep as macros so we do not need to define the commands */
@@ -5451,7 +5451,7 @@ static const struct file_operations ftrace_pid_fops = {
5451 .release = ftrace_pid_release, 5451 .release = ftrace_pid_release,
5452}; 5452};
5453 5453
5454static __init int ftrace_init_debugfs(void) 5454static __init int ftrace_init_tracefs(void)
5455{ 5455{
5456 struct dentry *d_tracer; 5456 struct dentry *d_tracer;
5457 5457
@@ -5459,16 +5459,16 @@ static __init int ftrace_init_debugfs(void)
5459 if (IS_ERR(d_tracer)) 5459 if (IS_ERR(d_tracer))
5460 return 0; 5460 return 0;
5461 5461
5462 ftrace_init_dyn_debugfs(d_tracer); 5462 ftrace_init_dyn_tracefs(d_tracer);
5463 5463
5464 trace_create_file("set_ftrace_pid", 0644, d_tracer, 5464 trace_create_file("set_ftrace_pid", 0644, d_tracer,
5465 NULL, &ftrace_pid_fops); 5465 NULL, &ftrace_pid_fops);
5466 5466
5467 ftrace_profile_debugfs(d_tracer); 5467 ftrace_profile_tracefs(d_tracer);
5468 5468
5469 return 0; 5469 return 0;
5470} 5470}
5471fs_initcall(ftrace_init_debugfs); 5471fs_initcall(ftrace_init_tracefs);
5472 5472
5473/** 5473/**
5474 * ftrace_kill - kill ftrace 5474 * ftrace_kill - kill ftrace
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 05e0e50539fc..6c4739bee4bb 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -20,6 +20,7 @@
20#include <linux/notifier.h> 20#include <linux/notifier.h>
21#include <linux/irqflags.h> 21#include <linux/irqflags.h>
22#include <linux/debugfs.h> 22#include <linux/debugfs.h>
23#include <linux/tracefs.h>
23#include <linux/pagemap.h> 24#include <linux/pagemap.h>
24#include <linux/hardirq.h> 25#include <linux/hardirq.h>
25#include <linux/linkage.h> 26#include <linux/linkage.h>
@@ -5828,6 +5829,14 @@ static inline __init int register_snapshot_cmd(void) { return 0; }
5828 5829
5829static struct dentry *tracing_get_dentry(struct trace_array *tr) 5830static struct dentry *tracing_get_dentry(struct trace_array *tr)
5830{ 5831{
5832 if (WARN_ON(!tr->dir))
5833 return ERR_PTR(-ENODEV);
5834
5835 /* Top directory uses NULL as the parent */
5836 if (tr->flags & TRACE_ARRAY_FL_GLOBAL)
5837 return NULL;
5838
5839 /* All sub buffers have a descriptor */
5831 return tr->dir; 5840 return tr->dir;
5832} 5841}
5833 5842
@@ -5842,10 +5851,10 @@ static struct dentry *tracing_dentry_percpu(struct trace_array *tr, int cpu)
5842 if (IS_ERR(d_tracer)) 5851 if (IS_ERR(d_tracer))
5843 return NULL; 5852 return NULL;
5844 5853
5845 tr->percpu_dir = debugfs_create_dir("per_cpu", d_tracer); 5854 tr->percpu_dir = tracefs_create_dir("per_cpu", d_tracer);
5846 5855
5847 WARN_ONCE(!tr->percpu_dir, 5856 WARN_ONCE(!tr->percpu_dir,
5848 "Could not create debugfs directory 'per_cpu/%d'\n", cpu); 5857 "Could not create tracefs directory 'per_cpu/%d'\n", cpu);
5849 5858
5850 return tr->percpu_dir; 5859 return tr->percpu_dir;
5851} 5860}
@@ -5862,7 +5871,7 @@ trace_create_cpu_file(const char *name, umode_t mode, struct dentry *parent,
5862} 5871}
5863 5872
5864static void 5873static void
5865tracing_init_debugfs_percpu(struct trace_array *tr, long cpu) 5874tracing_init_tracefs_percpu(struct trace_array *tr, long cpu)
5866{ 5875{
5867 struct dentry *d_percpu = tracing_dentry_percpu(tr, cpu); 5876 struct dentry *d_percpu = tracing_dentry_percpu(tr, cpu);
5868 struct dentry *d_cpu; 5877 struct dentry *d_cpu;
@@ -5872,9 +5881,9 @@ tracing_init_debugfs_percpu(struct trace_array *tr, long cpu)
5872 return; 5881 return;
5873 5882
5874 snprintf(cpu_dir, 30, "cpu%ld", cpu); 5883 snprintf(cpu_dir, 30, "cpu%ld", cpu);
5875 d_cpu = debugfs_create_dir(cpu_dir, d_percpu); 5884 d_cpu = tracefs_create_dir(cpu_dir, d_percpu);
5876 if (!d_cpu) { 5885 if (!d_cpu) {
5877 pr_warning("Could not create debugfs '%s' entry\n", cpu_dir); 5886 pr_warning("Could not create tracefs '%s' entry\n", cpu_dir);
5878 return; 5887 return;
5879 } 5888 }
5880 5889
@@ -6026,9 +6035,9 @@ struct dentry *trace_create_file(const char *name,
6026{ 6035{
6027 struct dentry *ret; 6036 struct dentry *ret;
6028 6037
6029 ret = debugfs_create_file(name, mode, parent, data, fops); 6038 ret = tracefs_create_file(name, mode, parent, data, fops);
6030 if (!ret) 6039 if (!ret)
6031 pr_warning("Could not create debugfs '%s' entry\n", name); 6040 pr_warning("Could not create tracefs '%s' entry\n", name);
6032 6041
6033 return ret; 6042 return ret;
6034} 6043}
@@ -6045,9 +6054,9 @@ static struct dentry *trace_options_init_dentry(struct trace_array *tr)
6045 if (IS_ERR(d_tracer)) 6054 if (IS_ERR(d_tracer))
6046 return NULL; 6055 return NULL;
6047 6056
6048 tr->options = debugfs_create_dir("options", d_tracer); 6057 tr->options = tracefs_create_dir("options", d_tracer);
6049 if (!tr->options) { 6058 if (!tr->options) {
6050 pr_warning("Could not create debugfs directory 'options'\n"); 6059 pr_warning("Could not create tracefs directory 'options'\n");
6051 return NULL; 6060 return NULL;
6052 } 6061 }
6053 6062
@@ -6116,7 +6125,7 @@ destroy_trace_option_files(struct trace_option_dentry *topts)
6116 return; 6125 return;
6117 6126
6118 for (cnt = 0; topts[cnt].opt; cnt++) 6127 for (cnt = 0; topts[cnt].opt; cnt++)
6119 debugfs_remove(topts[cnt].entry); 6128 tracefs_remove(topts[cnt].entry);
6120 6129
6121 kfree(topts); 6130 kfree(topts);
6122} 6131}
@@ -6205,7 +6214,7 @@ static const struct file_operations rb_simple_fops = {
6205struct dentry *trace_instance_dir; 6214struct dentry *trace_instance_dir;
6206 6215
6207static void 6216static void
6208init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer); 6217init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer);
6209 6218
6210static int 6219static int
6211allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size) 6220allocate_trace_buffer(struct trace_array *tr, struct trace_buffer *buf, int size)
@@ -6321,17 +6330,17 @@ static int new_instance_create(const char *name)
6321 if (allocate_trace_buffers(tr, trace_buf_size) < 0) 6330 if (allocate_trace_buffers(tr, trace_buf_size) < 0)
6322 goto out_free_tr; 6331 goto out_free_tr;
6323 6332
6324 tr->dir = debugfs_create_dir(name, trace_instance_dir); 6333 tr->dir = tracefs_create_dir(name, trace_instance_dir);
6325 if (!tr->dir) 6334 if (!tr->dir)
6326 goto out_free_tr; 6335 goto out_free_tr;
6327 6336
6328 ret = event_trace_add_tracer(tr->dir, tr); 6337 ret = event_trace_add_tracer(tr->dir, tr);
6329 if (ret) { 6338 if (ret) {
6330 debugfs_remove_recursive(tr->dir); 6339 tracefs_remove_recursive(tr->dir);
6331 goto out_free_tr; 6340 goto out_free_tr;
6332 } 6341 }
6333 6342
6334 init_tracer_debugfs(tr, tr->dir); 6343 init_tracer_tracefs(tr, tr->dir);
6335 6344
6336 list_add(&tr->list, &ftrace_trace_arrays); 6345 list_add(&tr->list, &ftrace_trace_arrays);
6337 6346
@@ -6404,7 +6413,7 @@ static int instance_mkdir (struct inode *inode, struct dentry *dentry, umode_t m
6404 return -ENOENT; 6413 return -ENOENT;
6405 6414
6406 /* 6415 /*
6407 * The inode mutex is locked, but debugfs_create_dir() will also 6416 * The inode mutex is locked, but tracefs_create_dir() will also
6408 * take the mutex. As the instances directory can not be destroyed 6417 * take the mutex. As the instances directory can not be destroyed
6409 * or changed in any other way, it is safe to unlock it, and 6418 * or changed in any other way, it is safe to unlock it, and
6410 * let the dentry try. If two users try to make the same dir at 6419 * let the dentry try. If two users try to make the same dir at
@@ -6434,7 +6443,7 @@ static int instance_rmdir(struct inode *inode, struct dentry *dentry)
6434 mutex_unlock(&dentry->d_inode->i_mutex); 6443 mutex_unlock(&dentry->d_inode->i_mutex);
6435 6444
6436 /* 6445 /*
6437 * The inode mutex is locked, but debugfs_create_dir() will also 6446 * The inode mutex is locked, but tracefs_create_dir() will also
6438 * take the mutex. As the instances directory can not be destroyed 6447 * take the mutex. As the instances directory can not be destroyed
6439 * or changed in any other way, it is safe to unlock it, and 6448 * or changed in any other way, it is safe to unlock it, and
6440 * let the dentry try. If two users try to make the same dir at 6449 * let the dentry try. If two users try to make the same dir at
@@ -6459,7 +6468,7 @@ static const struct inode_operations instance_dir_inode_operations = {
6459 6468
6460static __init void create_trace_instances(struct dentry *d_tracer) 6469static __init void create_trace_instances(struct dentry *d_tracer)
6461{ 6470{
6462 trace_instance_dir = debugfs_create_dir("instances", d_tracer); 6471 trace_instance_dir = tracefs_create_dir("instances", d_tracer);
6463 if (WARN_ON(!trace_instance_dir)) 6472 if (WARN_ON(!trace_instance_dir))
6464 return; 6473 return;
6465 6474
@@ -6468,7 +6477,7 @@ static __init void create_trace_instances(struct dentry *d_tracer)
6468} 6477}
6469 6478
6470static void 6479static void
6471init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer) 6480init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer)
6472{ 6481{
6473 int cpu; 6482 int cpu;
6474 6483
@@ -6522,7 +6531,7 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer)
6522#endif 6531#endif
6523 6532
6524 for_each_tracing_cpu(cpu) 6533 for_each_tracing_cpu(cpu)
6525 tracing_init_debugfs_percpu(tr, cpu); 6534 tracing_init_tracefs_percpu(tr, cpu);
6526 6535
6527} 6536}
6528 6537
@@ -6550,10 +6559,10 @@ struct dentry *tracing_init_dentry(void)
6550 return ERR_PTR(-ENOMEM); 6559 return ERR_PTR(-ENOMEM);
6551 } 6560 }
6552 6561
6553 return tr->dir; 6562 return NULL;
6554} 6563}
6555 6564
6556static __init int tracer_init_debugfs(void) 6565static __init int tracer_init_tracefs(void)
6557{ 6566{
6558 struct dentry *d_tracer; 6567 struct dentry *d_tracer;
6559 6568
@@ -6563,7 +6572,7 @@ static __init int tracer_init_debugfs(void)
6563 if (IS_ERR(d_tracer)) 6572 if (IS_ERR(d_tracer))
6564 return 0; 6573 return 0;
6565 6574
6566 init_tracer_debugfs(&global_trace, d_tracer); 6575 init_tracer_tracefs(&global_trace, d_tracer);
6567 6576
6568 trace_create_file("tracing_thresh", 0644, d_tracer, 6577 trace_create_file("tracing_thresh", 0644, d_tracer,
6569 &global_trace, &tracing_thresh_fops); 6578 &global_trace, &tracing_thresh_fops);
@@ -6925,5 +6934,5 @@ __init static int clear_boot_tracer(void)
6925 return 0; 6934 return 0;
6926} 6935}
6927 6936
6928fs_initcall(tracer_init_debugfs); 6937fs_initcall(tracer_init_tracefs);
6929late_initcall(clear_boot_tracer); 6938late_initcall(clear_boot_tracer);
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index dd8205a35760..d951deddec89 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -334,7 +334,7 @@ struct tracer_flags {
334 334
335 335
336/** 336/**
337 * struct tracer - a specific tracer and its callbacks to interact with debugfs 337 * struct tracer - a specific tracer and its callbacks to interact with tracefs
338 * @name: the name chosen to select it on the available_tracers file 338 * @name: the name chosen to select it on the available_tracers file
339 * @init: called when one switches to this tracer (echo name > current_tracer) 339 * @init: called when one switches to this tracer (echo name > current_tracer)
340 * @reset: called when one switches to another tracer 340 * @reset: called when one switches to another tracer
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index db54dda10ccc..0d2e47370ee7 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -13,7 +13,7 @@
13#include <linux/workqueue.h> 13#include <linux/workqueue.h>
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/kthread.h> 15#include <linux/kthread.h>
16#include <linux/debugfs.h> 16#include <linux/tracefs.h>
17#include <linux/uaccess.h> 17#include <linux/uaccess.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/ctype.h> 19#include <linux/ctype.h>
@@ -480,7 +480,7 @@ static void remove_subsystem(struct ftrace_subsystem_dir *dir)
480 return; 480 return;
481 481
482 if (!--dir->nr_events) { 482 if (!--dir->nr_events) {
483 debugfs_remove_recursive(dir->entry); 483 tracefs_remove_recursive(dir->entry);
484 list_del(&dir->list); 484 list_del(&dir->list);
485 __put_system_dir(dir); 485 __put_system_dir(dir);
486 } 486 }
@@ -499,7 +499,7 @@ static void remove_event_file_dir(struct ftrace_event_file *file)
499 } 499 }
500 spin_unlock(&dir->d_lock); 500 spin_unlock(&dir->d_lock);
501 501
502 debugfs_remove_recursive(dir); 502 tracefs_remove_recursive(dir);
503 } 503 }
504 504
505 list_del(&file->list); 505 list_del(&file->list);
@@ -1526,7 +1526,7 @@ event_subsystem_dir(struct trace_array *tr, const char *name,
1526 } else 1526 } else
1527 __get_system(system); 1527 __get_system(system);
1528 1528
1529 dir->entry = debugfs_create_dir(name, parent); 1529 dir->entry = tracefs_create_dir(name, parent);
1530 if (!dir->entry) { 1530 if (!dir->entry) {
1531 pr_warn("Failed to create system directory %s\n", name); 1531 pr_warn("Failed to create system directory %s\n", name);
1532 __put_system(system); 1532 __put_system(system);
@@ -1539,12 +1539,12 @@ event_subsystem_dir(struct trace_array *tr, const char *name,
1539 dir->subsystem = system; 1539 dir->subsystem = system;
1540 file->system = dir; 1540 file->system = dir;
1541 1541
1542 entry = debugfs_create_file("filter", 0644, dir->entry, dir, 1542 entry = tracefs_create_file("filter", 0644, dir->entry, dir,
1543 &ftrace_subsystem_filter_fops); 1543 &ftrace_subsystem_filter_fops);
1544 if (!entry) { 1544 if (!entry) {
1545 kfree(system->filter); 1545 kfree(system->filter);
1546 system->filter = NULL; 1546 system->filter = NULL;
1547 pr_warn("Could not create debugfs '%s/filter' entry\n", name); 1547 pr_warn("Could not create tracefs '%s/filter' entry\n", name);
1548 } 1548 }
1549 1549
1550 trace_create_file("enable", 0644, dir->entry, dir, 1550 trace_create_file("enable", 0644, dir->entry, dir,
@@ -1585,9 +1585,9 @@ event_create_dir(struct dentry *parent, struct ftrace_event_file *file)
1585 d_events = parent; 1585 d_events = parent;
1586 1586
1587 name = ftrace_event_name(call); 1587 name = ftrace_event_name(call);
1588 file->dir = debugfs_create_dir(name, d_events); 1588 file->dir = tracefs_create_dir(name, d_events);
1589 if (!file->dir) { 1589 if (!file->dir) {
1590 pr_warn("Could not create debugfs '%s' directory\n", name); 1590 pr_warn("Could not create tracefs '%s' directory\n", name);
1591 return -1; 1591 return -1;
1592 } 1592 }
1593 1593
@@ -2228,7 +2228,7 @@ static inline int register_event_cmds(void) { return 0; }
2228/* 2228/*
2229 * The top level array has already had its ftrace_event_file 2229 * The top level array has already had its ftrace_event_file
2230 * descriptors created in order to allow for early events to 2230 * descriptors created in order to allow for early events to
2231 * be recorded. This function is called after the debugfs has been 2231 * be recorded. This function is called after the tracefs has been
2232 * initialized, and we now have to create the files associated 2232 * initialized, and we now have to create the files associated
2233 * to the events. 2233 * to the events.
2234 */ 2234 */
@@ -2311,16 +2311,16 @@ create_event_toplevel_files(struct dentry *parent, struct trace_array *tr)
2311 struct dentry *d_events; 2311 struct dentry *d_events;
2312 struct dentry *entry; 2312 struct dentry *entry;
2313 2313
2314 entry = debugfs_create_file("set_event", 0644, parent, 2314 entry = tracefs_create_file("set_event", 0644, parent,
2315 tr, &ftrace_set_event_fops); 2315 tr, &ftrace_set_event_fops);
2316 if (!entry) { 2316 if (!entry) {
2317 pr_warn("Could not create debugfs 'set_event' entry\n"); 2317 pr_warn("Could not create tracefs 'set_event' entry\n");
2318 return -ENOMEM; 2318 return -ENOMEM;
2319 } 2319 }
2320 2320
2321 d_events = debugfs_create_dir("events", parent); 2321 d_events = tracefs_create_dir("events", parent);
2322 if (!d_events) { 2322 if (!d_events) {
2323 pr_warn("Could not create debugfs 'events' directory\n"); 2323 pr_warn("Could not create tracefs 'events' directory\n");
2324 return -ENOMEM; 2324 return -ENOMEM;
2325 } 2325 }
2326 2326
@@ -2412,7 +2412,7 @@ int event_trace_del_tracer(struct trace_array *tr)
2412 2412
2413 down_write(&trace_event_sem); 2413 down_write(&trace_event_sem);
2414 __trace_remove_event_dirs(tr); 2414 __trace_remove_event_dirs(tr);
2415 debugfs_remove_recursive(tr->event_dir); 2415 tracefs_remove_recursive(tr->event_dir);
2416 up_write(&trace_event_sem); 2416 up_write(&trace_event_sem);
2417 2417
2418 tr->event_dir = NULL; 2418 tr->event_dir = NULL;
@@ -2534,10 +2534,10 @@ static __init int event_trace_init(void)
2534 if (IS_ERR(d_tracer)) 2534 if (IS_ERR(d_tracer))
2535 return 0; 2535 return 0;
2536 2536
2537 entry = debugfs_create_file("available_events", 0444, d_tracer, 2537 entry = tracefs_create_file("available_events", 0444, d_tracer,
2538 tr, &ftrace_avail_fops); 2538 tr, &ftrace_avail_fops);
2539 if (!entry) 2539 if (!entry)
2540 pr_warn("Could not create debugfs 'available_events' entry\n"); 2540 pr_warn("Could not create tracefs 'available_events' entry\n");
2541 2541
2542 if (trace_define_common_fields()) 2542 if (trace_define_common_fields())
2543 pr_warn("tracing: Failed to allocate common fields"); 2543 pr_warn("tracing: Failed to allocate common fields");
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 2d25ad1526bb..9cfea4c6d314 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -6,7 +6,6 @@
6 * is Copyright (c) Steven Rostedt <srostedt@redhat.com> 6 * is Copyright (c) Steven Rostedt <srostedt@redhat.com>
7 * 7 *
8 */ 8 */
9#include <linux/debugfs.h>
10#include <linux/uaccess.h> 9#include <linux/uaccess.h>
11#include <linux/ftrace.h> 10#include <linux/ftrace.h>
12#include <linux/slab.h> 11#include <linux/slab.h>
@@ -151,7 +150,7 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
151 * The curr_ret_stack is initialized to -1 and get increased 150 * The curr_ret_stack is initialized to -1 and get increased
152 * in this function. So it can be less than -1 only if it was 151 * in this function. So it can be less than -1 only if it was
153 * filtered out via ftrace_graph_notrace_addr() which can be 152 * filtered out via ftrace_graph_notrace_addr() which can be
154 * set from set_graph_notrace file in debugfs by user. 153 * set from set_graph_notrace file in tracefs by user.
155 */ 154 */
156 if (current->curr_ret_stack < -1) 155 if (current->curr_ret_stack < -1)
157 return -EBUSY; 156 return -EBUSY;
@@ -1432,7 +1431,7 @@ static const struct file_operations graph_depth_fops = {
1432 .llseek = generic_file_llseek, 1431 .llseek = generic_file_llseek,
1433}; 1432};
1434 1433
1435static __init int init_graph_debugfs(void) 1434static __init int init_graph_tracefs(void)
1436{ 1435{
1437 struct dentry *d_tracer; 1436 struct dentry *d_tracer;
1438 1437
@@ -1445,7 +1444,7 @@ static __init int init_graph_debugfs(void)
1445 1444
1446 return 0; 1445 return 0;
1447} 1446}
1448fs_initcall(init_graph_debugfs); 1447fs_initcall(init_graph_tracefs);
1449 1448
1450static __init int init_graph_trace(void) 1449static __init int init_graph_trace(void)
1451{ 1450{
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index b4a00def88f5..c1c6655847c8 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -1310,7 +1310,7 @@ static int unregister_kprobe_event(struct trace_kprobe *tk)
1310 return ret; 1310 return ret;
1311} 1311}
1312 1312
1313/* Make a debugfs interface for controlling probe points */ 1313/* Make a tracefs interface for controlling probe points */
1314static __init int init_kprobe_trace(void) 1314static __init int init_kprobe_trace(void)
1315{ 1315{
1316 struct dentry *d_tracer; 1316 struct dentry *d_tracer;
@@ -1323,20 +1323,20 @@ static __init int init_kprobe_trace(void)
1323 if (IS_ERR(d_tracer)) 1323 if (IS_ERR(d_tracer))
1324 return 0; 1324 return 0;
1325 1325
1326 entry = debugfs_create_file("kprobe_events", 0644, d_tracer, 1326 entry = tracefs_create_file("kprobe_events", 0644, d_tracer,
1327 NULL, &kprobe_events_ops); 1327 NULL, &kprobe_events_ops);
1328 1328
1329 /* Event list interface */ 1329 /* Event list interface */
1330 if (!entry) 1330 if (!entry)
1331 pr_warning("Could not create debugfs " 1331 pr_warning("Could not create tracefs "
1332 "'kprobe_events' entry\n"); 1332 "'kprobe_events' entry\n");
1333 1333
1334 /* Profile interface */ 1334 /* Profile interface */
1335 entry = debugfs_create_file("kprobe_profile", 0444, d_tracer, 1335 entry = tracefs_create_file("kprobe_profile", 0444, d_tracer,
1336 NULL, &kprobe_profile_ops); 1336 NULL, &kprobe_profile_ops);
1337 1337
1338 if (!entry) 1338 if (!entry)
1339 pr_warning("Could not create debugfs " 1339 pr_warning("Could not create tracefs "
1340 "'kprobe_profile' entry\n"); 1340 "'kprobe_profile' entry\n");
1341 return 0; 1341 return 0;
1342} 1342}
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 4f815fbce16d..19aff635841a 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -25,7 +25,7 @@
25#include <linux/seq_file.h> 25#include <linux/seq_file.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/smp.h> 27#include <linux/smp.h>
28#include <linux/debugfs.h> 28#include <linux/tracefs.h>
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/string.h> 30#include <linux/string.h>
31#include <linux/ctype.h> 31#include <linux/ctype.h>
diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
index 75e19e86c954..6cf935316769 100644
--- a/kernel/trace/trace_stat.c
+++ b/kernel/trace/trace_stat.c
@@ -12,7 +12,7 @@
12#include <linux/list.h> 12#include <linux/list.h>
13#include <linux/slab.h> 13#include <linux/slab.h>
14#include <linux/rbtree.h> 14#include <linux/rbtree.h>
15#include <linux/debugfs.h> 15#include <linux/tracefs.h>
16#include "trace_stat.h" 16#include "trace_stat.h"
17#include "trace.h" 17#include "trace.h"
18 18
@@ -65,7 +65,7 @@ static void reset_stat_session(struct stat_session *session)
65 65
66static void destroy_session(struct stat_session *session) 66static void destroy_session(struct stat_session *session)
67{ 67{
68 debugfs_remove(session->file); 68 tracefs_remove(session->file);
69 __reset_stat_session(session); 69 __reset_stat_session(session);
70 mutex_destroy(&session->stat_mutex); 70 mutex_destroy(&session->stat_mutex);
71 kfree(session); 71 kfree(session);
@@ -279,9 +279,9 @@ static int tracing_stat_init(void)
279 if (IS_ERR(d_tracing)) 279 if (IS_ERR(d_tracing))
280 return 0; 280 return 0;
281 281
282 stat_dir = debugfs_create_dir("trace_stat", d_tracing); 282 stat_dir = tracefs_create_dir("trace_stat", d_tracing);
283 if (!stat_dir) 283 if (!stat_dir)
284 pr_warning("Could not create debugfs " 284 pr_warning("Could not create tracefs "
285 "'trace_stat' entry\n"); 285 "'trace_stat' entry\n");
286 return 0; 286 return 0;
287} 287}
@@ -291,7 +291,7 @@ static int init_stat_file(struct stat_session *session)
291 if (!stat_dir && tracing_stat_init()) 291 if (!stat_dir && tracing_stat_init())
292 return -ENODEV; 292 return -ENODEV;
293 293
294 session->file = debugfs_create_file(session->ts->name, 0644, 294 session->file = tracefs_create_file(session->ts->name, 0644,
295 stat_dir, 295 stat_dir,
296 session, &tracing_stat_fops); 296 session, &tracing_stat_fops);
297 if (!session->file) 297 if (!session->file)