On Sun, Sep 15, 2024 at 05:15:59AM -0400, Steven Rostedt wrote:
> 
> Can I get an Acked-by from the S390 maintainers for this patch?

...

> > +static __always_inline unsigned long
> > +ftrace_regs_get_frame_pointer(struct ftrace_regs *fregs)
> > +{
> > +   unsigned long *sp;
> > +
> > +   sp = (void *)ftrace_regs_get_stack_pointer(fregs);
> > +   return sp[0];   /* return backchain */
> > +}
> > +

...

> > diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S
> > index ae4d4fd9afcd..cda798b976de 100644
> > --- a/arch/s390/kernel/mcount.S
> > +++ b/arch/s390/kernel/mcount.S
> > @@ -133,14 +133,15 @@ SYM_CODE_END(ftrace_common)
> >  SYM_FUNC_START(return_to_handler)
> >     stmg    %r2,%r5,32(%r15)
> >     lgr     %r1,%r15
> > -   aghi    %r15,-(STACK_FRAME_OVERHEAD+__FGRAPH_RET_SIZE)
> > +# Allocate ftrace_regs + backchain on the stack
> > +   aghi    %r15,-STACK_FRAME_SIZE_FREGS
> >     stg     %r1,__SF_BACKCHAIN(%r15)
> >     la      %r3,STACK_FRAME_OVERHEAD(%r15)
> > -   stg     %r1,__FGRAPH_RET_FP(%r3)
> > -   stg     %r2,__FGRAPH_RET_GPR2(%r3)
> > +   stg     %r2,(__SF_GPRS+2*8)(%r15)
> > +   stg     %r15,(__SF_GPRS+15*8)(%r15)
> >     lgr     %r2,%r3
> >     brasl   %r14,ftrace_return_to_handler
> > -   aghi    %r15,STACK_FRAME_OVERHEAD+__FGRAPH_RET_SIZE
> > +   aghi    %r15,STACK_FRAME_SIZE_FREGS

This does not pass the ftrace selftests. Please merge the patch below
into this patch. With that:

Acked-by: Heiko Carstens <h...@linux.ibm.com>

diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
index 7b80ff4d3386..df5a0f8d3445 100644
--- a/arch/s390/include/asm/ftrace.h
+++ b/arch/s390/include/asm/ftrace.h
@@ -78,10 +78,7 @@ ftrace_regs_set_instruction_pointer(struct ftrace_regs 
*fregs,
 static __always_inline unsigned long
 ftrace_regs_get_frame_pointer(struct ftrace_regs *fregs)
 {
-       unsigned long *sp;
-
-       sp = (void *)ftrace_regs_get_stack_pointer(fregs);
-       return sp[0];   /* return backchain */
+       return ftrace_regs_get_stack_pointer(fregs);
 }
 
 static __always_inline unsigned long
diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S
index cda798b976de..10b08e617306 100644
--- a/arch/s390/kernel/mcount.S
+++ b/arch/s390/kernel/mcount.S
@@ -133,13 +133,12 @@ SYM_CODE_END(ftrace_common)
 SYM_FUNC_START(return_to_handler)
        stmg    %r2,%r5,32(%r15)
        lgr     %r1,%r15
-# Allocate ftrace_regs + backchain on the stack
+       # allocate ftrace_regs and stack frame for ftrace_return_to_handler
        aghi    %r15,-STACK_FRAME_SIZE_FREGS
        stg     %r1,__SF_BACKCHAIN(%r15)
-       la      %r3,STACK_FRAME_OVERHEAD(%r15)
-       stg     %r2,(__SF_GPRS+2*8)(%r15)
-       stg     %r15,(__SF_GPRS+15*8)(%r15)
-       lgr     %r2,%r3
+       stg     %r2,(STACK_FREGS_PTREGS_GPRS+2*8)(%r15)
+       stg     %r1,(STACK_FREGS_PTREGS_GPRS+15*8)(%r15)
+       la      %r2,STACK_FRAME_OVERHEAD(%r15)
        brasl   %r14,ftrace_return_to_handler
        aghi    %r15,STACK_FRAME_SIZE_FREGS
        lgr     %r14,%r2

Reply via email to