diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-20 12:38:07 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-20 12:38:07 -0400 |
commit | c52f56a69d104d5294af3d652776d94b1ef6a175 (patch) | |
tree | 5c4014d8b4b05668dbfb98b90fce0c41e839987f | |
parent | 820bf5c419e4b85298e5c3001bd1b5be46d60765 (diff) | |
parent | 75df6e688ccd517e339a7c422ef7ad73045b18a2 (diff) |
Merge tag 'trace-v4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt:
"This includes three minor fixes.
- Have writing to trace file clear the irqsoff (and friends) tracer
- trace_pipe behavior for instance buffers was different than top
buffer
- Show a message of why mmiotrace doesn't start from commandline"
* tag 'trace-v4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Fix trace_pipe behavior for instance traces
tracing: Ignore mmiotrace from kernel commandline
tracing: Erase irqsoff trace with empty write
-rw-r--r-- | kernel/trace/trace.c | 19 | ||||
-rw-r--r-- | kernel/trace/trace.h | 2 | ||||
-rw-r--r-- | kernel/trace/trace_mmiotrace.c | 1 |
3 files changed, 19 insertions, 3 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 5360b7aec57a..752e5daf0896 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -4020,11 +4020,17 @@ static int tracing_open(struct inode *inode, struct file *file) | |||
4020 | /* If this file was open for write, then erase contents */ | 4020 | /* If this file was open for write, then erase contents */ |
4021 | if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) { | 4021 | if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) { |
4022 | int cpu = tracing_get_cpu(inode); | 4022 | int cpu = tracing_get_cpu(inode); |
4023 | struct trace_buffer *trace_buf = &tr->trace_buffer; | ||
4024 | |||
4025 | #ifdef CONFIG_TRACER_MAX_TRACE | ||
4026 | if (tr->current_trace->print_max) | ||
4027 | trace_buf = &tr->max_buffer; | ||
4028 | #endif | ||
4023 | 4029 | ||
4024 | if (cpu == RING_BUFFER_ALL_CPUS) | 4030 | if (cpu == RING_BUFFER_ALL_CPUS) |
4025 | tracing_reset_online_cpus(&tr->trace_buffer); | 4031 | tracing_reset_online_cpus(trace_buf); |
4026 | else | 4032 | else |
4027 | tracing_reset(&tr->trace_buffer, cpu); | 4033 | tracing_reset(trace_buf, cpu); |
4028 | } | 4034 | } |
4029 | 4035 | ||
4030 | if (file->f_mode & FMODE_READ) { | 4036 | if (file->f_mode & FMODE_READ) { |
@@ -5358,6 +5364,13 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf) | |||
5358 | if (t == tr->current_trace) | 5364 | if (t == tr->current_trace) |
5359 | goto out; | 5365 | goto out; |
5360 | 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 | |||
5361 | /* Some tracers are only allowed for the top level buffer */ | 5374 | /* Some tracers are only allowed for the top level buffer */ |
5362 | if (!trace_ok_for_array(t, tr)) { | 5375 | if (!trace_ok_for_array(t, tr)) { |
5363 | ret = -EINVAL; | 5376 | ret = -EINVAL; |
@@ -5667,7 +5680,7 @@ static int tracing_wait_pipe(struct file *filp) | |||
5667 | * | 5680 | * |
5668 | * iter->pos will be 0 if we haven't read anything. | 5681 | * iter->pos will be 0 if we haven't read anything. |
5669 | */ | 5682 | */ |
5670 | if (!tracing_is_on() && iter->pos) | 5683 | if (!tracer_tracing_is_on(iter->tr) && iter->pos) |
5671 | break; | 5684 | break; |
5672 | 5685 | ||
5673 | mutex_unlock(&iter->mutex); | 5686 | mutex_unlock(&iter->mutex); |
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) |