tracing/core: Make the stack entry helpers global
Make the stacktrace event insertion helpers globals. This has two effects: - Prepare for moving the sched events insertion helpers to the sched switch tracer file. - Move some ifdef outside function definitions Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
@@ -866,10 +866,6 @@ struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
|
|||||||
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
static void ftrace_trace_stack(struct trace_array *tr,
|
|
||||||
unsigned long flags, int skip, int pc);
|
|
||||||
static void ftrace_trace_userstack(struct trace_array *tr,
|
|
||||||
unsigned long flags, int pc);
|
|
||||||
|
|
||||||
static inline void __trace_buffer_unlock_commit(struct trace_array *tr,
|
static inline void __trace_buffer_unlock_commit(struct trace_array *tr,
|
||||||
struct ring_buffer_event *event,
|
struct ring_buffer_event *event,
|
||||||
@@ -1003,11 +999,11 @@ ftrace(struct trace_array *tr, struct trace_array_cpu *data,
|
|||||||
trace_function(tr, ip, parent_ip, flags, pc);
|
trace_function(tr, ip, parent_ip, flags, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_STACKTRACE
|
||||||
static void __ftrace_trace_stack(struct trace_array *tr,
|
static void __ftrace_trace_stack(struct trace_array *tr,
|
||||||
unsigned long flags,
|
unsigned long flags,
|
||||||
int skip, int pc)
|
int skip, int pc)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_STACKTRACE
|
|
||||||
struct ftrace_event_call *call = &event_kernel_stack;
|
struct ftrace_event_call *call = &event_kernel_stack;
|
||||||
struct ring_buffer_event *event;
|
struct ring_buffer_event *event;
|
||||||
struct stack_entry *entry;
|
struct stack_entry *entry;
|
||||||
@@ -1028,12 +1024,10 @@ static void __ftrace_trace_stack(struct trace_array *tr,
|
|||||||
save_stack_trace(&trace);
|
save_stack_trace(&trace);
|
||||||
if (!filter_check_discard(call, entry, tr->buffer, event))
|
if (!filter_check_discard(call, entry, tr->buffer, event))
|
||||||
ring_buffer_unlock_commit(tr->buffer, event);
|
ring_buffer_unlock_commit(tr->buffer, event);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ftrace_trace_stack(struct trace_array *tr,
|
void ftrace_trace_stack(struct trace_array *tr, unsigned long flags, int skip,
|
||||||
unsigned long flags,
|
int pc)
|
||||||
int skip, int pc)
|
|
||||||
{
|
{
|
||||||
if (!(trace_flags & TRACE_ITER_STACKTRACE))
|
if (!(trace_flags & TRACE_ITER_STACKTRACE))
|
||||||
return;
|
return;
|
||||||
@@ -1041,17 +1035,14 @@ static void ftrace_trace_stack(struct trace_array *tr,
|
|||||||
__ftrace_trace_stack(tr, flags, skip, pc);
|
__ftrace_trace_stack(tr, flags, skip, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __trace_stack(struct trace_array *tr,
|
void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
|
||||||
unsigned long flags,
|
int pc)
|
||||||
int skip, int pc)
|
|
||||||
{
|
{
|
||||||
__ftrace_trace_stack(tr, flags, skip, pc);
|
__ftrace_trace_stack(tr, flags, skip, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ftrace_trace_userstack(struct trace_array *tr,
|
void ftrace_trace_userstack(struct trace_array *tr, unsigned long flags, int pc)
|
||||||
unsigned long flags, int pc)
|
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_STACKTRACE
|
|
||||||
struct ftrace_event_call *call = &event_user_stack;
|
struct ftrace_event_call *call = &event_user_stack;
|
||||||
struct ring_buffer_event *event;
|
struct ring_buffer_event *event;
|
||||||
struct userstack_entry *entry;
|
struct userstack_entry *entry;
|
||||||
@@ -1076,7 +1067,6 @@ static void ftrace_trace_userstack(struct trace_array *tr,
|
|||||||
save_stack_trace_user(&trace);
|
save_stack_trace_user(&trace);
|
||||||
if (!filter_check_discard(call, entry, tr->buffer, event))
|
if (!filter_check_discard(call, entry, tr->buffer, event))
|
||||||
ring_buffer_unlock_commit(tr->buffer, event);
|
ring_buffer_unlock_commit(tr->buffer, event);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef UNUSED
|
#ifdef UNUSED
|
||||||
@@ -1086,6 +1076,8 @@ static void __trace_userstack(struct trace_array *tr, unsigned long flags)
|
|||||||
}
|
}
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
|
|
||||||
|
#endif /* CONFIG_STACKTRACE */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ftrace_trace_special(void *__tr,
|
ftrace_trace_special(void *__tr,
|
||||||
unsigned long arg1, unsigned long arg2, unsigned long arg3,
|
unsigned long arg1, unsigned long arg2, unsigned long arg3,
|
||||||
|
@@ -489,10 +489,32 @@ void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu);
|
|||||||
void update_max_tr_single(struct trace_array *tr,
|
void update_max_tr_single(struct trace_array *tr,
|
||||||
struct task_struct *tsk, int cpu);
|
struct task_struct *tsk, int cpu);
|
||||||
|
|
||||||
void __trace_stack(struct trace_array *tr,
|
#ifdef CONFIG_STACKTRACE
|
||||||
unsigned long flags,
|
void ftrace_trace_stack(struct trace_array *tr, unsigned long flags,
|
||||||
int skip, int pc);
|
int skip, int pc);
|
||||||
|
|
||||||
|
void ftrace_trace_userstack(struct trace_array *tr, unsigned long flags,
|
||||||
|
int pc);
|
||||||
|
|
||||||
|
void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,
|
||||||
|
int pc);
|
||||||
|
#else
|
||||||
|
static inline void ftrace_trace_stack(struct trace_array *tr,
|
||||||
|
unsigned long flags, int skip, int pc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void ftrace_trace_userstack(struct trace_array *tr,
|
||||||
|
unsigned long flags, int pc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void __trace_stack(struct trace_array *tr, unsigned long flags,
|
||||||
|
int skip, int pc)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_STACKTRACE */
|
||||||
|
|
||||||
extern cycle_t ftrace_now(int cpu);
|
extern cycle_t ftrace_now(int cpu);
|
||||||
|
|
||||||
#ifdef CONFIG_CONTEXT_SWITCH_TRACER
|
#ifdef CONFIG_CONTEXT_SWITCH_TRACER
|
||||||
|
Reference in New Issue
Block a user