Skip to content

Commit d6af2c7

Browse files
committed
LoongArch: Fix callchain parse error with kernel tracepoint events again
With commit d3119bc ("LoongArch: Fix callchain parse error with kernel tracepoint events"), perf can parse kernel callchain, but not complete and sometimes maybe error. The reason is LoongArch's unwinders (guess, prologue and orc) don't really need fp (i.e., regs[22]), and they use sp (i.e., regs[3]) as the frame address rather than the current stack pointer. Fix that by removing the assignment of regs[22], and instead assign the __builtin_frame_address(0) to regs[3]. Without fix: Children Self Command Shared Object Symbol ........ ........ ............. ................. ................ 33.91% 33.91% swapper [kernel.vmlinux] [k] __schedule | |--33.04%--__schedule | --0.87%--__arch_cpu_idle __schedule With this fix: Children Self Command Shared Object Symbol ........ ........ ............. ................. ................ 31.16% 31.16% swapper [kernel.vmlinux] [k] __schedule | |--20.63%--smpboot_entry | cpu_startup_entry | schedule_idle | __schedule | --10.53%--start_kernel cpu_startup_entry schedule_idle __schedule Fixes: d3119bc ("LoongArch: Fix callchain parse error with kernel tracepoint events") Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 5685d7f commit d6af2c7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/loongarch/include/asm/perf_event.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
#define perf_arch_fetch_caller_regs(regs, __ip) { \
1515
(regs)->csr_era = (__ip); \
16-
(regs)->regs[3] = current_stack_pointer; \
17-
(regs)->regs[22] = (unsigned long) __builtin_frame_address(0); \
16+
(regs)->regs[3] = (unsigned long) __builtin_frame_address(0); \
1817
}
1918

2019
#endif /* __LOONGARCH_PERF_EVENT_H__ */

0 commit comments

Comments
 (0)