Thread (29 messages) 29 messages, 3 authors, 2024-10-21

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
Also in: bpf, linux-arch, lkml

On Tue, 15 Oct 2024 20:18:02 +0200
Heiko Carstens [off-list ref] wrote:
On Tue, Oct 15, 2024 at 10:30:15AM +0900, Masami Hiramatsu (Google) wrote:
quoted
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 +++++
...
quoted
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 (local)
Oops, sorry. And thanks for your feedback!



-- 
Masami Hiramatsu (Google) [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help