* [RFC] Revert "perf/x86: Always store regs->ip in perf_callchain_kernel()"
@ 2025-09-29 12:51 Jiri Olsa
2025-09-30 22:53 ` Song Liu
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Olsa @ 2025-09-29 12:51 UTC (permalink / raw)
To: Song Liu, Masami Hiramatsu, Steven Rostedt, Peter Zijlstra
Cc: bpf, linux-perf-users, linux-trace-kernel, Yonghong Song,
Andrii Nakryiko
This reverts commit 83f44ae0f8afcc9da659799db8693f74847e66b3.
hi,
non hw events store first stack trace entry twice:
bpf_prog_2beb79c650d605dd_rawtracepoint_sched_process_exec_1+324
bpf_prog_2beb79c650d605dd_rawtracepoint_sched_process_exec_1+324
bpf_trace_run3+138
bprm_execve+1191
do_execveat_common.isra.0+404
__x64_sys_execve+56
do_syscall_64+130
entry_SYSCALL_64_after_hwframe+118
I traced it to [1] from 2019, which stores regs->ip implicitly to fix
raw tracepoints stacktrace. Revert does not seem to break raw tp
stacktrace for me. Song, any idea? I know it's long time ;-)
thanks,
jirka
[1] 83f44ae0f8af ("perf/x86: Always store regs->ip in perf_callchain_kernel()")
---
arch/x86/events/core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 7610f26dfbd9..38f7102e2dac 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -2787,13 +2787,13 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re
return;
}
- if (perf_callchain_store(entry, regs->ip))
- return;
-
- if (perf_hw_regs(regs))
+ if (perf_hw_regs(regs)) {
+ if (perf_callchain_store(entry, regs->ip))
+ return;
unwind_start(&state, current, regs, NULL);
- else
+ } else {
unwind_start(&state, current, NULL, (void *)regs->sp);
+ }
for (; !unwind_done(&state); unwind_next_frame(&state)) {
addr = unwind_get_return_address(&state);
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RFC] Revert "perf/x86: Always store regs->ip in perf_callchain_kernel()"
2025-09-29 12:51 [RFC] Revert "perf/x86: Always store regs->ip in perf_callchain_kernel()" Jiri Olsa
@ 2025-09-30 22:53 ` Song Liu
0 siblings, 0 replies; 2+ messages in thread
From: Song Liu @ 2025-09-30 22:53 UTC (permalink / raw)
To: Jiri Olsa
Cc: Song Liu, Masami Hiramatsu, Steven Rostedt, Peter Zijlstra, bpf,
linux-perf-users, linux-trace-kernel, Yonghong Song,
Andrii Nakryiko
On Tue, Sep 30, 2025 at 6:29 AM Jiri Olsa <jolsa@kernel.org> wrote:
>
> This reverts commit 83f44ae0f8afcc9da659799db8693f74847e66b3.
>
> hi,
> non hw events store first stack trace entry twice:
>
> bpf_prog_2beb79c650d605dd_rawtracepoint_sched_process_exec_1+324
> bpf_prog_2beb79c650d605dd_rawtracepoint_sched_process_exec_1+324
> bpf_trace_run3+138
> bprm_execve+1191
> do_execveat_common.isra.0+404
> __x64_sys_execve+56
> do_syscall_64+130
> entry_SYSCALL_64_after_hwframe+118
>
> I traced it to [1] from 2019, which stores regs->ip implicitly to fix
> raw tracepoints stacktrace. Revert does not seem to break raw tp
> stacktrace for me. Song, any idea? I know it's long time ;-)
I cannot recall the original issue.
I tried the revert with multiple different tests. Everything seems to
work fine. I guess we can ship this revert.
Thanks for the fix!
Song
Acked-by: Song Liu <song@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-30 22:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29 12:51 [RFC] Revert "perf/x86: Always store regs->ip in perf_callchain_kernel()" Jiri Olsa
2025-09-30 22:53 ` Song Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).