Re: [PATCH] perf riscv: fix register name strings
From: Arnaldo Carvalho de Melo
Date: Mon Jun 08 2026 - 16:23:05 EST
On Mon, Jun 08, 2026 at 01:08:28PM -0700, Ian Rogers wrote:
> On Mon, Jun 8, 2026 at 12:27 PM Martin Kaiser <martin@xxxxxxxxx> wrote:
> >
> > 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: a90c4519186d ("perf riscv: Remove dwarf-regs.c and add dwarf-regs-table.h")
> > Signed-off-by: Martin Kaiser <martin@xxxxxxxxx>
>
> Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
>
> Thanks for catching this! Sashiko is also green for this change:
> https://sashiko.dev/#/patchset/20260608192731.708606-1-martin%40kaiser.cx
Thanks, applying.
- Arnaldo