diff options
| author | Ziqian SUN (Zamir) <zsun@redhat.com> | 2017-09-11 02:26:35 -0400 |
|---|---|---|
| committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-09-19 12:36:01 -0400 |
| commit | c7b3ae0bd2ca658c7a71c49901d08c590294fac9 (patch) | |
| tree | 6e33bb7c8a1a01d7c63b513129b1097d1ba73ae6 /kernel/trace | |
| parent | 8dd33bcb7050dd6f8c1432732f930932c9d3a33e (diff) | |
tracing: Ignore mmiotrace from kernel commandline
The mmiotrace tracer cannot be enabled with ftrace=mmiotrace in kernel
commandline. With this patch, noboot is added to the tracer struct,
and when system boot with a tracer that has noboot=true, it will print
out a warning message and continue booting.
Link: http://lkml.kernel.org/r/1505111195-31942-1-git-send-email-zsun@redhat.com
Signed-off-by: Ziqian SUN (Zamir) <zsun@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
| -rw-r--r-- | kernel/trace/trace.c | 7 | ||||
| -rw-r--r-- | kernel/trace/trace.h | 2 | ||||
| -rw-r--r-- | kernel/trace/trace_mmiotrace.c | 1 |
3 files changed, 10 insertions, 0 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index a7fb136da891..d3ca35f38803 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -5364,6 +5364,13 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf) | |||
| 5364 | if (t == tr->current_trace) | 5364 | if (t == tr->current_trace) |
| 5365 | goto out; | 5365 | goto out; |
| 5366 | 5366 | ||
| 5367 | /* Some tracers won't work on kernel command line */ | ||
| 5368 | if (system_state < SYSTEM_RUNNING && t->noboot) { | ||
| 5369 | pr_warn("Tracer '%s' is not allowed on command line, ignored\n", | ||
| 5370 | t->name); | ||
| 5371 | goto out; | ||
| 5372 | } | ||
| 5373 | |||
| 5367 | /* Some tracers are only allowed for the top level buffer */ | 5374 | /* Some tracers are only allowed for the top level buffer */ |
| 5368 | if (!trace_ok_for_array(t, tr)) { | 5375 | if (!trace_ok_for_array(t, tr)) { |
| 5369 | ret = -EINVAL; | 5376 | ret = -EINVAL; |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index fb5d54d0d1b3..652c682707cd 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -444,6 +444,8 @@ struct tracer { | |||
| 444 | #ifdef CONFIG_TRACER_MAX_TRACE | 444 | #ifdef CONFIG_TRACER_MAX_TRACE |
| 445 | bool use_max_tr; | 445 | bool use_max_tr; |
| 446 | #endif | 446 | #endif |
| 447 | /* True if tracer cannot be enabled in kernel param */ | ||
| 448 | bool noboot; | ||
| 447 | }; | 449 | }; |
| 448 | 450 | ||
| 449 | 451 | ||
diff --git a/kernel/trace/trace_mmiotrace.c b/kernel/trace/trace_mmiotrace.c index cd7480d0a201..dca78fc48439 100644 --- a/kernel/trace/trace_mmiotrace.c +++ b/kernel/trace/trace_mmiotrace.c | |||
| @@ -282,6 +282,7 @@ static struct tracer mmio_tracer __read_mostly = | |||
| 282 | .close = mmio_close, | 282 | .close = mmio_close, |
| 283 | .read = mmio_read, | 283 | .read = mmio_read, |
| 284 | .print_line = mmio_print_line, | 284 | .print_line = mmio_print_line, |
| 285 | .noboot = true, | ||
| 285 | }; | 286 | }; |
| 286 | 287 | ||
| 287 | __init static int init_mmio_trace(void) | 288 | __init static int init_mmio_trace(void) |
