[RFC 2/3] arm64: refactor save_stack_trace()

Steven Rostedt rostedt at goodmis.org
Thu Jul 16 20:21:28 PDT 2015


On Fri, 17 Jul 2015 11:49:52 +0900
AKASHI Takahiro <takahiro.akashi at linaro.org> wrote:

> > -
> > -	if (using_ftrace_ops_list_func())
> > -		max_stack_trace.skip = 4;
> > -	else
> > -		max_stack_trace.skip = 3;
> > +	max_stack_trace.skip = 3;
> 
> I don't think this last line is necessary because we will skip all
> the functions anyway below:

I put this back more as an optimization as it is already known that it
takes at least three calls to get to this point. Unless of course gcc
decides to inline them. But currently I don't see that.

> 
> >   	save_stack_trace(&max_stack_trace);
> >
> > -	/*
> > -	 * Add the passed in ip from the function tracer.
> > -	 * Searching for this on the stack will skip over
> > -	 * most of the overhead from the stack tracer itself.
> > -	 */
> > -	stack_dump_trace[0] = ip;
> > -	max_stack_trace.nr_entries++;
> > +	/* Skip over the overhead of the stack tracer itself */
> > +	for (i = 0; i < max_stack_trace.nr_entries; i++) {
> > +		if (stack_dump_trace[i] == ip)
> > +			break;
> > +	}
> 
> here. Now "i" indicates the start point, excepting tracer functions,
> and "x" will eventually represent the exact number of functions
> that we are interested in after searching the stack.
> 
> To calc "stack_max_size" correctly, we should change the line:
>      if (unlikely(tracer_frame) && i == 1) {
> to
>      if (unlikely(tracer_frame)) {

Good catch, I'll fix that!

-- Steve

> 
> With these two changes applied, the issues Jungseok mentioned will be
> fixed.
> 



More information about the linux-arm-kernel mailing list