merged. Bruce
In message: [linux-yocto] [linux-yocto v5.10] [PATCH] tracing/arm: Have max stack tracer handle the case of return address after data on 13/05/2021 [email protected] wrote: > From: Zqiang <[email protected]> > > This change is similar to the following patch, > it also suitable for arm. > > [ > Author: Steven Rostedt (VMware) > Email: [email protected] > Subject: tracing/arm64: Have max stack tracer handle the case of return > address after data > Date: Fri, 9 Aug 2019 02:15:05 +0000 > > Most archs (well at least x86) store the function call return address on the > stack before storing the local variables for the function. The max stack > tracer depends on this in its algorithm to display the stack size of each > function it finds in the back trace. > > Some archs (arm64), may store the return address (from its link register) > just before calling a nested function. There's no reason to save the link > register on leaf functions, as it wont be updated. This breaks the algorithm > of the max stack tracer. > > Add a new define ARCH_FTRACE_SHIFT_STACK_TRACER that an architecture may set > if it stores the return address (link register) after it stores the > function's local variables, and have the stack trace shift the values of the > mapped stack size to the appropriate functions. > > Link: [email protected] > > Reported-by: Jiping Ma <[email protected]> > Acked-by: Will Deacon <[email protected]> > Signed-off-by: Steven Rostedt (VMware) <[email protected]> > Signed-off-by: Jiping Ma <[email protected]> > ] > > Signed-off-by: Zqiang <[email protected]> > --- > arch/arm/include/asm/ftrace.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h > index 48ec1d0337da..c70f8fb13ae3 100644 > --- a/arch/arm/include/asm/ftrace.h > +++ b/arch/arm/include/asm/ftrace.h > @@ -10,6 +10,19 @@ > #define MCOUNT_ADDR ((unsigned long)(__gnu_mcount_nc)) > #define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ > > +/* > + * Currently, gcc tends to save the link register after the local variables > + * on the stack. This causes the max stack tracer to report the function > + * frame sizes for the wrong functions. By defining > + * ARCH_FTRACE_SHIFT_STACK_TRACER, it will tell the stack tracer to expect > + * to find the return address on the stack after the local variables have > + * been set up. > + * > + * Note, this may change in the future, and we will need to deal with that > + * if it were to happen. > + */ > +#define ARCH_FTRACE_SHIFT_STACK_TRACER 1 > + > #ifndef __ASSEMBLY__ > extern void __gnu_mcount_nc(void); > > -- > 2.29.2
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#9876): https://lists.yoctoproject.org/g/linux-yocto/message/9876 Mute This Topic: https://lists.yoctoproject.org/mt/82792448/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
