]> git.baikalelectronics.ru Git - kernel.git/commitdiff
tracing: Ignore mmiotrace from kernel commandline
authorZiqian SUN (Zamir) <zsun@redhat.com>
Mon, 11 Sep 2017 06:26:35 +0000 (14:26 +0800)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 19 Sep 2017 16:36:01 +0000 (12:36 -0400)
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>
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_mmiotrace.c

index a7fb136da891c86c86da4e444710e67dbeb250e9..d3ca35f388037208b4e972c3708f4498ada1b816 100644 (file)
@@ -5364,6 +5364,13 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
        if (t == tr->current_trace)
                goto out;
 
+       /* Some tracers won't work on kernel command line */
+       if (system_state < SYSTEM_RUNNING && t->noboot) {
+               pr_warn("Tracer '%s' is not allowed on command line, ignored\n",
+                       t->name);
+               goto out;
+       }
+
        /* Some tracers are only allowed for the top level buffer */
        if (!trace_ok_for_array(t, tr)) {
                ret = -EINVAL;
index fb5d54d0d1b3f297087e96f03a22003fc887d359..652c682707cdd4f489a00c3b14df0b97ae8d2425 100644 (file)
@@ -444,6 +444,8 @@ struct tracer {
 #ifdef CONFIG_TRACER_MAX_TRACE
        bool                    use_max_tr;
 #endif
+       /* True if tracer cannot be enabled in kernel param */
+       bool                    noboot;
 };
 
 
index cd7480d0a201e335cd7adc20c9cb0a8dba16f189..dca78fc48439d21a80cd6576269eded8bfe13623 100644 (file)
@@ -282,6 +282,7 @@ static struct tracer mmio_tracer __read_mostly =
        .close          = mmio_close,
        .read           = mmio_read,
        .print_line     = mmio_print_line,
+       .noboot         = true,
 };
 
 __init static int init_mmio_trace(void)