Skip to contentSkip to conversation

perf jitdump: Add riscv64 support

PATCH Applied Eric Lin 2 participants 3 messages Apr 11, 2022

Subsystems (2)
lore
Share & tools
lore

Eric Lin

author
#0 lore raw

v2 cover perf jitdump: Add riscv64 support

This patch enable perf jitdump for riscv64 and it tested with V8 on qemu rv64.

Qemu rv64:

$ perf record -e cpu-clock -c 1000 -g -k mono ./d8_rv64 --perf-prof --no-write-protect-code-memory test.js
$ perf inject -j -i perf.data -o perf.data.jitted
$ perf report -i perf.data.jitted

Output:
To display the perf.data header info, please use --header/--header-only options.

Total Lost Samples: 0

Samples: 87K of event 'cpu-clock'
Event count (approx.): 87974000

Children Self Command Shared Object Symbol

....

     0.28%     0.06%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal6WasmJs7InstallEPNS0_7IsolateEb
     0.28%     0.00%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal10ParserBaseINS0_6ParserEE22ParseLogicalExpressionEv
     0.28%     0.03%  d8_rv64          jitted-112-76.so             [.] Builtin:
InterpreterEntryTrampoline
     0.12%     0.00%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal19ContextDeserializer11DeserializeEPNS0_7IsolateENS0_6HandleINS0_13JSGlob
alProxyEEENS_33DeserializeInternalFieldsCallbackE
     0.12%     0.01%  d8_rv64          jitted-112-651.so            [.] Builtin:

CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit
....

Changed in v2:
- Rebase on tag v5.18-rc2
- Show perf jitdump commands and dump in the commit message.

Eric Lin (1):
perf jitdump: Add riscv64 support.

 tools/perf/arch/riscv/Makefile | 1 +
 tools/perf/util/genelf.h       | 3 +++
 2 files changed, 4 insertions(+)
Signature · 1 line
2.35.1
author
#1 lore raw

PATCH v2 1/1 perf jitdump: Add riscv64 support.

This patch enable perf jitdump for riscv64 and it tested with V8 on qemu rv64.

Qemu rv64:

$ perf record -e cpu-clock -c 1000 -g -k mono ./d8_rv64 --perf-prof --no-write-protect-code-memory test.js
$ perf inject -j -i perf.data -o perf.data.jitted
$ perf report -i perf.data.jitted

Output:
To display the perf.data header info, please use --header/--header-only options.

Total Lost Samples: 0

Samples: 87K of event 'cpu-clock'
Event count (approx.): 87974000

Children Self Command Shared Object Symbol

....

     0.28%     0.06%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal6WasmJs7InstallEPNS0_7IsolateEb
     0.28%     0.00%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal10ParserBaseINS0_6ParserEE22ParseLogicalExpressionEv
     0.28%     0.03%  d8_rv64          jitted-112-76.so             [.] Builtin:
InterpreterEntryTrampoline
     0.12%     0.00%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal19ContextDeserializer11DeserializeEPNS0_7IsolateENS0_6HandleINS0_13JSGlob
alProxyEEENS_33DeserializeInternalFieldsCallbackE
     0.12%     0.01%  d8_rv64          jitted-112-651.so            [.] Builtin:

CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit
....

---
 tools/perf/arch/riscv/Makefile | 1 +
 tools/perf/util/genelf.h       | 3 +++
 2 files changed, 4 insertions(+)
tools/perf/arch/riscv/Makefile +1 -0
index 1aa9dd772489..a8d25d005207 100644
@@ -2,3 +2,4 @@ ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
 PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
+PERF_HAVE_JITDUMP := 1
tools/perf/util/genelf.h +3 -0
index 3db3293213a9..ae138afe6c56 100644
@@ -38,6 +38,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
 #elif defined(__s390x__)
 #define GEN_ELF_ARCH	EM_S390
 #define GEN_ELF_CLASS	ELFCLASS64
+#elif defined(__riscv) && __riscv_xlen == 64
+#define GEN_ELF_ARCH	EM_RISCV
+#define GEN_ELF_CLASS	ELFCLASS64
 #else
 #error "unsupported architecture"
 #endif
Signature · 1 line
2.35.1
maintainer Applied
#2 lore raw

Re: [PATCH v2 1/1] perf jitdump: Add riscv64 support.

Em Mon, Apr 11, 2022 at 06:54:38PM +0800, Eric Lin escreveu:

Quoted 6 lines

This patch enable perf jitdump for riscv64 and it tested with V8 on qemu rv64.

Qemu rv64:

$ perf record -e cpu-clock -c 1000 -g -k mono ./d8_rv64 --perf-prof --no-write-protect-code-memory test.js
$ perf inject -j -i perf.data -o perf.data.jitted
$ perf report -i perf.data.jitted

Thanks, applied.

- Arnaldo

Quoted 55 lines

Output:
To display the perf.data header info, please use --header/--header-only options.

Total Lost Samples: 0

Samples: 87K of event 'cpu-clock'
Event count (approx.): 87974000

Children Self Command Shared Object Symbol

....

     0.28%     0.06%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal6WasmJs7InstallEPNS0_7IsolateEb
     0.28%     0.00%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal10ParserBaseINS0_6ParserEE22ParseLogicalExpressionEv
     0.28%     0.03%  d8_rv64          jitted-112-76.so             [.] Builtin:
InterpreterEntryTrampoline
     0.12%     0.00%  d8_rv64          d8_rv64                      [.] _ZN2v88i
nternal19ContextDeserializer11DeserializeEPNS0_7IsolateENS0_6HandleINS0_13JSGlob
alProxyEEENS_33DeserializeInternalFieldsCallbackE
     0.12%     0.01%  d8_rv64          jitted-112-651.so            [.] Builtin:

CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit
....

---
 tools/perf/arch/riscv/Makefile | 1 +
 tools/perf/util/genelf.h       | 3 +++
 2 files changed, 4 insertions(+)
tools/perf/arch/riscv/Makefile +1 -0
index 1aa9dd772489..a8d25d005207 100644
@@ -2,3 +2,4 @@ ifndef NO_DWARF
 PERF_HAVE_DWARF_REGS := 1
 endif
 PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET := 1
+PERF_HAVE_JITDUMP := 1
tools/perf/util/genelf.h +3 -0
index 3db3293213a9..ae138afe6c56 100644
@@ -38,6 +38,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
 #elif defined(__s390x__)
 #define GEN_ELF_ARCH	EM_S390
 #define GEN_ELF_CLASS	ELFCLASS64
+#elif defined(__riscv) && __riscv_xlen == 64
+#define GEN_ELF_ARCH	EM_RISCV
+#define GEN_ELF_CLASS	ELFCLASS64
 #else
 #error "unsupported architecture"
 #endif
Signature · 1 line
2.35.1
Signature · 1 line
- Arnaldo