tracing/ftrace: Allow for the traceonoff probe be unique to instances

Have the traceon/off function probe triggers affect only the instance they
are set in. This required making the trace_on/off accessible for other files
in the tracing directory.
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent cab50379
...@@ -757,7 +757,7 @@ __trace_buffer_lock_reserve(struct ring_buffer *buffer, ...@@ -757,7 +757,7 @@ __trace_buffer_lock_reserve(struct ring_buffer *buffer,
return event; return event;
} }
static void tracer_tracing_on(struct trace_array *tr) void tracer_tracing_on(struct trace_array *tr)
{ {
if (tr->trace_buffer.buffer) if (tr->trace_buffer.buffer)
ring_buffer_record_on(tr->trace_buffer.buffer); ring_buffer_record_on(tr->trace_buffer.buffer);
...@@ -1045,7 +1045,7 @@ void tracing_snapshot_alloc(void) ...@@ -1045,7 +1045,7 @@ void tracing_snapshot_alloc(void)
EXPORT_SYMBOL_GPL(tracing_snapshot_alloc); EXPORT_SYMBOL_GPL(tracing_snapshot_alloc);
#endif /* CONFIG_TRACER_SNAPSHOT */ #endif /* CONFIG_TRACER_SNAPSHOT */
static void tracer_tracing_off(struct trace_array *tr) void tracer_tracing_off(struct trace_array *tr)
{ {
if (tr->trace_buffer.buffer) if (tr->trace_buffer.buffer)
ring_buffer_record_off(tr->trace_buffer.buffer); ring_buffer_record_off(tr->trace_buffer.buffer);
......
...@@ -582,6 +582,8 @@ void tracing_reset_all_online_cpus(void); ...@@ -582,6 +582,8 @@ void tracing_reset_all_online_cpus(void);
int tracing_open_generic(struct inode *inode, struct file *filp); int tracing_open_generic(struct inode *inode, struct file *filp);
bool tracing_is_disabled(void); bool tracing_is_disabled(void);
int tracer_tracing_is_on(struct trace_array *tr); int tracer_tracing_is_on(struct trace_array *tr);
void tracer_tracing_on(struct trace_array *tr);
void tracer_tracing_off(struct trace_array *tr);
struct dentry *trace_create_file(const char *name, struct dentry *trace_create_file(const char *name,
umode_t mode, umode_t mode,
struct dentry *parent, struct dentry *parent,
......
...@@ -268,7 +268,8 @@ static struct tracer function_trace __tracer_data = ...@@ -268,7 +268,8 @@ static struct tracer function_trace __tracer_data =
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
static void update_traceon_count(struct ftrace_probe_ops *ops, static void update_traceon_count(struct ftrace_probe_ops *ops,
unsigned long ip, bool on, unsigned long ip,
struct trace_array *tr, bool on,
void *data) void *data)
{ {
struct ftrace_func_mapper *mapper = data; struct ftrace_func_mapper *mapper = data;
...@@ -313,13 +314,13 @@ static void update_traceon_count(struct ftrace_probe_ops *ops, ...@@ -313,13 +314,13 @@ static void update_traceon_count(struct ftrace_probe_ops *ops,
/* Make sure we see count before checking tracing state */ /* Make sure we see count before checking tracing state */
smp_rmb(); smp_rmb();
if (on == !!tracing_is_on()) if (on == !!tracer_tracing_is_on(tr))
return; return;
if (on) if (on)
tracing_on(); tracer_tracing_on(tr);
else else
tracing_off(); tracer_tracing_off(tr);
/* Make sure tracing state is visible before updating count */ /* Make sure tracing state is visible before updating count */
smp_wmb(); smp_wmb();
...@@ -332,7 +333,7 @@ ftrace_traceon_count(unsigned long ip, unsigned long parent_ip, ...@@ -332,7 +333,7 @@ ftrace_traceon_count(unsigned long ip, unsigned long parent_ip,
struct trace_array *tr, struct ftrace_probe_ops *ops, struct trace_array *tr, struct ftrace_probe_ops *ops,
void *data) void *data)
{ {
update_traceon_count(ops, ip, 1, data); update_traceon_count(ops, ip, tr, 1, data);
} }
static void static void
...@@ -340,7 +341,7 @@ ftrace_traceoff_count(unsigned long ip, unsigned long parent_ip, ...@@ -340,7 +341,7 @@ ftrace_traceoff_count(unsigned long ip, unsigned long parent_ip,
struct trace_array *tr, struct ftrace_probe_ops *ops, struct trace_array *tr, struct ftrace_probe_ops *ops,
void *data) void *data)
{ {
update_traceon_count(ops, ip, 0, data); update_traceon_count(ops, ip, tr, 0, data);
} }
static void static void
...@@ -348,10 +349,10 @@ ftrace_traceon(unsigned long ip, unsigned long parent_ip, ...@@ -348,10 +349,10 @@ ftrace_traceon(unsigned long ip, unsigned long parent_ip,
struct trace_array *tr, struct ftrace_probe_ops *ops, struct trace_array *tr, struct ftrace_probe_ops *ops,
void *data) void *data)
{ {
if (tracing_is_on()) if (tracer_tracing_is_on(tr))
return; return;
tracing_on(); tracer_tracing_on(tr);
} }
static void static void
...@@ -359,10 +360,10 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip, ...@@ -359,10 +360,10 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip,
struct trace_array *tr, struct ftrace_probe_ops *ops, struct trace_array *tr, struct ftrace_probe_ops *ops,
void *data) void *data)
{ {
if (!tracing_is_on()) if (!tracer_tracing_is_on(tr))
return; return;
tracing_off(); tracer_tracing_off(tr);
} }
/* /*
......
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