Commit 2d34f489 authored by Steven Rostedt (Red Hat)'s avatar Steven Rostedt (Red Hat) Committed by Steven Rostedt

tracing: Make ftrace_trace_stack() depend on general trace_array flag

In preparation for the multi buffer instances to have their own trace_flags,
the check in ftrace_trace_stack() needs to test the trace_array descriptor
flag that is for the current event, not the global_trace descriptor.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 9a38a885
...@@ -482,7 +482,8 @@ static inline void trace_access_lock_init(void) ...@@ -482,7 +482,8 @@ static inline void trace_access_lock_init(void)
static void __ftrace_trace_stack(struct ring_buffer *buffer, static void __ftrace_trace_stack(struct ring_buffer *buffer,
unsigned long flags, unsigned long flags,
int skip, int pc, struct pt_regs *regs); int skip, int pc, struct pt_regs *regs);
static inline void ftrace_trace_stack(struct ring_buffer *buffer, static inline void ftrace_trace_stack(struct trace_array *tr,
struct ring_buffer *buffer,
unsigned long flags, unsigned long flags,
int skip, int pc, struct pt_regs *regs); int skip, int pc, struct pt_regs *regs);
...@@ -492,7 +493,8 @@ static inline void __ftrace_trace_stack(struct ring_buffer *buffer, ...@@ -492,7 +493,8 @@ static inline void __ftrace_trace_stack(struct ring_buffer *buffer,
int skip, int pc, struct pt_regs *regs) int skip, int pc, struct pt_regs *regs)
{ {
} }
static inline void ftrace_trace_stack(struct ring_buffer *buffer, static inline void ftrace_trace_stack(struct trace_array *tr,
struct ring_buffer *buffer,
unsigned long flags, unsigned long flags,
int skip, int pc, struct pt_regs *regs) int skip, int pc, struct pt_regs *regs)
{ {
...@@ -574,7 +576,7 @@ int __trace_puts(unsigned long ip, const char *str, int size) ...@@ -574,7 +576,7 @@ int __trace_puts(unsigned long ip, const char *str, int size)
entry->buf[size] = '\0'; entry->buf[size] = '\0';
__buffer_unlock_commit(buffer, event); __buffer_unlock_commit(buffer, event);
ftrace_trace_stack(buffer, irq_flags, 4, pc, NULL); ftrace_trace_stack(&global_trace, buffer, irq_flags, 4, pc, NULL);
return size; return size;
} }
...@@ -614,7 +616,7 @@ int __trace_bputs(unsigned long ip, const char *str) ...@@ -614,7 +616,7 @@ int __trace_bputs(unsigned long ip, const char *str)
entry->str = str; entry->str = str;
__buffer_unlock_commit(buffer, event); __buffer_unlock_commit(buffer, event);
ftrace_trace_stack(buffer, irq_flags, 4, pc, NULL); ftrace_trace_stack(&global_trace, buffer, irq_flags, 4, pc, NULL);
return 1; return 1;
} }
...@@ -1691,7 +1693,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr, ...@@ -1691,7 +1693,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr,
{ {
__buffer_unlock_commit(buffer, event); __buffer_unlock_commit(buffer, event);
ftrace_trace_stack(buffer, flags, 6, pc, NULL); ftrace_trace_stack(tr, buffer, flags, 6, pc, NULL);
ftrace_trace_userstack(buffer, flags, pc); ftrace_trace_userstack(buffer, flags, pc);
} }
EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit); EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit);
...@@ -1743,7 +1745,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr, ...@@ -1743,7 +1745,7 @@ void trace_buffer_unlock_commit_regs(struct trace_array *tr,
{ {
__buffer_unlock_commit(buffer, event); __buffer_unlock_commit(buffer, event);
ftrace_trace_stack(buffer, flags, 6, pc, regs); ftrace_trace_stack(tr, buffer, flags, 6, pc, regs);
ftrace_trace_userstack(buffer, flags, pc); ftrace_trace_userstack(buffer, flags, pc);
} }
EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit_regs); EXPORT_SYMBOL_GPL(trace_buffer_unlock_commit_regs);
...@@ -1872,11 +1874,12 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer, ...@@ -1872,11 +1874,12 @@ static void __ftrace_trace_stack(struct ring_buffer *buffer,
} }
static inline void ftrace_trace_stack(struct ring_buffer *buffer, static inline void ftrace_trace_stack(struct trace_array *tr,
struct ring_buffer *buffer,
unsigned long flags, unsigned long flags,
int skip, int pc, struct pt_regs *regs) int skip, int pc, struct pt_regs *regs)
{ {
if (!(global_trace.trace_flags & TRACE_ITER_STACKTRACE)) if (!(tr->trace_flags & TRACE_ITER_STACKTRACE))
return; return;
__ftrace_trace_stack(buffer, flags, skip, pc, regs); __ftrace_trace_stack(buffer, flags, skip, pc, regs);
...@@ -2164,7 +2167,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) ...@@ -2164,7 +2167,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
memcpy(entry->buf, tbuffer, sizeof(u32) * len); memcpy(entry->buf, tbuffer, sizeof(u32) * len);
if (!call_filter_check_discard(call, entry, buffer, event)) { if (!call_filter_check_discard(call, entry, buffer, event)) {
__buffer_unlock_commit(buffer, event); __buffer_unlock_commit(buffer, event);
ftrace_trace_stack(buffer, flags, 6, pc, NULL); ftrace_trace_stack(tr, buffer, flags, 6, pc, NULL);
} }
out: out:
...@@ -2216,7 +2219,7 @@ __trace_array_vprintk(struct ring_buffer *buffer, ...@@ -2216,7 +2219,7 @@ __trace_array_vprintk(struct ring_buffer *buffer,
memcpy(&entry->buf, tbuffer, len + 1); memcpy(&entry->buf, tbuffer, len + 1);
if (!call_filter_check_discard(call, entry, buffer, event)) { if (!call_filter_check_discard(call, entry, buffer, event)) {
__buffer_unlock_commit(buffer, event); __buffer_unlock_commit(buffer, event);
ftrace_trace_stack(buffer, flags, 6, pc, NULL); ftrace_trace_stack(&global_trace, buffer, flags, 6, pc, NULL);
} }
out: out:
preempt_enable_notrace(); preempt_enable_notrace();
......
...@@ -2941,15 +2941,15 @@ static struct ftrace_ops trace_ops __initdata = ...@@ -2941,15 +2941,15 @@ static struct ftrace_ops trace_ops __initdata =
static __init void event_trace_self_test_with_function(void) static __init void event_trace_self_test_with_function(void)
{ {
int ret; int ret;
event_tr = top_trace_array();
if (WARN_ON(!event_tr))
return;
ret = register_ftrace_function(&trace_ops); ret = register_ftrace_function(&trace_ops);
if (WARN_ON(ret < 0)) { if (WARN_ON(ret < 0)) {
pr_info("Failed to enable function tracer for event tests\n"); pr_info("Failed to enable function tracer for event tests\n");
return; return;
} }
pr_info("Running tests again, along with the function tracer\n"); pr_info("Running tests again, along with the function tracer\n");
event_tr = top_trace_array();
if (WARN_ON(!event_tr))
return;
event_trace_self_tests(); event_trace_self_tests();
unregister_ftrace_function(&trace_ops); unregister_ftrace_function(&trace_ops);
} }
......
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