Skip to content

perf: Support multiple system call tables in the build

Ian Rogers linux-arm-kernel linux-csky linux-perf-users linux-riscv lkml 7 versions – Applied

Status from this message: Applied to perf-tools-next, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest14 patches 2 repliesApplied
  2. v613 patches 1 replySuperseded
  3. v511 patches 15 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v411 patches6 repliesSuperseded
v38 patches10 repliesSuperseded
v27 patches18 repliesSuperseded
v17 patches18 repliesSuperseded

Patches in v7 Applied

#Subject and filesSizeRepliesApplied
1/14perf dso: Move libunwind dso_data variables into ifdeftools/perf/util/dso.h+2 -00 replies
2/14perf dso: kernel-doc for enum dso_binary_typetools/perf/util/dso.h+57 -00 replies
3/14perf syscalltbl: Remove syscall_table.htools/perf/arch/alpha/include/syscall_table.h tools/perf/arch/arc/include/syscall_table.h tools/perf/arch/arm/include/syscall_table.h +13 more+7 -670 replies
4/14perf trace: Reorganize syscallstools/perf/builtin-trace.c+132 -650 replies
5/14perf syscalltbl: Remove struct syscalltbltools/perf/builtin-trace.c tools/perf/scripts/syscalltbl.sh tools/perf/util/syscalltbl.c +1 more+117 -1600 replies
6/14perf dso: Add support for reading the e_machine type for a dsotools/perf/util/dso.c tools/perf/util/dso.h tools/perf/util/symbol-elf.c+92 -270 replies
7/14perf thread: Add support for reading the e_machine type for a threadtools/perf/builtin-trace.c tools/perf/util/thread.c tools/perf/util/thread.h+115 -220 replies
8/14perf trace beauty: Add syscalltbl.sh generating all system call tablestools/perf/Makefile.perf tools/perf/trace/beauty/syscalltbl.sh+283 -00 replies
9/14perf syscalltbl: Use lookup table containing multiple architecturestools/perf/util/syscalltbl.c+64 -250 replies
10/14perf build: Remove Makefile.syscallstools/perf/Makefile.perf tools/perf/arch/alpha/entry/syscalls/Kbuild tools/perf/arch/alpha/entry/syscalls/Makefile.syscalls +30 more+0 -2420 replies
11/14perf syscalltbl: Mask off ABI type for MIPS system callstools/perf/util/syscalltbl.c+8 -00 replies
12/14perf trace: Make syscall table stabletools/perf/builtin-trace.c+53 -340 replies
13/14perf trace: Fix BTF memory leaktools/perf/builtin-trace.c+4 -00 replies
14/14perf trace: Fix evlist memory leaktools/perf/builtin-trace.c+6 -20 replies

Reviews trailers per patch

8 of 14 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchArnaldo Carvalho de MeloHoward ChuCharlie JenkinsNamhyung Kim
SeriesR-b
1/14R-b
2/14A-b
3/14R-b R-b
4/14R-b R-b
5/14R-b R-b
6/14
7/14
8/14R-b R-b
9/14R-b R-b
10/14R-b R-b
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v7 thread

Cover letter [PATCH v7 00/14] perf: Support multiple system call tables in the build

This work builds on the clean up of system call tables and removal of libaudit by Charlie Jenkins <[email protected]>.

The system call table in perf trace is used to map system call numbers to names and vice versa. Prior to these changes, a single table matching the perf binary's build was present. The table would be incorrect if tracing say a 32-bit binary from a 64-bit version of perf, the names and numbers wouldn't match.

Change the build so that a single system call file is built and the potentially multiple tables are identifiable from the ELF machine type of the process being examined. To determine the ELF machine type, the executable's maps are searched and the associated DSOs ELF headers are read. When this fails and when live, /proc/pid/exe's ELF header is read. Fallback to using the perf's binary type when unknown.

Remove some runtime types used by the system call tables and make equivalents generated at build time.

v7: Rebase for dso data locking changes. Don't NULL check before
btf__free (Arnaldo). Add patch to clean up perf trace's evlist to make leak sanitizer happier.

