[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241021170121.GA26122@willie-the-truck>
Date: Mon, 21 Oct 2024 18:01:21 +0100
From: Will Deacon <will@...nel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Florent Revest <revest@...omium.org>,
linux-trace-kernel@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Alan Maguire <alan.maguire@...cle.com>,
Mark Rutland <mark.rutland@....com>, linux-arch@...r.kernel.org,
Catalin Marinas <catalin.marinas@....com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Naveen N Rao <naveen@...nel.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v17 07/16] tracing: Add ftrace_fill_perf_regs() for perf
event
On Wed, Oct 16, 2024 at 09:59:12AM +0900, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@...nel.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@...nel.org>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Catalin Marinas <catalin.marinas@....com>
> Cc: Will Deacon <will@...nel.org>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Nicholas Piggin <npiggin@...il.com>
> Cc: Christophe Leroy <christophe.leroy@...roup.eu>
> Cc: Naveen N Rao <naveen@...nel.org>
> Cc: Madhavan Srinivasan <maddy@...ux.ibm.com>
> Cc: Heiko Carstens <hca@...ux.ibm.com>
> Cc: Vasily Gorbik <gor@...ux.ibm.com>
> Cc: Alexander Gordeev <agordeev@...ux.ibm.com>
> Cc: Christian Borntraeger <borntraeger@...ux.ibm.com>
> Cc: Sven Schnelle <svens@...ux.ibm.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Borislav Petkov <bp@...en8.de>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: x86@...nel.org
> Cc: "H. Peter Anvin" <hpa@...or.com>
>
> ---
> Changes in v16:
> - Fix s390 to clear psw.mask according to Heiko's suggestion.
> ---
> arch/arm64/include/asm/ftrace.h | 7 +++++++
> arch/powerpc/include/asm/ftrace.h | 7 +++++++
> arch/s390/include/asm/ftrace.h | 6 ++++++
> arch/x86/include/asm/ftrace.h | 7 +++++++
> include/linux/ftrace.h | 31 +++++++++++++++++++++++++++++++
> 5 files changed, 58 insertions(+)
>
> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
> index d344c69eb01e..6493a575664f 100644
> --- a/arch/arm64/include/asm/ftrace.h
> +++ b/arch/arm64/include/asm/ftrace.h
> @@ -146,6 +146,13 @@ ftrace_partial_regs(const struct ftrace_regs *fregs, struct pt_regs *regs)
> return regs;
> }
>
> +#define arch_ftrace_fill_perf_regs(fregs, _regs) do { \
> + (_regs)->pc = arch_ftrace_regs(fregs)->pc; \
> + (_regs)->regs[29] = arch_ftrace_regs(fregs)->fp; \
> + (_regs)->sp = arch_ftrace_regs(fregs)->sp; \
> + (_regs)->pstate = PSR_MODE_EL1h; \
> + } while (0)
arm64 bit looks correct to me:
Acked-by: Will Deacon <will@...nel.org>
Will
Powered by blists - more mailing lists