Skip to content

Commit ea68731

Browse files
Pu Lehuipalmer-dabbelt
authored andcommitted
drivers/perf: riscv: Disable PERF_SAMPLE_BRANCH_* while not supported
RISC-V perf driver does not yet support branch sampling. Although the specification is in the works [0], it is best to disable such events until support is available, otherwise we will get unexpected results. Due to this reason, two riscv bpf testcases get_branch_snapshot and perf_branches/perf_branches_hw fail. Link: https://github.com/riscv/riscv-control-transfer-records [0] Fixes: f5bfa23 ("RISC-V: Add a perf core library for pmu drivers") Signed-off-by: Pu Lehui <[email protected]> Reviewed-by: Atish Patra <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 4b0bf9a commit ea68731

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/perf/riscv_pmu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,10 @@ static int riscv_pmu_event_init(struct perf_event *event)
313313
u64 event_config = 0;
314314
uint64_t cmask;
315315

316+
/* driver does not support branch stack sampling */
317+
if (has_branch_stack(event))
318+
return -EOPNOTSUPP;
319+
316320
hwc->flags = 0;
317321
mapped_event = rvpmu->event_map(event, &event_config);
318322
if (mapped_event < 0) {

0 commit comments

Comments
 (0)