Re: [PATCH v16 04/18] function_graph: Replace fgraph_ret_regs with ftrace_regs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 15, 2024 at 10:29:17AM +0900, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> 
> Use ftrace_regs instead of fgraph_ret_regs for tracing return value
> on function_graph tracer because of simplifying the callback interface.
> 
> The CONFIG_HAVE_FUNCTION_GRAPH_RETVAL is also replaced by
> CONFIG_HAVE_FUNCTION_GRAPH_FREGS.
> 
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>

...

> diff --git a/arch/s390/kernel/mcount.S b/arch/s390/kernel/mcount.S
> index 7e267ef63a7f..a9ca56ea0858 100644
> --- a/arch/s390/kernel/mcount.S
> +++ b/arch/s390/kernel/mcount.S
> @@ -134,14 +134,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)
> +	aghi	%r15,-(STACK_FRAME_OVERHEAD+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)
> -	lgr	%r2,%r3
> +	la	%r4,STACK_FRAME_OVERHEAD(%r15)
> +	stg	%r2,__PT_R2(%r4)
> +	stg	%r3,__PT_R3(%r4)
> +	stg	%r1,__PT_R15(%r4)
> +	lgr	%r2,%r4
>  	brasl	%r14,ftrace_return_to_handler
> -	aghi	%r15,STACK_FRAME_OVERHEAD+__FGRAPH_RET_SIZE
> +	aghi	%r15,STACK_FRAME_SIZE_FREGS
>  	lgr	%r14,%r2
>  	lmg	%r2,%r5,32(%r15)
>  	BR_EX	%r14

Why didn't you simply merge the addon patch which I provided, and
which I tested?
https://lore.kernel.org/all/20240916121656.20933-B-hca@xxxxxxxxxxxxx

That would make things much simpler... e.g. your new patch is also
writing r3 to fregs, why? The stackframe allocation is also wrong.
I didn't try, but I guess the above code would crash instantly.




[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux