Re: [PATCH] drivers/perf: riscv: handle legacy fallback in event check
Will Deacon <[email protected]> Fri, 31 Jul 2026 17:35:16 +0100
| Newsgroups | org.infradead.lists.linux-riscv,org.kernel.vger.linux-kernel,org.kernel.vger.linux-perf-users |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jul 10, 2026 at 01:08:35PM +0300, Sergey Matyukevich wrote: > Common events PERF_COUNT_HW_CPU_CYCLES and PERF_COUNT_HW_INSTRUCTIONS > can fall back to the legacy counters. So do not mark them as invalid > if OpenSBI reports that they are not mapped to sampling counters > in PMU DT node. > > Signed-off-by: Sergey Matyukevich <[email protected]> > --- > drivers/perf/riscv_pmu_sbi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c > index dfc886dee5ad..8f7aa71dc96f 100644 > --- a/drivers/perf/riscv_pmu_sbi.c > +++ b/drivers/perf/riscv_pmu_sbi.c > @@ -335,7 +335,8 @@ static int pmu_sbi_check_event_info(void) > goto free_mem; > } > > - for (i = 0; i < ARRAY_SIZE(pmu_hw_event_map); i++) { > + /* skip check for cycles and instructions as they can fall back to legacy counters */ > + for (i = 2; i < ARRAY_SIZE(pmu_hw_event_map); i++) { > if (!(event_info_shmem[i].output & RISCV_PMU_EVENT_INFO_OUTPUT_MASK)) > pmu_hw_event_map[i].event_idx = -ENOENT; > } I'm assuming the riscv tree are handling perf patches to the riscv driver, but please shout if not. Will _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv