Skip to content

Commit c52f56a

Browse files
committed
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
2 parents 820bf5c + 75df6e6 commit c52f56a

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

kernel/trace/trace.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4020,11 +4020,17 @@ static int tracing_open(struct inode *inode, struct file *file)
40204020
/* If this file was open for write, then erase contents */
40214021
if ((file->f_mode & FMODE_WRITE) && (file->f_flags & O_TRUNC)) {
40224022
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
40234029

40244030
if (cpu == RING_BUFFER_ALL_CPUS)
4025-
tracing_reset_online_cpus(&tr->trace_buffer);
4031+
tracing_reset_online_cpus(trace_buf);
40264032
else
4027-
tracing_reset(&tr->trace_buffer, cpu);
4033+
tracing_reset(trace_buf, cpu);
40284034
}
40294035

40304036
if (file->f_mode & FMODE_READ) {
@@ -5358,6 +5364,13 @@ static int tracing_set_tracer(struct trace_array *tr, const char *buf)
53585364
if (t == tr->current_trace)
53595365
goto out;
53605366

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+
53615374
/* Some tracers are only allowed for the top level buffer */
53625375
if (!trace_ok_for_array(t, tr)) {
53635376
ret = -EINVAL;
@@ -5667,7 +5680,7 @@ static int tracing_wait_pipe(struct file *filp)
56675680
*
56685681
* iter->pos will be 0 if we haven't read anything.
56695682
*/
5670-
if (!tracing_is_on() && iter->pos)
5683+
if (!tracer_tracing_is_on(iter->tr) && iter->pos)
56715684
break;
56725685

56735686
mutex_unlock(&iter->mutex);

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)