linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/perf: riscv: Disable PERF_SAMPLE_BRANCH_* while not supported
@ 2024-03-05 15:52 Pu Lehui
  2024-03-07 17:52 ` Conor Dooley
  0 siblings, 1 reply; 5+ messages in thread
From: Pu Lehui @ 2024-03-05 15:52 UTC (permalink / raw)
  To: linux-riscv, bpf
  Cc: Atish Patra, Anup Patel, Palmer Dabbelt, Björn Töpel,
	Pu Lehui, Pu Lehui

From: Pu Lehui <pulehui@huawei.com>

RISC-V perf does not yet support branch sampling. Two riscv bpf
testcases get_branch_snapshot and perf_branches/perf_branches_hw failed
due to not disabling such sampling.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
 drivers/perf/riscv_pmu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/perf/riscv_pmu.c b/drivers/perf/riscv_pmu.c
index c78a6fd6c57f..bc42cb95a97c 100644
--- a/drivers/perf/riscv_pmu.c
+++ b/drivers/perf/riscv_pmu.c
@@ -313,6 +313,10 @@ static int riscv_pmu_event_init(struct perf_event *event)
 	u64 event_config = 0;
 	uint64_t cmask;
 
+	/* does not support taken branch sampling */
+	if (has_branch_stack(event))
+		return -EOPNOTSUPP;
+
 	hwc->flags = 0;
 	mapped_event = rvpmu->event_map(event, &event_config);
 	if (mapped_event < 0) {
-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-03-12  1:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-05 15:52 [PATCH] drivers/perf: riscv: Disable PERF_SAMPLE_BRANCH_* while not supported Pu Lehui
2024-03-07 17:52 ` Conor Dooley
2024-03-09  6:48   ` Pu Lehui
2024-03-09  9:06     ` Atish Patra
2024-03-12  1:18       ` Pu Lehui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).