Skip to content

Commit b4bf274

Browse files
Mao Hanguoren83
authored andcommitted
csky: Add perf_arch_fetch_caller_regs support
In trace events as tracepoints context are not able to be retrieve with task_pt_regs. Without arch caller regs support the pt_regs context will be all zero, perf can not parsing the callchain and resolving the symbols correctly, some time will even get into deadlock while handling the page fault, eg: perf kmem —page record ls Changelog - Add test case cmd in comment - Use regs_fp(regs) which is defined in abi/regdef.h Signed-off-by: Mao Han <han_mao@c-sky.com> Signed-off-by: Guo Ren <guoren@kernel.org>
1 parent 981bbf2 commit b4bf274

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎arch/csky/abiv1/inc/abi/regdef.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#define syscallid r1
88
#define regs_syscallid(regs) regs->regs[9]
9+
#define regs_fp(regs) regs->regs[2]
910

1011
/*
1112
* PSR format:

‎arch/csky/abiv2/inc/abi/regdef.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#define syscallid r7
88
#define regs_syscallid(regs) regs->regs[3]
9+
#define regs_fp(regs) regs->regs[4]
910

1011
/*
1112
* PSR format:

‎arch/csky/include/asm/perf_event.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,12 @@
44
#ifndef __ASM_CSKY_PERF_EVENT_H
55
#define __ASM_CSKY_PERF_EVENT_H
66

7+
#include <abi/regdef.h>
8+
9+
#define perf_arch_fetch_caller_regs(regs, __ip) { \
10+
(regs)->pc = (__ip); \
11+
regs_fp(regs) = (unsigned long) __builtin_frame_address(0); \
12+
asm volatile("mov %0, sp\n":"=r"((regs)->usp)); \
13+
}
14+
715
#endif /* __ASM_PERF_EVENT_ELF_H */

0 commit comments

Comments
 (0)