Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf regs: Refactor use of arch__sample_reg_masks() to perf_reg_name()

arch__sample_reg_masks isn't supported on ARM(32), csky, loongarch,
MIPS, RISC-V and s390.

The table returned by the function just has the name of a register
paired with the corresponding sample_regs_user mask value.

For a given perf register we can compute the name with perf_reg_name and
the mask is just 1 left-shifted by the perf register number.

Change __parse_regs to use this method for finding registers rather than
arch__sample_reg_masks, thereby adding __parse_regs support for ARM(32),
csky, loongarch, MIPS, RISC-V and s390.

As arch__sample_reg_masks is then unused, remove the now unneeded
declarations.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Aditya Bodkhe <aditya.b1@linux.ibm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.ibm.com>
Cc: Chun-Tse Shao <ctshao@google.com>
Cc: Dapeng Mi <dapeng1.mi@linux.intel.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Dr. David Alan Gilbert <linux@treblig.org>
Cc: Guo Ren <guoren@kernel.org>
Cc: Haibo Xu <haibo1.xu@intel.com>
Cc: Howard Chu <howardchu95@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Krzysztof Łopatowski <krzysztof.m.lopatowski@gmail.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sergei Trofimovich <slyich@gmail.com>
Cc: Shimin Guo <shimin.guo@skydio.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
3d06db9b f0d98c78

