Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339004
b: refs/heads/master
c: 0fb9656
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Steven Rostedt committed Nov 2, 2012
1 parent 0145cc8 commit d916858
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 87 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c7b84ecada9a8b7fe3e6c081e70801703897ed5d
refs/heads/master: 0fb9656d957d79dbe7ae155bb6533b1d465e4a50
79 changes: 5 additions & 74 deletions trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,9 @@ static struct trace_array max_tr;

static DEFINE_PER_CPU(struct trace_array_cpu, max_tr_data);

/* tracer_enabled is used to toggle activation of a tracer */
static int tracer_enabled = 1;

/**
* tracing_is_enabled - return tracer_enabled status
*
* This function is used by other tracers to know the status
* of the tracer_enabled flag. Tracers may use this function
* to know if it should enable their features when starting
* up. See irqsoff tracer for an example (start_irqsoff_tracer).
*/
int tracing_is_enabled(void)
{
return tracer_enabled;
return tracing_is_on();
}

/*
Expand Down Expand Up @@ -1112,8 +1101,7 @@ void trace_find_cmdline(int pid, char comm[])

void tracing_record_cmdline(struct task_struct *tsk)
{
if (atomic_read(&trace_record_cmdline_disabled) || !tracer_enabled ||
!tracing_is_on())
if (atomic_read(&trace_record_cmdline_disabled) || !tracing_is_on())
return;

if (!__this_cpu_read(trace_cmdline_save))
Expand Down Expand Up @@ -2966,56 +2954,6 @@ static const struct file_operations tracing_saved_cmdlines_fops = {
.llseek = generic_file_llseek,
};

static ssize_t
tracing_ctrl_read(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
{
char buf[64];
int r;

r = sprintf(buf, "%u\n", tracer_enabled);
return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
}

static ssize_t
tracing_ctrl_write(struct file *filp, const char __user *ubuf,
size_t cnt, loff_t *ppos)
{
struct trace_array *tr = filp->private_data;
unsigned long val;
int ret;

ret = kstrtoul_from_user(ubuf, cnt, 10, &val);
if (ret)
return ret;

val = !!val;

mutex_lock(&trace_types_lock);
if (tracer_enabled ^ val) {

/* Only need to warn if this is used to change the state */
WARN_ONCE(1, "tracing_enabled is deprecated. Use tracing_on");

if (val) {
tracer_enabled = 1;
if (current_trace->start)
current_trace->start(tr);
tracing_start();
} else {
tracer_enabled = 0;
tracing_stop();
if (current_trace->stop)
current_trace->stop(tr);
}
}
mutex_unlock(&trace_types_lock);

*ppos += cnt;

return cnt;
}

static ssize_t
tracing_set_trace_read(struct file *filp, char __user *ubuf,
size_t cnt, loff_t *ppos)
Expand Down Expand Up @@ -3469,15 +3407,15 @@ static int tracing_wait_pipe(struct file *filp)
return -EINTR;

/*
* We block until we read something and tracing is disabled.
* We block until we read something and tracing is enabled.
* We still block if tracing is disabled, but we have never
* read anything. This allows a user to cat this file, and
* then enable tracing. But after we have read something,
* we give an EOF when tracing is again disabled.
*
* iter->pos will be 0 if we haven't read anything.
*/
if (!tracer_enabled && iter->pos)
if (tracing_is_enabled() && iter->pos)
break;
}

Expand Down Expand Up @@ -4076,13 +4014,6 @@ static const struct file_operations tracing_max_lat_fops = {
.llseek = generic_file_llseek,
};

static const struct file_operations tracing_ctrl_fops = {
.open = tracing_open_generic,
.read = tracing_ctrl_read,
.write = tracing_ctrl_write,
.llseek = generic_file_llseek,
};

static const struct file_operations set_tracer_fops = {
.open = tracing_open_generic,
.read = tracing_set_trace_read,
Expand Down Expand Up @@ -4858,7 +4789,7 @@ static __init int tracer_init_debugfs(void)
d_tracer = tracing_init_dentry();

trace_create_file("tracing_enabled", 0644, d_tracer,
&global_trace, &tracing_ctrl_fops);
&global_trace, &rb_simple_fops);

trace_create_file("trace_options", 0644, d_tracer,
NULL, &tracing_iter_fops);
Expand Down
12 changes: 0 additions & 12 deletions trunk/kernel/trace/trace_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,
int (*func)(void))
{
int save_ftrace_enabled = ftrace_enabled;
int save_tracer_enabled = tracer_enabled;
unsigned long count;
char *func_name;
int ret;
Expand All @@ -331,7 +330,6 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,

/* enable tracing, and record the filter function */
ftrace_enabled = 1;
tracer_enabled = 1;

/* passed in by parameter to fool gcc from optimizing */
func();
Expand Down Expand Up @@ -395,7 +393,6 @@ int trace_selftest_startup_dynamic_tracing(struct tracer *trace,

out:
ftrace_enabled = save_ftrace_enabled;
tracer_enabled = save_tracer_enabled;

/* Enable tracing on all functions again */
ftrace_set_global_filter(NULL, 0, 1);
Expand Down Expand Up @@ -452,7 +449,6 @@ static int
trace_selftest_function_recursion(void)
{
int save_ftrace_enabled = ftrace_enabled;
int save_tracer_enabled = tracer_enabled;
char *func_name;
int len;
int ret;
Expand All @@ -465,7 +461,6 @@ trace_selftest_function_recursion(void)

/* enable tracing, and record the filter function */
ftrace_enabled = 1;
tracer_enabled = 1;

/* Handle PPC64 '.' name */
func_name = "*" __stringify(DYN_FTRACE_TEST_NAME);
Expand Down Expand Up @@ -534,7 +529,6 @@ trace_selftest_function_recursion(void)
ret = 0;
out:
ftrace_enabled = save_ftrace_enabled;
tracer_enabled = save_tracer_enabled;

return ret;
}
Expand Down Expand Up @@ -569,7 +563,6 @@ static int
trace_selftest_function_regs(void)
{
int save_ftrace_enabled = ftrace_enabled;
int save_tracer_enabled = tracer_enabled;
char *func_name;
int len;
int ret;
Expand All @@ -586,7 +579,6 @@ trace_selftest_function_regs(void)

/* enable tracing, and record the filter function */
ftrace_enabled = 1;
tracer_enabled = 1;

/* Handle PPC64 '.' name */
func_name = "*" __stringify(DYN_FTRACE_TEST_NAME);
Expand Down Expand Up @@ -648,7 +640,6 @@ trace_selftest_function_regs(void)
ret = 0;
out:
ftrace_enabled = save_ftrace_enabled;
tracer_enabled = save_tracer_enabled;

return ret;
}
Expand All @@ -662,7 +653,6 @@ int
trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
{
int save_ftrace_enabled = ftrace_enabled;
int save_tracer_enabled = tracer_enabled;
unsigned long count;
int ret;

Expand All @@ -671,7 +661,6 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)

/* start the tracing */
ftrace_enabled = 1;
tracer_enabled = 1;

ret = tracer_init(trace, tr);
if (ret) {
Expand Down Expand Up @@ -708,7 +697,6 @@ trace_selftest_startup_function(struct tracer *trace, struct trace_array *tr)
ret = trace_selftest_function_regs();
out:
ftrace_enabled = save_ftrace_enabled;
tracer_enabled = save_tracer_enabled;

/* kill ftrace totally if we failed */
if (ret)
Expand Down

0 comments on commit d916858

Please sign in to comment.