Message ID | 20190418084255.088813838@linutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | stacktrace: Consolidate stack trace usage | expand |
On Thu, 18 Apr 2019 10:41:41 +0200 Thomas Gleixner <tglx@linutronix.de> wrote: > It's only used in trace.c and there is absolutely no point in compiling it > in when user space stack traces are not supported. > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > Cc: Steven Rostedt <rostedt@goodmis.org> Funny, these were moved out to global functions along with the ftrace_trace_stack() but I guess they were never used. This basically just does a partial revert of: c0a0d0d3f6528 ("tracing/core: Make the stack entry helpers global") > --- > kernel/trace/trace.c | 14 ++++++++------ > kernel/trace/trace.h | 8 -------- > 2 files changed, 8 insertions(+), 14 deletions(-) > > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c > @@ -159,6 +159,8 @@ static union trace_eval_map_item *trace_ > #endif /* CONFIG_TRACE_EVAL_MAP_FILE */ > > static int tracing_set_tracer(struct trace_array *tr, const char *buf); > +static void ftrace_trace_userstack(struct ring_buffer *buffer, > + unsigned long flags, int pc); > > #define MAX_TRACER_SIZE 100 > static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata; > @@ -2905,9 +2907,10 @@ void trace_dump_stack(int skip) > } > EXPORT_SYMBOL_GPL(trace_dump_stack); > > +#ifdef CONFIG_USER_STACKTRACE_SUPPORT > static DEFINE_PER_CPU(int, user_stack_count); > > -void > +static void > ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) > { > struct trace_event_call *call = &event_user_stack; > @@ -2958,13 +2961,12 @@ ftrace_trace_userstack(struct ring_buffe > out: > preempt_enable(); > } > - > -#ifdef UNUSED Strange, I never knew about this ifdef. I would have nuked it when I saw it. Anyway, Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org> -- Steve > -static void __trace_userstack(struct trace_array *tr, unsigned long flags) > +#else /* CONFIG_USER_STACKTRACE_SUPPORT */ > +static void ftrace_trace_userstack(struct ring_buffer *buffer, > + unsigned long flags, int pc) > { > - ftrace_trace_userstack(tr, flags, preempt_count()); > } > -#endif /* UNUSED */ > +#endif /* !CONFIG_USER_STACKTRACE_SUPPORT */ > > #endif /* CONFIG_STACKTRACE */ > > --- a/kernel/trace/trace.h > +++ b/kernel/trace/trace.h > @@ -782,17 +782,9 @@ void update_max_tr_single(struct trace_a > #endif /* CONFIG_TRACER_MAX_TRACE */ > > #ifdef CONFIG_STACKTRACE > -void ftrace_trace_userstack(struct ring_buffer *buffer, 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_userstack(struct ring_buffer *buffer, > - unsigned long flags, int pc) > -{ > -} > - > static inline void __trace_stack(struct trace_array *tr, unsigned long flags, > int skip, int pc) > { >
--- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -159,6 +159,8 @@ static union trace_eval_map_item *trace_ #endif /* CONFIG_TRACE_EVAL_MAP_FILE */ static int tracing_set_tracer(struct trace_array *tr, const char *buf); +static void ftrace_trace_userstack(struct ring_buffer *buffer, + unsigned long flags, int pc); #define MAX_TRACER_SIZE 100 static char bootup_tracer_buf[MAX_TRACER_SIZE] __initdata; @@ -2905,9 +2907,10 @@ void trace_dump_stack(int skip) } EXPORT_SYMBOL_GPL(trace_dump_stack); +#ifdef CONFIG_USER_STACKTRACE_SUPPORT static DEFINE_PER_CPU(int, user_stack_count); -void +static void ftrace_trace_userstack(struct ring_buffer *buffer, unsigned long flags, int pc) { struct trace_event_call *call = &event_user_stack; @@ -2958,13 +2961,12 @@ ftrace_trace_userstack(struct ring_buffe out: preempt_enable(); } - -#ifdef UNUSED -static void __trace_userstack(struct trace_array *tr, unsigned long flags) +#else /* CONFIG_USER_STACKTRACE_SUPPORT */ +static void ftrace_trace_userstack(struct ring_buffer *buffer, + unsigned long flags, int pc) { - ftrace_trace_userstack(tr, flags, preempt_count()); } -#endif /* UNUSED */ +#endif /* !CONFIG_USER_STACKTRACE_SUPPORT */ #endif /* CONFIG_STACKTRACE */ --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -782,17 +782,9 @@ void update_max_tr_single(struct trace_a #endif /* CONFIG_TRACER_MAX_TRACE */ #ifdef CONFIG_STACKTRACE -void ftrace_trace_userstack(struct ring_buffer *buffer, 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_userstack(struct ring_buffer *buffer, - unsigned long flags, int pc) -{ -} - static inline void __trace_stack(struct trace_array *tr, unsigned long flags, int skip, int pc) {
It's only used in trace.c and there is absolutely no point in compiling it in when user space stack traces are not supported. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Steven Rostedt <rostedt@goodmis.org> --- kernel/trace/trace.c | 14 ++++++++------ kernel/trace/trace.h | 8 -------- 2 files changed, 8 insertions(+), 14 deletions(-)