From: Martin Kaiser Date: Tue, 9 Jun 2026 08:13:09 +0000 (+0200) Subject: perf riscv: fix register name strings X-Git-Tag: v7.2-rc1~60^2~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d28a56cae9b298a351b361d8d374cb4a9089e3f;p=thirdparty%2Fkernel%2Flinux.git perf riscv: fix register name strings On risc-v, pref probe generates an invalid syntax for a named register in a kprobe. $ perf probe --debug verbose --add "n_tty_write tty" ... Writing event: p:probe/n_tty_write _text+8922528 tty=%"%a0":x64 Failed to write event: Invalid argument The problem is the combination of #define REG_DWARFNUM_NAME(reg, idx) [idx] = "%" #reg and entries such as REG_DWARFNUM_NAME("%a0", 10) where #reg will escape the quotes of the first macro parameter. Update the macro definition to produce the correct syntax for a named register in a kprobe, i.e. the unquoted register name with only one leading %. Fixes: a90c4519186dfc08 ("perf riscv: Remove dwarf-regs.c and add dwarf-regs-table.h") Reviewed-by: Ian Rogers Signed-off-by: Martin Kaiser Cc: Ian Rogers Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/arch/riscv/include/dwarf-regs-table.h b/tools/perf/arch/riscv/include/dwarf-regs-table.h index 009a4e3c51ab3..8c42806d34f1a 100644 --- a/tools/perf/arch/riscv/include/dwarf-regs-table.h +++ b/tools/perf/arch/riscv/include/dwarf-regs-table.h @@ -3,7 +3,7 @@ /* This is included in perf/util/dwarf-regs.c */ #undef REG_DWARFNUM_NAME -#define REG_DWARFNUM_NAME(reg, idx) [idx] = "%" #reg +#define REG_DWARFNUM_NAME(reg, idx) [idx] = reg static const char * const riscv_regstr_tbl[] = { REG_DWARFNUM_NAME("%zero", 0),