aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/trace/trace.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d4627f15407a..05e0e50539fc 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4105,9 +4105,24 @@ static void tracing_set_nop(struct trace_array *tr)
4105 tr->current_trace = &nop_trace; 4105 tr->current_trace = &nop_trace;
4106} 4106}
4107 4107
4108static int tracing_set_tracer(struct trace_array *tr, const char *buf) 4108static void update_tracer_options(struct trace_array *tr, struct tracer *t)
4109{ 4109{
4110 static struct trace_option_dentry *topts; 4110 static struct trace_option_dentry *topts;
4111
4112 /* Only enable if the directory has been created already. */
4113 if (!tr->dir)
4114 return;
4115
4116 /* Currently, only the top instance has options */
4117 if (!(tr->flags & TRACE_ARRAY_FL_GLOBAL))
4118 return;
4119
4120 destroy_trace_option_files(topts);
4121 topts = create_trace_option_files(tr, t);
4122}
4123
4124static int tracing_set_tracer(struct trace_array *tr, const char *buf)
4125{
4111 struct tracer *t; 4126 struct tracer *t;
4112#ifdef CONFIG_TRACER_MAX_TRACE 4127#ifdef CONFIG_TRACER_MAX_TRACE
4113 bool had_max_tr; 4128 bool had_max_tr;
@@ -4172,14 +4187,7 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
4172 free_snapshot(tr); 4187 free_snapshot(tr);
4173 } 4188 }
4174#endif 4189#endif
4175 /* 4190 update_tracer_options(tr, t);
4176 * Only enable if the directory has been created already.
4177 * Currently, only the top instance has options
4178 */
4179 if (tr->dir && tr->flags & TRACE_ARRAY_FL_GLOBAL) {
4180 destroy_trace_option_files(topts);
4181 topts = create_trace_option_files(tr, t);
4182 }
4183 4191
4184#ifdef CONFIG_TRACER_MAX_TRACE 4192#ifdef CONFIG_TRACER_MAX_TRACE
4185 if (t->use_max_tr && !had_max_tr) { 4193 if (t->use_max_tr && !had_max_tr) {
@@ -6578,6 +6586,10 @@ static __init int tracer_init_debugfs(void)
6578 6586
6579 create_trace_options_dir(&global_trace); 6587 create_trace_options_dir(&global_trace);
6580 6588
6589 /* If the tracer was started via cmdline, create options for it here */
6590 if (global_trace.current_trace != &nop_trace)
6591 update_tracer_options(&global_trace, global_trace.current_trace);
6592
6581 return 0; 6593 return 0;
6582} 6594}
6583 6595