Commit c76f0694 authored by Steven Rostedt's avatar Steven Rostedt Committed by Ingo Molnar

ftrace: remove trace array ctrl

Impact: remove obsolete variable in trace_array structure

With the new start / stop method of ftrace, the ctrl variable
in the trace_array structure is now obsolete. Remove it.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent bbf5b1a0
...@@ -537,7 +537,6 @@ int register_tracer(struct tracer *type) ...@@ -537,7 +537,6 @@ int register_tracer(struct tracer *type)
if (type->selftest) { if (type->selftest) {
struct tracer *saved_tracer = current_trace; struct tracer *saved_tracer = current_trace;
struct trace_array *tr = &global_trace; struct trace_array *tr = &global_trace;
int saved_ctrl = tr->ctrl;
int i; int i;
/* /*
* Run a selftest on this tracer. * Run a selftest on this tracer.
...@@ -550,13 +549,11 @@ int register_tracer(struct tracer *type) ...@@ -550,13 +549,11 @@ int register_tracer(struct tracer *type)
tracing_reset(tr, i); tracing_reset(tr, i);
} }
current_trace = type; current_trace = type;
tr->ctrl = 0;
/* the test is responsible for initializing and enabling */ /* the test is responsible for initializing and enabling */
pr_info("Testing tracer %s: ", type->name); pr_info("Testing tracer %s: ", type->name);
ret = type->selftest(type, tr); ret = type->selftest(type, tr);
/* the test is responsible for resetting too */ /* the test is responsible for resetting too */
current_trace = saved_tracer; current_trace = saved_tracer;
tr->ctrl = saved_ctrl;
if (ret) { if (ret) {
printk(KERN_CONT "FAILED!\n"); printk(KERN_CONT "FAILED!\n");
goto out; goto out;
...@@ -966,7 +963,7 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3) ...@@ -966,7 +963,7 @@ ftrace_special(unsigned long arg1, unsigned long arg2, unsigned long arg3)
int cpu; int cpu;
int pc; int pc;
if (tracing_disabled || !tr->ctrl) if (tracing_disabled)
return; return;
pc = preempt_count(); pc = preempt_count();
...@@ -2820,7 +2817,6 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, ...@@ -2820,7 +2817,6 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
unsigned long val; unsigned long val;
char buf[64]; char buf[64];
int ret; int ret;
struct trace_array *tr = filp->private_data;
if (cnt >= sizeof(buf)) if (cnt >= sizeof(buf))
return -EINVAL; return -EINVAL;
...@@ -2840,12 +2836,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, ...@@ -2840,12 +2836,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
mutex_lock(&trace_types_lock); mutex_lock(&trace_types_lock);
if (tr->ctrl) { tracing_stop();
cnt = -EBUSY;
pr_info("ftrace: please disable tracing"
" before modifying buffer size\n");
goto out;
}
if (val != global_trace.entries) { if (val != global_trace.entries) {
ret = ring_buffer_resize(global_trace.buffer, val); ret = ring_buffer_resize(global_trace.buffer, val);
...@@ -2878,6 +2869,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, ...@@ -2878,6 +2869,7 @@ tracing_entries_write(struct file *filp, const char __user *ubuf,
if (tracing_disabled) if (tracing_disabled)
cnt = -ENOMEM; cnt = -ENOMEM;
out: out:
tracing_start();
max_tr.entries = global_trace.entries; max_tr.entries = global_trace.entries;
mutex_unlock(&trace_types_lock); mutex_unlock(&trace_types_lock);
...@@ -2900,9 +2892,8 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, ...@@ -2900,9 +2892,8 @@ tracing_mark_write(struct file *filp, const char __user *ubuf,
{ {
char *buf; char *buf;
char *end; char *end;
struct trace_array *tr = &global_trace;
if (!tr->ctrl || tracing_disabled) if (tracing_disabled)
return -EINVAL; return -EINVAL;
if (cnt > TRACE_BUF_SIZE) if (cnt > TRACE_BUF_SIZE)
...@@ -3131,7 +3122,7 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args) ...@@ -3131,7 +3122,7 @@ int trace_vprintk(unsigned long ip, const char *fmt, va_list args)
unsigned long flags, irq_flags; unsigned long flags, irq_flags;
int cpu, len = 0, size, pc; int cpu, len = 0, size, pc;
if (!tr->ctrl || tracing_disabled) if (tracing_disabled)
return 0; return 0;
pc = preempt_count(); pc = preempt_count();
...@@ -3365,7 +3356,6 @@ __init static int tracer_alloc_buffers(void) ...@@ -3365,7 +3356,6 @@ __init static int tracer_alloc_buffers(void)
#endif #endif
/* All seems OK, enable tracing */ /* All seems OK, enable tracing */
global_trace.ctrl = 1;
tracing_disabled = 0; tracing_disabled = 0;
atomic_notifier_chain_register(&panic_notifier_list, atomic_notifier_chain_register(&panic_notifier_list,
......
...@@ -172,7 +172,6 @@ struct trace_iterator; ...@@ -172,7 +172,6 @@ struct trace_iterator;
struct trace_array { struct trace_array {
struct ring_buffer *buffer; struct ring_buffer *buffer;
unsigned long entries; unsigned long entries;
long ctrl;
int cpu; int cpu;
cycle_t time_start; cycle_t time_start;
struct task_struct *waiter; struct task_struct *waiter;
......
...@@ -44,14 +44,12 @@ static void stop_function_trace(struct trace_array *tr) ...@@ -44,14 +44,12 @@ static void stop_function_trace(struct trace_array *tr)
static void function_trace_init(struct trace_array *tr) static void function_trace_init(struct trace_array *tr)
{ {
if (tr->ctrl) start_function_trace(tr);
start_function_trace(tr);
} }
static void function_trace_reset(struct trace_array *tr) static void function_trace_reset(struct trace_array *tr)
{ {
if (tr->ctrl) stop_function_trace(tr);
stop_function_trace(tr);
} }
static void function_trace_start(struct trace_array *tr) static void function_trace_start(struct trace_array *tr)
......
...@@ -383,15 +383,12 @@ static void __irqsoff_tracer_init(struct trace_array *tr) ...@@ -383,15 +383,12 @@ static void __irqsoff_tracer_init(struct trace_array *tr)
irqsoff_trace = tr; irqsoff_trace = tr;
/* make sure that the tracer is visible */ /* make sure that the tracer is visible */
smp_wmb(); smp_wmb();
start_irqsoff_tracer(tr);
if (tr->ctrl)
start_irqsoff_tracer(tr);
} }
static void irqsoff_tracer_reset(struct trace_array *tr) static void irqsoff_tracer_reset(struct trace_array *tr)
{ {
if (tr->ctrl) stop_irqsoff_tracer(tr);
stop_irqsoff_tracer(tr);
} }
static void irqsoff_tracer_start(struct trace_array *tr) static void irqsoff_tracer_start(struct trace_array *tr)
......
...@@ -34,17 +34,16 @@ static void mmio_trace_init(struct trace_array *tr) ...@@ -34,17 +34,16 @@ static void mmio_trace_init(struct trace_array *tr)
{ {
pr_debug("in %s\n", __func__); pr_debug("in %s\n", __func__);
mmio_trace_array = tr; mmio_trace_array = tr;
if (tr->ctrl) {
mmio_reset_data(tr); mmio_reset_data(tr);
enable_mmiotrace(); enable_mmiotrace();
}
} }
static void mmio_trace_reset(struct trace_array *tr) static void mmio_trace_reset(struct trace_array *tr)
{ {
pr_debug("in %s\n", __func__); pr_debug("in %s\n", __func__);
if (tr->ctrl)
disable_mmiotrace(); disable_mmiotrace();
mmio_reset_data(tr); mmio_reset_data(tr);
mmio_trace_array = NULL; mmio_trace_array = NULL;
} }
......
...@@ -32,14 +32,12 @@ static void nop_trace_init(struct trace_array *tr) ...@@ -32,14 +32,12 @@ static void nop_trace_init(struct trace_array *tr)
for_each_online_cpu(cpu) for_each_online_cpu(cpu)
tracing_reset(tr, cpu); tracing_reset(tr, cpu);
if (tr->ctrl) start_nop_trace(tr);
start_nop_trace(tr);
} }
static void nop_trace_reset(struct trace_array *tr) static void nop_trace_reset(struct trace_array *tr)
{ {
if (tr->ctrl) stop_nop_trace(tr);
stop_nop_trace(tr);
} }
struct tracer nop_trace __read_mostly = struct tracer nop_trace __read_mostly =
......
...@@ -209,14 +209,12 @@ static void stop_sched_trace(struct trace_array *tr) ...@@ -209,14 +209,12 @@ static void stop_sched_trace(struct trace_array *tr)
static void sched_switch_trace_init(struct trace_array *tr) static void sched_switch_trace_init(struct trace_array *tr)
{ {
ctx_trace = tr; ctx_trace = tr;
start_sched_trace(tr);
if (tr->ctrl)
start_sched_trace(tr);
} }
static void sched_switch_trace_reset(struct trace_array *tr) static void sched_switch_trace_reset(struct trace_array *tr)
{ {
if (tr->ctrl && sched_ref) if (sched_ref)
stop_sched_trace(tr); stop_sched_trace(tr);
} }
......
...@@ -334,18 +334,14 @@ static void stop_wakeup_tracer(struct trace_array *tr) ...@@ -334,18 +334,14 @@ static void stop_wakeup_tracer(struct trace_array *tr)
static void wakeup_tracer_init(struct trace_array *tr) static void wakeup_tracer_init(struct trace_array *tr)
{ {
wakeup_trace = tr; wakeup_trace = tr;
start_wakeup_tracer(tr);
if (tr->ctrl)
start_wakeup_tracer(tr);
} }
static void wakeup_tracer_reset(struct trace_array *tr) static void wakeup_tracer_reset(struct trace_array *tr)
{ {
if (tr->ctrl) { stop_wakeup_tracer(tr);
stop_wakeup_tracer(tr); /* make sure we put back any tasks we are tracing */
/* make sure we put back any tasks we are tracing */ wakeup_reset(tr);
wakeup_reset(tr);
}
} }
static void wakeup_tracer_start(struct trace_array *tr) static void wakeup_tracer_start(struct trace_array *tr)
......
...@@ -110,7 +110,6 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace, ...@@ -110,7 +110,6 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
ftrace_set_filter(func_name, strlen(func_name), 1); ftrace_set_filter(func_name, strlen(func_name), 1);
/* enable tracing */ /* enable tracing */
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* Sleep for a 1/10 of a second */ /* Sleep for a 1/10 of a second */
...@@ -181,7 +180,6 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr) ...@@ -181,7 +180,6 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
ftrace_enabled = 1; ftrace_enabled = 1;
tracer_enabled = 1; tracer_enabled = 1;
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* Sleep for a 1/10 of a second */ /* Sleep for a 1/10 of a second */
msleep(100); msleep(100);
...@@ -224,7 +222,6 @@ trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr) ...@@ -224,7 +222,6 @@ trace_selftest_startup_irqsoff(struct tracer *trace, struct trace_array *tr)
int ret; int ret;
/* start the tracing */ /* start the tracing */
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* reset the max latency */ /* reset the max latency */
tracing_max_latency = 0; tracing_max_latency = 0;
...@@ -261,7 +258,6 @@ trace_selftest_startup_preemptoff(struct tracer *trace, struct trace_array *tr) ...@@ -261,7 +258,6 @@ trace_selftest_startup_preemptoff(struct tracer *trace, struct trace_array *tr)
int ret; int ret;
/* start the tracing */ /* start the tracing */
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* reset the max latency */ /* reset the max latency */
tracing_max_latency = 0; tracing_max_latency = 0;
...@@ -298,7 +294,6 @@ trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array * ...@@ -298,7 +294,6 @@ trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array *
int ret; int ret;
/* start the tracing */ /* start the tracing */
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* reset the max latency */ /* reset the max latency */
...@@ -427,7 +422,6 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr) ...@@ -427,7 +422,6 @@ trace_selftest_startup_wakeup(struct tracer *trace, struct trace_array *tr)
wait_for_completion(&isrt); wait_for_completion(&isrt);
/* start the tracing */ /* start the tracing */
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* reset the max latency */ /* reset the max latency */
tracing_max_latency = 0; tracing_max_latency = 0;
...@@ -484,7 +478,6 @@ trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr ...@@ -484,7 +478,6 @@ trace_selftest_startup_sched_switch(struct tracer *trace, struct trace_array *tr
int ret; int ret;
/* start the tracing */ /* start the tracing */
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* Sleep for a 1/10 of a second */ /* Sleep for a 1/10 of a second */
msleep(100); msleep(100);
...@@ -512,7 +505,6 @@ trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr) ...@@ -512,7 +505,6 @@ trace_selftest_startup_sysprof(struct tracer *trace, struct trace_array *tr)
int ret; int ret;
/* start the tracing */ /* start the tracing */
tr->ctrl = 1;
trace->init(tr); trace->init(tr);
/* Sleep for a 1/10 of a second */ /* Sleep for a 1/10 of a second */
msleep(100); msleep(100);
......
...@@ -265,14 +265,12 @@ static void stack_trace_init(struct trace_array *tr) ...@@ -265,14 +265,12 @@ static void stack_trace_init(struct trace_array *tr)
{ {
sysprof_trace = tr; sysprof_trace = tr;
if (tr->ctrl) start_stack_trace(tr);
start_stack_trace(tr);
} }
static void stack_trace_reset(struct trace_array *tr) static void stack_trace_reset(struct trace_array *tr)
{ {
if (tr->ctrl) stop_stack_trace(tr);
stop_stack_trace(tr);
} }
static struct tracer stack_trace __read_mostly = static struct tracer stack_trace __read_mostly =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment