Skip to content

Commit

Permalink
ftrace: disable tracing when current_tracer is set to "none"
Browse files Browse the repository at this point in the history
Found that inspite of setting the current_tracer to "none", trace from
the previous trace type continued to be collected. The patch below fixes
this and causes the trace to be disabled when the "none" type is
selected.

Compile and boot tested the patch for functionality.

Signed-off-by: Ankita Garg <ankita@in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ankita Garg authored and Ingo Molnar committed Jun 10, 2008
1 parent 040ec23 commit 2b1bce1
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ static cpumask_t __read_mostly tracing_buffer_mask;
#define for_each_tracing_cpu(cpu) \
for_each_cpu_mask(cpu, tracing_buffer_mask)

/* dummy trace to disable tracing */
static struct tracer no_tracer __read_mostly = {
.name = "none",
};

static int trace_alloc_page(void);
static int trace_free_page(void);

Expand Down Expand Up @@ -135,6 +130,23 @@ static DECLARE_WAIT_QUEUE_HEAD(trace_wait);
/* trace_flags holds iter_ctrl options */
unsigned long trace_flags = TRACE_ITER_PRINT_PARENT;

static notrace void no_trace_init(struct trace_array *tr)
{
int cpu;

if(tr->ctrl)
for_each_online_cpu(cpu)
tracing_reset(tr->data[cpu]);
tracer_enabled = 0;
}

/* dummy trace to disable tracing */
static struct tracer no_tracer __read_mostly = {
.name = "none",
.init = no_trace_init
};


/**
* trace_wake_up - wake up tasks waiting for trace input
*
Expand Down

0 comments on commit 2b1bce1

Please sign in to comment.