[PATCH v1 0/4] Support register names from all architectures

From: German Gomez
Date: Wed Dec 01 2021 - 07:34:03 EST


The following changeset applies some corrections to the way system
registers are processed and presented when reading perf.data files using
the various perf tools.

The commit message from [4/4] shows how register names aren't correctly
presented when performing x-arch analysis of perf.data files (i.e.
recording in one arch, then reading the file from a different arch).

Please let me know if there are any concerns with this approach, or if
any improvements can be made for subsequent re-rolls of the changeset.

- [PATCH 1/4] Fixes a potential out-of-bounds access when reading the
values of the registers in the perf.data file.
- [PATCH 2/4] Modifies one of the callbacks in "struct scripting_ops"
so that the python version can obtain the correct register names.
- [PATCH 3/4] Adds header files with the register indices and names
from all architectures, which are used by the next patch.
- [PATCH 4/4] Refactors the function "perf_reg_name" so that it can
support registers from all architectures, not just the local one.

Thanks,
German

German Gomez (4):
perf tools: Prevent out-of-bounds access to registers
perf script: Add "struct machine" parameter to process_event callback
perf tools: Crete header files with register names
perf tools: Support register names from all architectures

tools/perf/arch/arm/include/perf_regs.h | 42 --------
tools/perf/arch/arm64/include/perf_regs.h | 76 -------------
tools/perf/arch/csky/include/perf_regs.h | 82 --------------
tools/perf/arch/mips/include/perf_regs.h | 69 ------------
tools/perf/arch/powerpc/include/perf_regs.h | 66 ------------
tools/perf/arch/riscv/include/perf_regs.h | 74 -------------
tools/perf/arch/s390/include/perf_regs.h | 78 --------------
tools/perf/arch/x86/include/perf_regs.h | 82 --------------
tools/perf/builtin-script.c | 26 ++---
tools/perf/util/event.h | 5 +-
tools/perf/util/perf_regs.c | 3 +
tools/perf/util/perf_regs.h | 33 +++++-
tools/perf/util/perf_regs_arm.h | 57 ++++++++++
tools/perf/util/perf_regs_arm64.h | 83 ++++++++++++++
tools/perf/util/perf_regs_csky.h | 101 ++++++++++++++++++
tools/perf/util/perf_regs_mips.h | 76 +++++++++++++
tools/perf/util/perf_regs_powerpc.h | 74 +++++++++++++
tools/perf/util/perf_regs_riscv.h | 81 ++++++++++++++
tools/perf/util/perf_regs_s390.h | 85 +++++++++++++++
tools/perf/util/perf_regs_x86.h | 87 +++++++++++++++
.../util/scripting-engines/trace-event-perl.c | 3 +-
.../scripting-engines/trace-event-python.c | 33 +++---
tools/perf/util/session.c | 25 ++---
tools/perf/util/trace-event-scripting.c | 3 +-
tools/perf/util/trace-event.h | 3 +-
25 files changed, 733 insertions(+), 614 deletions(-)
create mode 100644 tools/perf/util/perf_regs_arm.h
create mode 100644 tools/perf/util/perf_regs_arm64.h
create mode 100644 tools/perf/util/perf_regs_csky.h
create mode 100644 tools/perf/util/perf_regs_mips.h
create mode 100644 tools/perf/util/perf_regs_powerpc.h
create mode 100644 tools/perf/util/perf_regs_riscv.h
create mode 100644 tools/perf/util/perf_regs_s390.h
create mode 100644 tools/perf/util/perf_regs_x86.h

--
2.25.1