Re: [PATCH v16 09/18] tracing: Add ftrace_fill_perf_regs() for perf event

From: Heiko Carstens
Date: Tue Oct 15 2024 - 14:19:03 EST


On Tue, Oct 15, 2024 at 10:30:15AM +0900, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
>
> Add ftrace_fill_perf_regs() which should be compatible with the
> perf_fetch_caller_regs(). In other words, the pt_regs returned from the
> ftrace_fill_perf_regs() must satisfy 'user_mode(regs) == false' and can be
> used for stack tracing.
>
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> ---
> Changes from previous series: NOTHING, just forward ported.
> ---
> arch/s390/include/asm/ftrace.h | 5 +++++

...

> diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
> index 5c94c1fc1bc1..f1c0e677a325 100644
> --- a/arch/s390/include/asm/ftrace.h
> +++ b/arch/s390/include/asm/ftrace.h
> @@ -76,6 +76,11 @@ ftrace_regs_get_frame_pointer(struct ftrace_regs *fregs)
> return ftrace_regs_get_stack_pointer(fregs);
> }
>
> +#define arch_ftrace_fill_perf_regs(fregs, _regs) do { \
> + (_regs)->psw.addr = arch_ftrace_regs(fregs)->regs.psw.addr; \
> + (_regs)->gprs[15] = arch_ftrace_regs(fregs)->regs.gprs[15]; \
> + } while (0)
> +

This misses the feedback I gave for v15:
https://lore.kernel.org/all/20241009100502.8007-E-hca@xxxxxxxxxxxxx