Skip to content

riscv: Add perf callchain support

Mao Han linux-csky linux-riscv lkml 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest2 patches 2 repliesIn review
  2. v63 patches 7 repliesSuperseded
  3. v53 patches 4 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v43 patches2 repliesSuperseded
v33 patches5 repliesSuperseded
v23 patches0 repliesSuperseded
v13 patches10 repliesSuperseded

Changes in v7 from the cover letter

- add "WITH Linux-syscall-note" for uapi headers.

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2riscv: Add support for perf registers samplingarch/riscv/Kconfig arch/riscv/include/uapi/asm/perf_regs.h arch/riscv/kernel/Makefile +1 more+89 -01 reply
2/2riscv: Add support for libdwtools/arch/riscv/include/uapi/asm/perf_regs.h tools/perf/Makefile.config tools/perf/arch/riscv/Build +5 more+279 -11 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v7 yet.

Read the v7 thread

Cover letter [PATCH V7 0/2] riscv: Add perf callchain support

This patchset adds perf callchain(FP/DWARF) support for RISC-V. It comes from the csky version callchain support with some slight modifications. The patchset base on Linux 5.3-rc6.

The patchset has some 'checkpatch.pl --strict' warnings:
WARNING: Use #include <linux/perf_regs.h> instead of <asm/perf_regs.h> #141: FILE: tools/perf/arch/riscv/include/perf_regs.h:9:
+#include <asm/perf_regs.h>

CHECK: Avoid CamelCase: <Dwfl_Thread>
#329: FILE: tools/perf/arch/riscv/util/unwind-libdw.c:9:
+bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg)

CHECK: Avoid CamelCase: <Dwarf_Word>
#333: FILE: tools/perf/arch/riscv/util/unwind-libdw.c:13:
+ Dwarf_Word dwarf_regs[32];
As all the other Linux architectures use asm/perf_regs.h directly and get these camelcases, I didn't try to fix them.

Changes since v6:
- add "WITH Linux-syscall-note" for uapi headers.

Changes since v5:
- use walk_stackframe from stacktrace.c to handle kernel callchain unwinding(fix invalid mem access)

Changes since v4:
- Add missing PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET verified with extra CFLAGS(-Wall -Werror)

Changes since v3:
- Add more strict check for unwind_frame_kernel
- update for kernel 5.3

Changes since v2:
- fix inconsistent comment
- force to build kernel with -fno-omit-frame-pointer if perf event is enabled

Changes since v1:
- simplify implementation and code convention

Cc Paul Walmsley <[email protected]>
Cc Greentime Hu <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc linux-riscv <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Guo Ren <[email protected]>

Mao Han (2):
riscv: Add support for perf registers sampling
riscv: Add support for libdw

 arch/riscv/Kconfig                            |  2 +
 arch/riscv/include/uapi/asm/perf_regs.h       | 42 ++++++++++++
 arch/riscv/kernel/Makefile                    |  1 +
 arch/riscv/kernel/perf_regs.c                 | 44 ++++++++++++
 tools/arch/riscv/include/uapi/asm/perf_regs.h | 42 ++++++++++++
 tools/perf/Makefile.config                    |  6 +-
 tools/perf/arch/riscv/Build                   |  1 +
 tools/perf/arch/riscv/Makefile                |  4 ++
 tools/perf/arch/riscv/include/perf_regs.h     | 96 +++++++++++++++++++++++++++
 tools/perf/arch/riscv/util/Build              |  2 +
 tools/perf/arch/riscv/util/dwarf-regs.c       | 72 ++++++++++++++++++++
 tools/perf/arch/riscv/util/unwind-libdw.c     | 57 ++++++++++++++++
 12 files changed, 368 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/include/uapi/asm/perf_regs.h
 create mode 100644 arch/riscv/kernel/perf_regs.c
 create mode 100644 tools/arch/riscv/include/uapi/asm/perf_regs.h
 create mode 100644 tools/perf/arch/riscv/Build
 create mode 100644 tools/perf/arch/riscv/Makefile
 create mode 100644 tools/perf/arch/riscv/include/perf_regs.h
 create mode 100644 tools/perf/arch/riscv/util/Build
 create mode 100644 tools/perf/arch/riscv/util/dwarf-regs.c
 create mode 100644 tools/perf/arch/riscv/util/unwind-libdw.c
Signature · 1 line
2.7.4