Re: [RFC patch 17/41] tracing: Make stack_trace_print() static and rename it

From: AKASHI Takahiro
Date: Wed Apr 10 2019 - 20:17:21 EST


On Wed, Apr 10, 2019 at 08:47:03AM -0400, Steven Rostedt wrote:
> On Wed, 10 Apr 2019 12:28:11 +0200
> Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> > It's only used in the source file where it is defined and it's using the
> > stack_trace_ namespace. Rename it to free it up for stack trace related
> > functions.
> >
>
> Can you put it back to its original name "print_max_stack()" which was
> changed by this commit:
>
> bb99d8ccec7 ("tracing: Allow arch-specific stack tracer")
>
> I actually want to do a clean up and remove all "trace_" functions that
> are not a tracepoint. It's getting confusing to see a "trace_..." and
> search for the corresponding TRACE_EVENT() macro and not being able to
> find it.
>
> Hmm, I'm not sure why Akashi changed that function to be global in the
> first place. It looks like only check_stack() needed to be changed.
>
> Akashi?

Well, as indicated in the commit log, I implemented arch64-specific
check_stack() and used stack_trace_print() in there. At the end of the day,
however, only the first part of my patch set[1], including 'bb99d8ccec7',
was merged. Since then the said function was never used outside of the file.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-December/393716.html

Thanks,
-Takahiro Akashi

> -- Steve
>
>
> > Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> > Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> > ---
> > include/linux/ftrace.h | 1 -
> > kernel/trace/trace_stack.c | 4 ++--
> > 2 files changed, 2 insertions(+), 3 deletions(-)
> >
> > --- a/include/linux/ftrace.h
> > +++ b/include/linux/ftrace.h
> > @@ -251,7 +251,6 @@ extern unsigned long stack_trace_max_siz
> > extern arch_spinlock_t stack_trace_max_lock;
> >
> > extern int stack_tracer_enabled;
> > -void stack_trace_print(void);
> > int
> > stack_trace_sysctl(struct ctl_table *table, int write,
> > void __user *buffer, size_t *lenp,
> > --- a/kernel/trace/trace_stack.c
> > +++ b/kernel/trace/trace_stack.c
> > @@ -41,7 +41,7 @@ static DEFINE_MUTEX(stack_sysctl_mutex);
> > int stack_tracer_enabled;
> > static int last_stack_tracer_enabled;
> >
> > -void stack_trace_print(void)
> > +static void trace_stack_trace_print(void)
> > {
> > long i;
> > int size;
> > @@ -179,7 +179,7 @@ check_stack(unsigned long ip, unsigned l
> > stack_trace_max.nr_entries = x;
> >
> > if (task_stack_end_corrupted(current)) {
> > - stack_trace_print();
> > + trace_stack_trace_print();
> > BUG();
> > }
> >
> >
>