# Re: \[PATCH v16 09/18\] tracing: Add ftrace\_fill\_perf\_regs() for perf event

- From: Masami Hiramatsu (Google) \<mhiramat@kernel.org\>
- Date: 2024-10-15 23:34:54 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2024/10/2784737
- Thread: https://ratatoskr.run/linux-trace-kernel/2024/10/2782798/t.md

```text
On Tue, 15 Oct 2024 20:18:02 +0200
Heiko Carstens [ref] wrote:

> On Tue, Oct 15, 2024 at 10:30:15AM +0900, Masami Hiramatsu (Google) wrote:
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > 
> > 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@kernel.org>
> > ---
> >   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@linux.ibm.com

Oops, sorry. And thanks for your feedback!



-- 
Masami Hiramatsu (Google) [ref]
```
