aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/ftrace.c39
-rw-r--r--kernel/trace/ring_buffer.c7
-rw-r--r--kernel/trace/trace.c159
-rw-r--r--kernel/trace/trace.h6
-rw-r--r--kernel/trace/trace_event_profile.c1
-rw-r--r--kernel/trace/trace_printk.c6
-rw-r--r--kernel/trace/trace_stack.c13
-rw-r--r--kernel/trace/trace_sysprof.c6
8 files changed, 86 insertions, 151 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 678e3d6caf85..6ea5a1ae6a98 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2698,38 +2698,23 @@ static const struct file_operations ftrace_graph_fops = {
2698 2698
2699static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer) 2699static __init int ftrace_init_dyn_debugfs(struct dentry *d_tracer)
2700{ 2700{
2701 struct dentry *entry;
2702 2701
2703 entry = debugfs_create_file("available_filter_functions", 0444, 2702 trace_create_file("available_filter_functions", 0444,
2704 d_tracer, NULL, &ftrace_avail_fops); 2703 d_tracer, NULL, &ftrace_avail_fops);
2705 if (!entry)
2706 pr_warning("Could not create debugfs "
2707 "'available_filter_functions' entry\n");
2708 2704
2709 entry = debugfs_create_file("failures", 0444, 2705 trace_create_file("failures", 0444,
2710 d_tracer, NULL, &ftrace_failures_fops); 2706 d_tracer, NULL, &ftrace_failures_fops);
2711 if (!entry)
2712 pr_warning("Could not create debugfs 'failures' entry\n");
2713 2707
2714 entry = debugfs_create_file("set_ftrace_filter", 0644, d_tracer, 2708 trace_create_file("set_ftrace_filter", 0644, d_tracer,
2715 NULL, &ftrace_filter_fops); 2709 NULL, &ftrace_filter_fops);
2716 if (!entry)
2717 pr_warning("Could not create debugfs "
2718 "'set_ftrace_filter' entry\n");
2719 2710
2720 entry = debugfs_create_file("set_ftrace_notrace", 0644, d_tracer, 2711 trace_create_file("set_ftrace_notrace", 0644, d_tracer,
2721 NULL, &ftrace_notrace_fops); 2712 NULL, &ftrace_notrace_fops);
2722 if (!entry)
2723 pr_warning("Could not create debugfs "
2724 "'set_ftrace_notrace' entry\n");
2725 2713
2726#ifdef CONFIG_FUNCTION_GRAPH_TRACER 2714#ifdef CONFIG_FUNCTION_GRAPH_TRACER
2727 entry = debugfs_create_file("set_graph_function", 0444, d_tracer, 2715 trace_create_file("set_graph_function", 0444, d_tracer,
2728 NULL, 2716 NULL,
2729 &ftrace_graph_fops); 2717 &ftrace_graph_fops);
2730 if (!entry)
2731 pr_warning("Could not create debugfs "
2732 "'set_graph_function' entry\n");
2733#endif /* CONFIG_FUNCTION_GRAPH_TRACER */ 2718#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
2734 2719
2735 return 0; 2720 return 0;
@@ -2987,7 +2972,6 @@ static const struct file_operations ftrace_pid_fops = {
2987static __init int ftrace_init_debugfs(void) 2972static __init int ftrace_init_debugfs(void)
2988{ 2973{
2989 struct dentry *d_tracer; 2974 struct dentry *d_tracer;
2990 struct dentry *entry;
2991 2975
2992 d_tracer = tracing_init_dentry(); 2976 d_tracer = tracing_init_dentry();
2993 if (!d_tracer) 2977 if (!d_tracer)
@@ -2995,11 +2979,8 @@ static __init int ftrace_init_debugfs(void)
2995 2979
2996 ftrace_init_dyn_debugfs(d_tracer); 2980 ftrace_init_dyn_debugfs(d_tracer);
2997 2981
2998 entry = debugfs_create_file("set_ftrace_pid", 0644, d_tracer, 2982 trace_create_file("set_ftrace_pid", 0644, d_tracer,
2999 NULL, &ftrace_pid_fops); 2983 NULL, &ftrace_pid_fops);
3000 if (!entry)
3001 pr_warning("Could not create debugfs "
3002 "'set_ftrace_pid' entry\n");
3003 2984
3004 ftrace_profile_debugfs(d_tracer); 2985 ftrace_profile_debugfs(d_tracer);
3005 2986
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 960cbf44c844..74a11808c282 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2845,14 +2845,11 @@ static const struct file_operations rb_simple_fops = {
2845static __init int rb_init_debugfs(void) 2845static __init int rb_init_debugfs(void)
2846{ 2846{
2847 struct dentry *d_tracer; 2847 struct dentry *d_tracer;
2848 struct dentry *entry;
2849 2848
2850 d_tracer = tracing_init_dentry(); 2849 d_tracer = tracing_init_dentry();
2851 2850
2852 entry = debugfs_create_file("tracing_on", 0644, d_tracer, 2851 trace_create_file("tracing_on", 0644, d_tracer,
2853 &ring_buffer_flags, &rb_simple_fops); 2852 &ring_buffer_flags, &rb_simple_fops);
2854 if (!entry)
2855 pr_warning("Could not create debugfs 'tracing_on' entry\n");
2856 2853
2857 return 0; 2854 return 0;
2858} 2855}
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 32653c8c6e26..0615751a3ed7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3581,7 +3581,7 @@ struct dentry *tracing_dentry_percpu(void)
3581static void tracing_init_debugfs_percpu(long cpu) 3581static void tracing_init_debugfs_percpu(long cpu)
3582{ 3582{
3583 struct dentry *d_percpu = tracing_dentry_percpu(); 3583 struct dentry *d_percpu = tracing_dentry_percpu();
3584 struct dentry *entry, *d_cpu; 3584 struct dentry *d_cpu;
3585 /* strlen(cpu) + MAX(log10(cpu)) + '\0' */ 3585 /* strlen(cpu) + MAX(log10(cpu)) + '\0' */
3586 char cpu_dir[7]; 3586 char cpu_dir[7];
3587 3587
@@ -3596,21 +3596,15 @@ static void tracing_init_debugfs_percpu(long cpu)
3596 } 3596 }
3597 3597
3598 /* per cpu trace_pipe */ 3598 /* per cpu trace_pipe */
3599 entry = debugfs_create_file("trace_pipe", 0444, d_cpu, 3599 trace_create_file("trace_pipe", 0444, d_cpu,
3600 (void *) cpu, &tracing_pipe_fops); 3600 (void *) cpu, &tracing_pipe_fops);
3601 if (!entry)
3602 pr_warning("Could not create debugfs 'trace_pipe' entry\n");
3603 3601
3604 /* per cpu trace */ 3602 /* per cpu trace */
3605 entry = debugfs_create_file("trace", 0644, d_cpu, 3603 trace_create_file("trace", 0644, d_cpu,
3606 (void *) cpu, &tracing_fops); 3604 (void *) cpu, &tracing_fops);
3607 if (!entry)
3608 pr_warning("Could not create debugfs 'trace' entry\n");
3609 3605
3610 entry = debugfs_create_file("trace_pipe_raw", 0444, d_cpu, 3606 trace_create_file("trace_pipe_raw", 0444, d_cpu,
3611 (void *) cpu, &tracing_buffers_fops); 3607 (void *) cpu, &tracing_buffers_fops);
3612 if (!entry)
3613 pr_warning("Could not create debugfs 'trace_pipe_raw' entry\n");
3614} 3608}
3615 3609
3616#ifdef CONFIG_FTRACE_SELFTEST 3610#ifdef CONFIG_FTRACE_SELFTEST
@@ -3766,6 +3760,22 @@ static const struct file_operations trace_options_core_fops = {
3766 .write = trace_options_core_write, 3760 .write = trace_options_core_write,
3767}; 3761};
3768 3762
3763struct dentry *trace_create_file(const char *name,
3764 mode_t mode,
3765 struct dentry *parent,
3766 void *data,
3767 const struct file_operations *fops)
3768{
3769 struct dentry *ret;
3770
3771 ret = debugfs_create_file(name, mode, parent, data, fops);
3772 if (!ret)
3773 pr_warning("Could not create debugfs '%s' entry\n", name);
3774
3775 return ret;
3776}
3777
3778
3769static struct dentry *trace_options_init_dentry(void) 3779static struct dentry *trace_options_init_dentry(void)
3770{ 3780{
3771 struct dentry *d_tracer; 3781 struct dentry *d_tracer;
@@ -3793,7 +3803,6 @@ create_trace_option_file(struct trace_option_dentry *topt,
3793 struct tracer_opt *opt) 3803 struct tracer_opt *opt)
3794{ 3804{
3795 struct dentry *t_options; 3805 struct dentry *t_options;
3796 struct dentry *entry;
3797 3806
3798 t_options = trace_options_init_dentry(); 3807 t_options = trace_options_init_dentry();
3799 if (!t_options) 3808 if (!t_options)
@@ -3802,11 +3811,9 @@ create_trace_option_file(struct trace_option_dentry *topt,
3802 topt->flags = flags; 3811 topt->flags = flags;
3803 topt->opt = opt; 3812 topt->opt = opt;
3804 3813
3805 entry = debugfs_create_file(opt->name, 0644, t_options, topt, 3814 topt->entry = trace_create_file(opt->name, 0644, t_options, topt,
3806 &trace_options_fops); 3815 &trace_options_fops);
3807 3816
3808 topt->entry = entry;
3809
3810} 3817}
3811 3818
3812static struct trace_option_dentry * 3819static struct trace_option_dentry *
@@ -3861,123 +3868,81 @@ static struct dentry *
3861create_trace_option_core_file(const char *option, long index) 3868create_trace_option_core_file(const char *option, long index)
3862{ 3869{
3863 struct dentry *t_options; 3870 struct dentry *t_options;
3864 struct dentry *entry;
3865 3871
3866 t_options = trace_options_init_dentry(); 3872 t_options = trace_options_init_dentry();
3867 if (!t_options) 3873 if (!t_options)
3868 return NULL; 3874 return NULL;
3869 3875
3870 entry = debugfs_create_file(option, 0644, t_options, (void *)index, 3876 return trace_create_file(option, 0644, t_options, (void *)index,
3871 &trace_options_core_fops); 3877 &trace_options_core_fops);
3872
3873 return entry;
3874} 3878}
3875 3879
3876static __init void create_trace_options_dir(void) 3880static __init void create_trace_options_dir(void)
3877{ 3881{
3878 struct dentry *t_options; 3882 struct dentry *t_options;
3879 struct dentry *entry;
3880 int i; 3883 int i;
3881 3884
3882 t_options = trace_options_init_dentry(); 3885 t_options = trace_options_init_dentry();
3883 if (!t_options) 3886 if (!t_options)
3884 return; 3887 return;
3885 3888
3886 for (i = 0; trace_options[i]; i++) { 3889 for (i = 0; trace_options[i]; i++)
3887 entry = create_trace_option_core_file(trace_options[i], i); 3890 create_trace_option_core_file(trace_options[i], i);
3888 if (!entry)
3889 pr_warning("Could not create debugfs %s entry\n",
3890 trace_options[i]);
3891 }
3892} 3891}
3893 3892
3894static __init int tracer_init_debugfs(void) 3893static __init int tracer_init_debugfs(void)
3895{ 3894{
3896 struct dentry *d_tracer; 3895 struct dentry *d_tracer;
3897 struct dentry *entry;
3898 int cpu; 3896 int cpu;
3899 3897
3900 d_tracer = tracing_init_dentry(); 3898 d_tracer = tracing_init_dentry();
3901 3899
3902 entry = debugfs_create_file("tracing_enabled", 0644, d_tracer, 3900 trace_create_file("tracing_enabled", 0644, d_tracer,
3903 &global_trace, &tracing_ctrl_fops); 3901 &global_trace, &tracing_ctrl_fops);
3904 if (!entry)
3905 pr_warning("Could not create debugfs 'tracing_enabled' entry\n");
3906 3902
3907 entry = debugfs_create_file("trace_options", 0644, d_tracer, 3903 trace_create_file("trace_options", 0644, d_tracer,
3908 NULL, &tracing_iter_fops); 3904 NULL, &tracing_iter_fops);
3909 if (!entry)
3910 pr_warning("Could not create debugfs 'trace_options' entry\n");
3911 3905
3912 create_trace_options_dir(); 3906 trace_create_file("tracing_cpumask", 0644, d_tracer,
3907 NULL, &tracing_cpumask_fops);
3908
3909 trace_create_file("trace", 0644, d_tracer,
3910 (void *) TRACE_PIPE_ALL_CPU, &tracing_fops);
3911
3912 trace_create_file("available_tracers", 0444, d_tracer,
3913 &global_trace, &show_traces_fops);
3914
3915 trace_create_file("current_tracer", 0444, d_tracer,
3916 &global_trace, &set_tracer_fops);
3917
3918 trace_create_file("tracing_max_latency", 0644, d_tracer,
3919 &tracing_max_latency, &tracing_max_lat_fops);
3920
3921 trace_create_file("tracing_thresh", 0644, d_tracer,
3922 &tracing_thresh, &tracing_max_lat_fops);
3913 3923
3914 entry = debugfs_create_file("tracing_cpumask", 0644, d_tracer, 3924 trace_create_file("README", 0644, d_tracer,
3915 NULL, &tracing_cpumask_fops); 3925 NULL, &tracing_readme_fops);
3916 if (!entry) 3926
3917 pr_warning("Could not create debugfs 'tracing_cpumask' entry\n"); 3927 trace_create_file("trace_pipe", 0444, d_tracer,
3918
3919 entry = debugfs_create_file("trace", 0644, d_tracer,
3920 (void *) TRACE_PIPE_ALL_CPU, &tracing_fops);
3921 if (!entry)
3922 pr_warning("Could not create debugfs 'trace' entry\n");
3923
3924 entry = debugfs_create_file("available_tracers", 0444, d_tracer,
3925 &global_trace, &show_traces_fops);
3926 if (!entry)
3927 pr_warning("Could not create debugfs 'available_tracers' entry\n");
3928
3929 entry = debugfs_create_file("current_tracer", 0444, d_tracer,
3930 &global_trace, &set_tracer_fops);
3931 if (!entry)
3932 pr_warning("Could not create debugfs 'current_tracer' entry\n");
3933
3934 entry = debugfs_create_file("tracing_max_latency", 0644, d_tracer,
3935 &tracing_max_latency,
3936 &tracing_max_lat_fops);
3937 if (!entry)
3938 pr_warning("Could not create debugfs "
3939 "'tracing_max_latency' entry\n");
3940
3941 entry = debugfs_create_file("tracing_thresh", 0644, d_tracer,
3942 &tracing_thresh, &tracing_max_lat_fops);
3943 if (!entry)
3944 pr_warning("Could not create debugfs "
3945 "'tracing_thresh' entry\n");
3946 entry = debugfs_create_file("README", 0644, d_tracer,
3947 NULL, &tracing_readme_fops);
3948 if (!entry)
3949 pr_warning("Could not create debugfs 'README' entry\n");
3950
3951 entry = debugfs_create_file("trace_pipe", 0444, d_tracer,
3952 (void *) TRACE_PIPE_ALL_CPU, &tracing_pipe_fops); 3928 (void *) TRACE_PIPE_ALL_CPU, &tracing_pipe_fops);
3953 if (!entry) 3929
3954 pr_warning("Could not create debugfs " 3930 trace_create_file("buffer_size_kb", 0644, d_tracer,
3955 "'trace_pipe' entry\n"); 3931 &global_trace, &tracing_entries_fops);
3956 3932
3957 entry = debugfs_create_file("buffer_size_kb", 0644, d_tracer, 3933 trace_create_file("trace_marker", 0220, d_tracer,
3958 &global_trace, &tracing_entries_fops); 3934 NULL, &tracing_mark_fops);
3959 if (!entry)
3960 pr_warning("Could not create debugfs "
3961 "'buffer_size_kb' entry\n");
3962
3963 entry = debugfs_create_file("trace_marker", 0220, d_tracer,
3964 NULL, &tracing_mark_fops);
3965 if (!entry)
3966 pr_warning("Could not create debugfs "
3967 "'trace_marker' entry\n");
3968 3935
3969#ifdef CONFIG_DYNAMIC_FTRACE 3936#ifdef CONFIG_DYNAMIC_FTRACE
3970 entry = debugfs_create_file("dyn_ftrace_total_info", 0444, d_tracer, 3937 trace_create_file("dyn_ftrace_total_info", 0444, d_tracer,
3971 &ftrace_update_tot_cnt, 3938 &ftrace_update_tot_cnt, &tracing_dyn_info_fops);
3972 &tracing_dyn_info_fops);
3973 if (!entry)
3974 pr_warning("Could not create debugfs "
3975 "'dyn_ftrace_total_info' entry\n");
3976#endif 3939#endif
3977#ifdef CONFIG_SYSPROF_TRACER 3940#ifdef CONFIG_SYSPROF_TRACER
3978 init_tracer_sysprof_debugfs(d_tracer); 3941 init_tracer_sysprof_debugfs(d_tracer);
3979#endif 3942#endif
3980 3943
3944 create_trace_options_dir();
3945
3981 for_each_tracing_cpu(cpu) 3946 for_each_tracing_cpu(cpu)
3982 tracing_init_debugfs_percpu(cpu); 3947 tracing_init_debugfs_percpu(cpu);
3983 3948
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 47aa6d0c97a0..f76a8f8689d4 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -470,6 +470,12 @@ void trace_wake_up(void);
470void tracing_reset(struct trace_array *tr, int cpu); 470void tracing_reset(struct trace_array *tr, int cpu);
471void tracing_reset_online_cpus(struct trace_array *tr); 471void tracing_reset_online_cpus(struct trace_array *tr);
472int tracing_open_generic(struct inode *inode, struct file *filp); 472int tracing_open_generic(struct inode *inode, struct file *filp);
473struct dentry *trace_create_file(const char *name,
474 mode_t mode,
475 struct dentry *parent,
476 void *data,
477 const struct file_operations *fops);
478
473struct dentry *tracing_init_dentry(void); 479struct dentry *tracing_init_dentry(void);
474void init_tracer_sysprof_debugfs(struct dentry *d_tracer); 480void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
475 481
diff --git a/kernel/trace/trace_event_profile.c b/kernel/trace/trace_event_profile.c
index 22cba9970776..199de9c74229 100644
--- a/kernel/trace/trace_event_profile.c
+++ b/kernel/trace/trace_event_profile.c
@@ -28,4 +28,3 @@ void ftrace_profile_disable(int event_id)
28 return event->profile_disable(event); 28 return event->profile_disable(event);
29 } 29 }
30} 30}
31
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index eb81556107fe..9bece9687b62 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -245,17 +245,13 @@ static const struct file_operations ftrace_formats_fops = {
245static __init int init_trace_printk_function_export(void) 245static __init int init_trace_printk_function_export(void)
246{ 246{
247 struct dentry *d_tracer; 247 struct dentry *d_tracer;
248 struct dentry *entry;
249 248
250 d_tracer = tracing_init_dentry(); 249 d_tracer = tracing_init_dentry();
251 if (!d_tracer) 250 if (!d_tracer)
252 return 0; 251 return 0;
253 252
254 entry = debugfs_create_file("printk_formats", 0444, d_tracer, 253 trace_create_file("printk_formats", 0444, d_tracer,
255 NULL, &ftrace_formats_fops); 254 NULL, &ftrace_formats_fops);
256 if (!entry)
257 pr_warning("Could not create debugfs "
258 "'printk_formats' entry\n");
259 255
260 return 0; 256 return 0;
261} 257}
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
index c750f65f9661..1796f00524e1 100644
--- a/kernel/trace/trace_stack.c
+++ b/kernel/trace/trace_stack.c
@@ -352,19 +352,14 @@ __setup("stacktrace", enable_stacktrace);
352static __init int stack_trace_init(void) 352static __init int stack_trace_init(void)
353{ 353{
354 struct dentry *d_tracer; 354 struct dentry *d_tracer;
355 struct dentry *entry;
356 355
357 d_tracer = tracing_init_dentry(); 356 d_tracer = tracing_init_dentry();
358 357
359 entry = debugfs_create_file("stack_max_size", 0644, d_tracer, 358 trace_create_file("stack_max_size", 0644, d_tracer,
360 &max_stack_size, &stack_max_size_fops); 359 &max_stack_size, &stack_max_size_fops);
361 if (!entry)
362 pr_warning("Could not create debugfs 'stack_max_size' entry\n");
363 360
364 entry = debugfs_create_file("stack_trace", 0444, d_tracer, 361 trace_create_file("stack_trace", 0444, d_tracer,
365 NULL, &stack_trace_fops); 362 NULL, &stack_trace_fops);
366 if (!entry)
367 pr_warning("Could not create debugfs 'stack_trace' entry\n");
368 363
369 if (stack_tracer_enabled) 364 if (stack_tracer_enabled)
370 register_ftrace_function(&trace_ops); 365 register_ftrace_function(&trace_ops);
diff --git a/kernel/trace/trace_sysprof.c b/kernel/trace/trace_sysprof.c
index 91fd19c2149f..e04b76cc238a 100644
--- a/kernel/trace/trace_sysprof.c
+++ b/kernel/trace/trace_sysprof.c
@@ -321,11 +321,7 @@ static const struct file_operations sysprof_sample_fops = {
321 321
322void init_tracer_sysprof_debugfs(struct dentry *d_tracer) 322void init_tracer_sysprof_debugfs(struct dentry *d_tracer)
323{ 323{
324 struct dentry *entry;
325 324
326 entry = debugfs_create_file("sysprof_sample_period", 0644, 325 trace_create_file("sysprof_sample_period", 0644,
327 d_tracer, NULL, &sysprof_sample_fops); 326 d_tracer, NULL, &sysprof_sample_fops);
328 if (entry)
329 return;
330 pr_warning("Could not create debugfs 'sysprof_sample_period' entry\n");
331} 327}