v6: Incorporate Namhyung's fixes:
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
Which highlighted an issue with syscall pointers becoming stale. Add a patch 12 to make the syscall table a table of pointers that don't move so that struct syscalls don't move. Add a patch 13 fixing a BTF memory leak.

v5: Add byte swap to dso__e_machine and fix comment as suggested by
Namhyung.

v4: Add reading the e_machine from the thread's maps dsos, only read
from /proc/pid/exe on failure and when live as requested by Namhyung. Add patches to add dso comments and remove unused dso_data variables that are unused without libunwind.

v3: Add Charlie's reviewed-by tags. Incorporate feedback from Arnd
Bergmann <[email protected]> on additional optional column and MIPS system call numbering. Rebase past Namhyung's global system call statistics and add comments that they don't yet support an e_machine other than EM_HOST.

v2: Change the 1 element cache for the last table as suggested by
Howard Chu, add Howard's reviewed-by tags.
Add a comment and apology to Charlie for not doing better in guiding:
https://lore.kernel.org/all/20250114-perf_syscall_arch_runtime-v1-1-5b304e408e11@rivosinc.com/
After discussion on v1 and he agreed this patch series would be the better direction.

Ian Rogers (14):
perf dso: Move libunwind dso_data variables into ifdef perf dso: kernel-doc for enum dso_binary_type
perf syscalltbl: Remove syscall_table.h
perf trace: Reorganize syscalls
perf syscalltbl: Remove struct syscalltbl
perf dso: Add support for reading the e_machine type for a dso perf thread: Add support for reading the e_machine type for a thread perf trace beauty: Add syscalltbl.sh generating all system call tables perf syscalltbl: Use lookup table containing multiple architectures perf build: Remove Makefile.syscalls
perf syscalltbl: Mask off ABI type for MIPS system calls perf trace: Make syscall table stable
perf trace: Fix BTF memory leak
perf trace: Fix evlist memory leak

 tools/perf/Makefile.perf                      |  10 +-
 tools/perf/arch/alpha/entry/syscalls/Kbuild   |   2 -
 .../alpha/entry/syscalls/Makefile.syscalls    |   5 -
 tools/perf/arch/alpha/include/syscall_table.h |   2 -
 tools/perf/arch/arc/entry/syscalls/Kbuild     |   2 -
 .../arch/arc/entry/syscalls/Makefile.syscalls |   3 -
 tools/perf/arch/arc/include/syscall_table.h   |   2 -
 tools/perf/arch/arm/entry/syscalls/Kbuild     |   4 -
 .../arch/arm/entry/syscalls/Makefile.syscalls |   2 -
 tools/perf/arch/arm/include/syscall_table.h   |   2 -
 tools/perf/arch/arm64/entry/syscalls/Kbuild   |   3 -
 .../arm64/entry/syscalls/Makefile.syscalls    |   6 -
 tools/perf/arch/arm64/include/syscall_table.h |   8 -
 tools/perf/arch/csky/entry/syscalls/Kbuild    |   2 -
 .../csky/entry/syscalls/Makefile.syscalls     |   3 -
 tools/perf/arch/csky/include/syscall_table.h  |   2 -
 .../perf/arch/loongarch/entry/syscalls/Kbuild |   2 -
 .../entry/syscalls/Makefile.syscalls          |   3 -
 .../arch/loongarch/include/syscall_table.h    |   2 -
 tools/perf/arch/mips/entry/syscalls/Kbuild    |   2 -
 .../mips/entry/syscalls/Makefile.syscalls     |   5 -
 tools/perf/arch/mips/include/syscall_table.h  |   2 -
 tools/perf/arch/parisc/entry/syscalls/Kbuild  |   3 -
 .../parisc/entry/syscalls/Makefile.syscalls   |   6 -
 .../perf/arch/parisc/include/syscall_table.h  |   8 -
 tools/perf/arch/powerpc/entry/syscalls/Kbuild |   3 -
 .../powerpc/entry/syscalls/Makefile.syscalls  |   6 -
 .../perf/arch/powerpc/include/syscall_table.h |   8 -
 tools/perf/arch/riscv/entry/syscalls/Kbuild   |   2 -
 .../riscv/entry/syscalls/Makefile.syscalls    |   4 -
 tools/perf/arch/riscv/include/syscall_table.h |   8 -
 tools/perf/arch/s390/entry/syscalls/Kbuild    |   2 -
 .../s390/entry/syscalls/Makefile.syscalls     |   5 -
 tools/perf/arch/s390/include/syscall_table.h  |   2 -
 tools/perf/arch/sh/entry/syscalls/Kbuild      |   2 -
 .../arch/sh/entry/syscalls/Makefile.syscalls  |   4 -
 tools/perf/arch/sh/include/syscall_table.h    |   2 -
 tools/perf/arch/sparc/entry/syscalls/Kbuild   |   3 -
 .../sparc/entry/syscalls/Makefile.syscalls    |   5 -
 tools/perf/arch/sparc/include/syscall_table.h |   8 -
 tools/perf/arch/x86/entry/syscalls/Kbuild     |   3 -
 .../arch/x86/entry/syscalls/Makefile.syscalls |   6 -
 tools/perf/arch/x86/include/syscall_table.h   |   8 -
 tools/perf/arch/xtensa/entry/syscalls/Kbuild  |   2 -
 .../xtensa/entry/syscalls/Makefile.syscalls   |   4 -
 .../perf/arch/xtensa/include/syscall_table.h  |   2 -
 tools/perf/builtin-trace.c                    | 339 ++++++++++++------
 tools/perf/scripts/Makefile.syscalls          |  61 ----
 tools/perf/scripts/syscalltbl.sh              |  86 -----
 tools/perf/trace/beauty/syscalltbl.sh         | 274 ++++++++++++++
 tools/perf/util/dso.c                         |  89 +++++
 tools/perf/util/dso.h                         |  62 ++++
 tools/perf/util/symbol-elf.c                  |  27 --
 tools/perf/util/syscalltbl.c                  | 148 ++++----
 tools/perf/util/syscalltbl.h                  |  22 +-
 tools/perf/util/thread.c                      |  80 +++++
 tools/perf/util/thread.h                      |  14 +-
 57 files changed, 839 insertions(+), 543 deletions(-)
 delete mode 100644 tools/perf/arch/alpha/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/alpha/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/alpha/include/syscall_table.h
 delete mode 100644 tools/perf/arch/arc/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/arc/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/arc/include/syscall_table.h
 delete mode 100644 tools/perf/arch/arm/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/arm/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/arm/include/syscall_table.h
 delete mode 100644 tools/perf/arch/arm64/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/arm64/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/arm64/include/syscall_table.h
 delete mode 100644 tools/perf/arch/csky/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/csky/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/csky/include/syscall_table.h
 delete mode 100644 tools/perf/arch/loongarch/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/loongarch/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/loongarch/include/syscall_table.h
 delete mode 100644 tools/perf/arch/mips/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/mips/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/mips/include/syscall_table.h
 delete mode 100644 tools/perf/arch/parisc/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/parisc/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/parisc/include/syscall_table.h
 delete mode 100644 tools/perf/arch/powerpc/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/powerpc/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/powerpc/include/syscall_table.h
 delete mode 100644 tools/perf/arch/riscv/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/riscv/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/riscv/include/syscall_table.h
 delete mode 100644 tools/perf/arch/s390/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/s390/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/s390/include/syscall_table.h
 delete mode 100644 tools/perf/arch/sh/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/sh/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/sh/include/syscall_table.h
 delete mode 100644 tools/perf/arch/sparc/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/sparc/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/sparc/include/syscall_table.h
 delete mode 100644 tools/perf/arch/x86/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/x86/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/x86/include/syscall_table.h
 delete mode 100644 tools/perf/arch/xtensa/entry/syscalls/Kbuild
 delete mode 100644 tools/perf/arch/xtensa/entry/syscalls/Makefile.syscalls
 delete mode 100644 tools/perf/arch/xtensa/include/syscall_table.h
 delete mode 100644 tools/perf/scripts/Makefile.syscalls
 delete mode 100755 tools/perf/scripts/syscalltbl.sh
 create mode 100755 tools/perf/trace/beauty/syscalltbl.sh
Signature · 1 line
2.49.0.rc1.451.g8f38331e32-goog