Skip to content

Commit c7b3ae0

Browse files
sztsianrostedt
authored andcommitted
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/[email protected] Signed-off-by: Ziqian SUN (Zamir) <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
1 parent 8dd33bc commit c7b3ae0

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

kernel/trace/trace.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5364,6 +5364,13 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
53645364
if (t == tr->current_trace)
53655365
goto out;
53665366

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+
53675374
/* Some tracers are only allowed for the top level buffer */
53685375
if (!trace_ok_for_array(t, tr)) {
53695376
ret = -EINVAL;

kernel/trace/trace.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,8 @@ struct tracer {
444444
#ifdef CONFIG_TRACER_MAX_TRACE
445445
bool use_max_tr;
446446
#endif
447+
/* True if tracer cannot be enabled in kernel param */
448+
bool noboot;
447449
};
448450

449451

kernel/trace/trace_mmiotrace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ static struct tracer mmio_tracer __read_mostly =
282282
.close = mmio_close,
283283
.read = mmio_read,
284284
.print_line = mmio_print_line,
285+
.noboot = true,
285286
};
286287

287288
__init static int init_mmio_trace(void)

0 commit comments

Comments
 (0)