[PATCH v2 11/11] perf/x86: Enable SFrame unwinding for deferred user callchains
From: Josh Poimboeuf
Date: Fri Sep 13 2024 - 19:05:37 EST
Use SFrame for deferred user callchains, if available.
Non-deferred user callchains still need to use frame pointers, as SFrame
is likely to fault when it pages in the .sframe section.
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
arch/x86/events/core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index d6ea265d9aa8..d618c50865d3 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -2861,6 +2861,7 @@ static int __perf_callchain_user32(struct pt_regs *regs,
static void __perf_callchain_user(struct perf_callchain_entry_ctx *entry,
struct pt_regs *regs, bool atomic)
{
+ bool unwind_type = USER_UNWIND_TYPE_AUTO;
struct user_unwind_state state;
if (perf_guest_state()) {
@@ -2879,13 +2880,14 @@ static void __perf_callchain_user(struct perf_callchain_entry_ctx *entry,
if (atomic) {
if (!nmi_uaccess_okay())
return;
+ unwind_type = USER_UNWIND_TYPE_FP;
pagefault_disable();
}
if (__perf_callchain_user32(regs, entry))
goto done;
- for_each_user_frame(&state, USER_UNWIND_TYPE_FP) {
+ for_each_user_frame(&state, unwind_type) {
if (perf_callchain_store(entry, state.ip))
goto done;
}
--
2.46.0