+76 -282
-9
tools/perf/arch/arm/util/perf_regs.c
··· 2 2 #include "perf_regs.h" 3 3 #include "../../../util/perf_regs.h" 4 4 5 - static const struct sample_reg sample_reg_masks[] = { 6 - SMPL_REG_END 7 - }; 8 - 9 5 uint64_t arch__intr_reg_mask(void) 10 6 { 11 7 return PERF_REGS_MASK; ··· 10 14 uint64_t arch__user_reg_mask(void) 11 15 { 12 16 return PERF_REGS_MASK; 13 - } 14 - 15 - const struct sample_reg *arch__sample_reg_masks(void) 16 - { 17 - return sample_reg_masks; 18 17 }
+4 -10
tools/perf/arch/arm64/util/machine.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 - #include <inttypes.h> 4 - #include <stdio.h> 5 - #include <string.h> 6 - #include "debug.h" 7 - #include "symbol.h" 8 - #include "callchain.h" 3 + #include "callchain.h" // prototype of arch__add_leaf_frame_record_opts 9 4 #include "perf_regs.h" 10 5 #include "record.h" 11 - #include "util/perf_regs.h" 6 + 7 + #define SMPL_REG_MASK(b) (1ULL << (b)) 12 8 13 9 void arch__add_leaf_frame_record_opts(struct record_opts *opts) 14 10 { 15 - const struct sample_reg *sample_reg_masks = arch__sample_reg_masks(); 16 - 17 - opts->sample_user_regs |= sample_reg_masks[PERF_REG_ARM64_LR].mask; 11 + opts->sample_user_regs |= SMPL_REG_MASK(PERF_REG_ARM64_LR); 18 12 }
+2 -43
tools/perf/arch/arm64/util/perf_regs.c
··· 12 12 #include "../../../util/event.h" 13 13 #include "../../../util/perf_regs.h" 14 14 15 + #define SMPL_REG_MASK(b) (1ULL << (b)) 16 + 15 17 #ifndef HWCAP_SVE 16 18 #define HWCAP_SVE (1 << 22) 17 19 #endif 18 - 19 - static const struct sample_reg sample_reg_masks[] = { 20 - SMPL_REG(x0, PERF_REG_ARM64_X0), 21 - SMPL_REG(x1, PERF_REG_ARM64_X1), 22 - SMPL_REG(x2, PERF_REG_ARM64_X2), 23 - SMPL_REG(x3, PERF_REG_ARM64_X3), 24 - SMPL_REG(x4, PERF_REG_ARM64_X4), 25 - SMPL_REG(x5, PERF_REG_ARM64_X5), 26 - SMPL_REG(x6, PERF_REG_ARM64_X6), 27 - SMPL_REG(x7, PERF_REG_ARM64_X7), 28 - SMPL_REG(x8, PERF_REG_ARM64_X8), 29 - SMPL_REG(x9, PERF_REG_ARM64_X9), 30 - SMPL_REG(x10, PERF_REG_ARM64_X10), 31 - SMPL_REG(x11, PERF_REG_ARM64_X11), 32 - SMPL_REG(x12, PERF_REG_ARM64_X12), 33 - SMPL_REG(x13, PERF_REG_ARM64_X13), 34 - SMPL_REG(x14, PERF_REG_ARM64_X14), 35 - SMPL_REG(x15, PERF_REG_ARM64_X15), 36 - SMPL_REG(x16, PERF_REG_ARM64_X16), 37 - SMPL_REG(x17, PERF_REG_ARM64_X17), 38 - SMPL_REG(x18, PERF_REG_ARM64_X18), 39 - SMPL_REG(x19, PERF_REG_ARM64_X19), 40 - SMPL_REG(x20, PERF_REG_ARM64_X20), 41 - SMPL_REG(x21, PERF_REG_ARM64_X21), 42 - SMPL_REG(x22, PERF_REG_ARM64_X22), 43 - SMPL_REG(x23, PERF_REG_ARM64_X23), 44 - SMPL_REG(x24, PERF_REG_ARM64_X24), 45 - SMPL_REG(x25, PERF_REG_ARM64_X25), 46 - SMPL_REG(x26, PERF_REG_ARM64_X26), 47 - SMPL_REG(x27, PERF_REG_ARM64_X27), 48 - SMPL_REG(x28, PERF_REG_ARM64_X28), 49 - SMPL_REG(x29, PERF_REG_ARM64_X29), 50 - SMPL_REG(lr, PERF_REG_ARM64_LR), 51 - SMPL_REG(sp, PERF_REG_ARM64_SP), 52 - SMPL_REG(pc, PERF_REG_ARM64_PC), 53 - SMPL_REG(vg, PERF_REG_ARM64_VG), 54 - SMPL_REG_END 55 - }; 56 20 57 21 /* %xNUM */ 58 22 #define SDT_OP_REGEX1 "^(x[1-2]?[0-9]|3[0-1])$" ··· 138 174 } 139 175 } 140 176 return PERF_REGS_MASK; 141 - } 142 - 143 - const struct sample_reg *arch__sample_reg_masks(void) 144 - { 145 - return sample_reg_masks; 146 177 }
-9
tools/perf/arch/csky/util/perf_regs.c
··· 2 2 #include "perf_regs.h" 3 3 #include "../../util/perf_regs.h" 4 4 5 - static const struct sample_reg sample_reg_masks[] = { 6 - SMPL_REG_END 7 - }; 8 - 9 5 uint64_t arch__intr_reg_mask(void) 10 6 { 11 7 return PERF_REGS_MASK; ··· 10 14 uint64_t arch__user_reg_mask(void) 11 15 { 12 16 return PERF_REGS_MASK; 13 - } 14 - 15 - const struct sample_reg *arch__sample_reg_masks(void) 16 - { 17 - return sample_reg_masks; 18 17 }
-9
tools/perf/arch/loongarch/util/perf_regs.c
··· 2 2 #include "perf_regs.h" 3 3 #include "../../../util/perf_regs.h" 4 4 5 - static const struct sample_reg sample_reg_masks[] = { 6 - SMPL_REG_END 7 - }; 8 - 9 5 uint64_t arch__intr_reg_mask(void) 10 6 { 11 7 return PERF_REGS_MASK; ··· 10 14 uint64_t arch__user_reg_mask(void) 11 15 { 12 16 return PERF_REGS_MASK; 13 - } 14 - 15 - const struct sample_reg *arch__sample_reg_masks(void) 16 - { 17 - return sample_reg_masks; 18 17 }
-9
tools/perf/arch/mips/util/perf_regs.c
··· 2 2 #include "perf_regs.h" 3 3 #include "../../util/perf_regs.h" 4 4 5 - static const struct sample_reg sample_reg_masks[] = { 6 - SMPL_REG_END 7 - }; 8 - 9 5 uint64_t arch__intr_reg_mask(void) 10 6 { 11 7 return PERF_REGS_MASK; ··· 10 14 uint64_t arch__user_reg_mask(void) 11 15 { 12 16 return PERF_REGS_MASK; 13 - } 14 - 15 - const struct sample_reg *arch__sample_reg_masks(void) 16 - { 17 - return sample_reg_masks; 18 17 }
-68
tools/perf/arch/powerpc/util/perf_regs.c
··· 18 18 #define PVR_POWER10 0x0080 19 19 #define PVR_POWER11 0x0082 20 20 21 - static const struct sample_reg sample_reg_masks[] = { 22 - SMPL_REG(r0, PERF_REG_POWERPC_R0), 23 - SMPL_REG(r1, PERF_REG_POWERPC_R1), 24 - SMPL_REG(r2, PERF_REG_POWERPC_R2), 25 - SMPL_REG(r3, PERF_REG_POWERPC_R3), 26 - SMPL_REG(r4, PERF_REG_POWERPC_R4), 27 - SMPL_REG(r5, PERF_REG_POWERPC_R5), 28 - SMPL_REG(r6, PERF_REG_POWERPC_R6), 29 - SMPL_REG(r7, PERF_REG_POWERPC_R7), 30 - SMPL_REG(r8, PERF_REG_POWERPC_R8), 31 - SMPL_REG(r9, PERF_REG_POWERPC_R9), 32 - SMPL_REG(r10, PERF_REG_POWERPC_R10), 33 - SMPL_REG(r11, PERF_REG_POWERPC_R11), 34 - SMPL_REG(r12, PERF_REG_POWERPC_R12), 35 - SMPL_REG(r13, PERF_REG_POWERPC_R13), 36 - SMPL_REG(r14, PERF_REG_POWERPC_R14), 37 - SMPL_REG(r15, PERF_REG_POWERPC_R15), 38 - SMPL_REG(r16, PERF_REG_POWERPC_R16), 39 - SMPL_REG(r17, PERF_REG_POWERPC_R17), 40 - SMPL_REG(r18, PERF_REG_POWERPC_R18), 41 - SMPL_REG(r19, PERF_REG_POWERPC_R19), 42 - SMPL_REG(r20, PERF_REG_POWERPC_R20), 43 - SMPL_REG(r21, PERF_REG_POWERPC_R21), 44 - SMPL_REG(r22, PERF_REG_POWERPC_R22), 45 - SMPL_REG(r23, PERF_REG_POWERPC_R23), 46 - SMPL_REG(r24, PERF_REG_POWERPC_R24), 47 - SMPL_REG(r25, PERF_REG_POWERPC_R25), 48 - SMPL_REG(r26, PERF_REG_POWERPC_R26), 49 - SMPL_REG(r27, PERF_REG_POWERPC_R27), 50 - SMPL_REG(r28, PERF_REG_POWERPC_R28), 51 - SMPL_REG(r29, PERF_REG_POWERPC_R29), 52 - SMPL_REG(r30, PERF_REG_POWERPC_R30), 53 - SMPL_REG(r31, PERF_REG_POWERPC_R31), 54 - SMPL_REG(nip, PERF_REG_POWERPC_NIP), 55 - SMPL_REG(msr, PERF_REG_POWERPC_MSR), 56 - SMPL_REG(orig_r3, PERF_REG_POWERPC_ORIG_R3), 57 - SMPL_REG(ctr, PERF_REG_POWERPC_CTR), 58 - SMPL_REG(link, PERF_REG_POWERPC_LINK), 59 - SMPL_REG(xer, PERF_REG_POWERPC_XER), 60 - SMPL_REG(ccr, PERF_REG_POWERPC_CCR), 61 - SMPL_REG(softe, PERF_REG_POWERPC_SOFTE), 62 - SMPL_REG(trap, PERF_REG_POWERPC_TRAP), 63 - SMPL_REG(dar, PERF_REG_POWERPC_DAR), 64 - SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR), 65 - SMPL_REG(sier, PERF_REG_POWERPC_SIER), 66 - SMPL_REG(mmcra, PERF_REG_POWERPC_MMCRA), 67 - SMPL_REG(mmcr0, PERF_REG_POWERPC_MMCR0), 68 - SMPL_REG(mmcr1, PERF_REG_POWERPC_MMCR1), 69 - SMPL_REG(mmcr2, PERF_REG_POWERPC_MMCR2), 70 - SMPL_REG(mmcr3, PERF_REG_POWERPC_MMCR3), 71 - SMPL_REG(sier2, PERF_REG_POWERPC_SIER2), 72 - SMPL_REG(sier3, PERF_REG_POWERPC_SIER3), 73 - SMPL_REG(pmc1, PERF_REG_POWERPC_PMC1), 74 - SMPL_REG(pmc2, PERF_REG_POWERPC_PMC2), 75 - SMPL_REG(pmc3, PERF_REG_POWERPC_PMC3), 76 - SMPL_REG(pmc4, PERF_REG_POWERPC_PMC4), 77 - SMPL_REG(pmc5, PERF_REG_POWERPC_PMC5), 78 - SMPL_REG(pmc6, PERF_REG_POWERPC_PMC6), 79 - SMPL_REG(sdar, PERF_REG_POWERPC_SDAR), 80 - SMPL_REG(siar, PERF_REG_POWERPC_SIAR), 81 - SMPL_REG_END 82 - }; 83 - 84 21 /* REG or %rREG */ 85 22 #define SDT_OP_REGEX1 "^(%r)?([1-2]?[0-9]|3[0-1])$" 86 23 ··· 169 232 uint64_t arch__user_reg_mask(void) 170 233 { 171 234 return PERF_REGS_MASK; 172 - } 173 - 174 - const struct sample_reg *arch__sample_reg_masks(void) 175 - { 176 - return sample_reg_masks; 177 235 }
-9
tools/perf/arch/riscv/util/perf_regs.c
··· 2 2 #include "perf_regs.h" 3 3 #include "../../util/perf_regs.h" 4 4 5 - static const struct sample_reg sample_reg_masks[] = { 6 - SMPL_REG_END 7 - }; 8 - 9 5 uint64_t arch__intr_reg_mask(void) 10 6 { 11 7 return PERF_REGS_MASK; ··· 10 14 uint64_t arch__user_reg_mask(void) 11 15 { 12 16 return PERF_REGS_MASK; 13 - } 14 - 15 - const struct sample_reg *arch__sample_reg_masks(void) 16 - { 17 - return sample_reg_masks; 18 17 }
-9
tools/perf/arch/s390/util/perf_regs.c
··· 2 2 #include "perf_regs.h" 3 3 #include "../../util/perf_regs.h" 4 4 5 - static const struct sample_reg sample_reg_masks[] = { 6 - SMPL_REG_END 7 - }; 8 - 9 5 uint64_t arch__intr_reg_mask(void) 10 6 { 11 7 return PERF_REGS_MASK; ··· 10 14 uint64_t arch__user_reg_mask(void) 11 15 { 12 16 return PERF_REGS_MASK; 13 - } 14 - 15 - const struct sample_reg *arch__sample_reg_masks(void) 16 - { 17 - return sample_reg_masks; 18 17 }
-47
tools/perf/arch/x86/util/perf_regs.c
··· 13 13 #include "../../../util/pmu.h" 14 14 #include "../../../util/pmus.h" 15 15 16 - static const struct sample_reg sample_reg_masks[] = { 17 - SMPL_REG(AX, PERF_REG_X86_AX), 18 - SMPL_REG(BX, PERF_REG_X86_BX), 19 - SMPL_REG(CX, PERF_REG_X86_CX), 20 - SMPL_REG(DX, PERF_REG_X86_DX), 21 - SMPL_REG(SI, PERF_REG_X86_SI), 22 - SMPL_REG(DI, PERF_REG_X86_DI), 23 - SMPL_REG(BP, PERF_REG_X86_BP), 24 - SMPL_REG(SP, PERF_REG_X86_SP), 25 - SMPL_REG(IP, PERF_REG_X86_IP), 26 - SMPL_REG(FLAGS, PERF_REG_X86_FLAGS), 27 - SMPL_REG(CS, PERF_REG_X86_CS), 28 - SMPL_REG(SS, PERF_REG_X86_SS), 29 - #ifdef HAVE_ARCH_X86_64_SUPPORT 30 - SMPL_REG(R8, PERF_REG_X86_R8), 31 - SMPL_REG(R9, PERF_REG_X86_R9), 32 - SMPL_REG(R10, PERF_REG_X86_R10), 33 - SMPL_REG(R11, PERF_REG_X86_R11), 34 - SMPL_REG(R12, PERF_REG_X86_R12), 35 - SMPL_REG(R13, PERF_REG_X86_R13), 36 - SMPL_REG(R14, PERF_REG_X86_R14), 37 - SMPL_REG(R15, PERF_REG_X86_R15), 38 - #endif 39 - SMPL_REG2(XMM0, PERF_REG_X86_XMM0), 40 - SMPL_REG2(XMM1, PERF_REG_X86_XMM1), 41 - SMPL_REG2(XMM2, PERF_REG_X86_XMM2), 42 - SMPL_REG2(XMM3, PERF_REG_X86_XMM3), 43 - SMPL_REG2(XMM4, PERF_REG_X86_XMM4), 44 - SMPL_REG2(XMM5, PERF_REG_X86_XMM5), 45 - SMPL_REG2(XMM6, PERF_REG_X86_XMM6), 46 - SMPL_REG2(XMM7, PERF_REG_X86_XMM7), 47 - SMPL_REG2(XMM8, PERF_REG_X86_XMM8), 48 - SMPL_REG2(XMM9, PERF_REG_X86_XMM9), 49 - SMPL_REG2(XMM10, PERF_REG_X86_XMM10), 50 - SMPL_REG2(XMM11, PERF_REG_X86_XMM11), 51 - SMPL_REG2(XMM12, PERF_REG_X86_XMM12), 52 - SMPL_REG2(XMM13, PERF_REG_X86_XMM13), 53 - SMPL_REG2(XMM14, PERF_REG_X86_XMM14), 54 - SMPL_REG2(XMM15, PERF_REG_X86_XMM15), 55 - SMPL_REG_END 56 - }; 57 - 58 16 struct sdt_name_reg { 59 17 const char *sdt_name; 60 18 const char *uprobe_name; ··· 232 274 (int)(rm[5].rm_eo - rm[5].rm_so), old_op + rm[5].rm_so); 233 275 234 276 return SDT_ARG_VALID; 235 - } 236 - 237 - const struct sample_reg *arch__sample_reg_masks(void) 238 - { 239 - return sample_reg_masks; 240 277 } 241 278 242 279 uint64_t arch__intr_reg_mask(void)
+2 -1
tools/perf/util/arm64-frame-pointer-unwind-support.c
··· 2 2 #include "arm64-frame-pointer-unwind-support.h" 3 3 #include "callchain.h" 4 4 #include "event.h" 5 - #include "perf_regs.h" // SMPL_REG_MASK 6 5 #include "unwind.h" 7 6 #include <string.h> 8 7 ··· 13 14 u64 stack[2]; 14 15 size_t length; 15 16 }; 17 + 18 + #define SMPL_REG_MASK(b) (1ULL << (b)) 16 19 17 20 static bool get_leaf_frame_caller_enabled(struct perf_sample *sample) 18 21 {
+68 -38
tools/perf/util/parse-regs-options.c
··· 5 5 #include <string.h> 6 6 #include <stdio.h> 7 7 #include "util/debug.h" 8 + #include <dwarf-regs.h> 8 9 #include <subcmd/parse-options.h> 9 10 #include "util/perf_regs.h" 10 11 #include "util/parse-regs-options.h" 12 + 13 + static void list_perf_regs(FILE *fp, uint64_t mask) 14 + { 15 + const char *last_name = NULL; 16 + 17 + fprintf(fp, "available registers: "); 18 + for (int reg = 0; reg < 64; reg++) { 19 + const char *name; 20 + 21 + if (((1ULL << reg) & mask) == 0) 22 + continue; 23 + 24 + name = perf_reg_name(reg, EM_HOST); 25 + if (name && (!last_name || strcmp(last_name, name))) 26 + fprintf(fp, "%s%s", reg > 0 ? " " : "", name); 27 + last_name = name; 28 + } 29 + fputc('\n', fp); 30 + } 31 + 32 + static uint64_t name_to_perf_reg_mask(const char *to_match, uint64_t mask) 33 + { 34 + uint64_t reg_mask = 0; 35 + 36 + for (int reg = 0; reg < 64; reg++) { 37 + const char *name; 38 + 39 + if (((1ULL << reg) & mask) == 0) 40 + continue; 41 + 42 + name = perf_reg_name(reg, EM_HOST); 43 + if (!name) 44 + continue; 45 + 46 + if (!strcasecmp(to_match, name)) 47 + reg_mask |= 1ULL << reg; 48 + } 49 + return reg_mask; 50 + } 11 51 12 52 static int 13 53 __parse_regs(const struct option *opt, const char *str, int unset, bool intr) 14 54 { 15 55 uint64_t *mode = (uint64_t *)opt->value; 16 - const struct sample_reg *r = NULL; 17 56 char *s, *os = NULL, *p; 18 57 int ret = -1; 19 58 uint64_t mask; ··· 66 27 if (*mode) 67 28 return -1; 68 29 69 - if (intr) 70 - mask = arch__intr_reg_mask(); 71 - else 72 - mask = arch__user_reg_mask(); 73 - 74 30 /* str may be NULL in case no arg is passed to -I */ 75 - if (str) { 76 - /* because str is read-only */ 77 - s = os = strdup(str); 78 - if (!s) 79 - return -1; 31 + if (!str) 32 + return -1; 80 33 81 - for (;;) { 82 - p = strchr(s, ','); 83 - if (p) 84 - *p = '\0'; 34 + mask = intr ? arch__intr_reg_mask() : arch__user_reg_mask(); 85 35 86 - if (!strcmp(s, "?")) { 87 - fprintf(stderr, "available registers: "); 88 - for (r = arch__sample_reg_masks(); r->name; r++) { 89 - if (r->mask & mask) 90 - fprintf(stderr, "%s ", r->name); 91 - } 92 - fputc('\n', stderr); 93 - /* just printing available regs */ 94 - goto error; 95 - } 96 - for (r = arch__sample_reg_masks(); r->name; r++) { 97 - if ((r->mask & mask) && !strcasecmp(s, r->name)) 98 - break; 99 - } 100 - if (!r || !r->name) { 101 - ui__warning("Unknown register \"%s\", check man page or run \"perf record %s?\"\n", 102 - s, intr ? "-I" : "--user-regs="); 103 - goto error; 104 - } 36 + /* because str is read-only */ 37 + s = os = strdup(str); 38 + if (!s) 39 + return -1; 105 40 106 - *mode |= r->mask; 41 + for (;;) { 42 + uint64_t reg_mask; 107 43 108 - if (!p) 109 - break; 44 + p = strchr(s, ','); 45 + if (p) 46 + *p = '\0'; 110 47 111 - s = p + 1; 48 + if (!strcmp(s, "?")) { 49 + list_perf_regs(stderr, mask); 50 + goto error; 112 51 } 52 + 53 + reg_mask = name_to_perf_reg_mask(s, mask); 54 + if (reg_mask == 0) { 55 + ui__warning("Unknown register \"%s\", check man page or run \"perf record %s?\"\n", 56 + s, intr ? "-I" : "--user-regs="); 57 + goto error; 58 + } 59 + *mode |= reg_mask; 60 + 61 + if (!p) 62 + break; 63 + 64 + s = p + 1; 113 65 } 114 66 ret = 0; 115 67
-9
tools/perf/util/perf_regs.c
··· 23 23 return 0; 24 24 } 25 25 26 - static const struct sample_reg sample_reg_masks[] = { 27 - SMPL_REG_END 28 - }; 29 - 30 - const struct sample_reg * __weak arch__sample_reg_masks(void) 31 - { 32 - return sample_reg_masks; 33 - } 34 - 35 26 const char *perf_reg_name(int id, uint16_t e_machine) 36 27 { 37 28 const char *reg_name = NULL;
-12
tools/perf/util/perf_regs.h
··· 7 7 8 8 struct regs_dump; 9 9 10 - struct sample_reg { 11 - const char *name; 12 - uint64_t mask; 13 - }; 14 - 15 - #define SMPL_REG_MASK(b) (1ULL << (b)) 16 - #define SMPL_REG(n, b) { .name = #n, .mask = SMPL_REG_MASK(b) } 17 - #define SMPL_REG2_MASK(b) (3ULL << (b)) 18 - #define SMPL_REG2(n, b) { .name = #n, .mask = SMPL_REG2_MASK(b) } 19 - #define SMPL_REG_END { .name = NULL } 20 - 21 10 enum { 22 11 SDT_ARG_VALID = 0, 23 12 SDT_ARG_SKIP, ··· 15 26 int arch_sdt_arg_parse_op(char *old_op, char **new_op); 16 27 uint64_t arch__intr_reg_mask(void); 17 28 uint64_t arch__user_reg_mask(void); 18 - const struct sample_reg *arch__sample_reg_masks(void); 19 29 20 30 const char *perf_reg_name(int id, uint16_t e_machine); 21 31 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);