2023-11-30 06:23:52

by Ravi Bangoria

[permalink] [raw]
Subject: [PATCH v2] perf/x86/amd: Reject branch stack for IBS events

From: Namhyung Kim <[email protected]>

The AMD IBS PMU doesn't handle branch stacks, so it should not accept
events with brstack.

Signed-off-by: Namhyung Kim <[email protected]>
Signed-off-by: Ravi Bangoria <[email protected]>
---
v1: https://lore.kernel.org/r/[email protected]
v1->v2:
- Rebase on top of peterz/queue/perf/core

arch/x86/events/amd/ibs.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index 6911c5399d02..e91970b01d62 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -287,6 +287,9 @@ static int perf_ibs_init(struct perf_event *event)
if (config & ~perf_ibs->config_mask)
return -EINVAL;

+ if (has_branch_stack(event))
+ return -EOPNOTSUPP;
+
ret = validate_group(event);
if (ret)
return ret;
--
2.34.1


2023-11-30 08:42:57

by tip-bot2 for Jacob Pan

[permalink] [raw]
Subject: [tip: perf/core] perf/x86/amd: Reject branch stack for IBS events

The following commit has been merged into the perf/core branch of tip:

Commit-ID: 0f9e0d7928d8e88d57b1482effab70edb9741ce1
Gitweb: https://git.kernel.org/tip/0f9e0d7928d8e88d57b1482effab70edb9741ce1
Author: Namhyung Kim <[email protected]>
AuthorDate: Thu, 30 Nov 2023 11:52:46 +05:30
Committer: Ingo Molnar <[email protected]>
CommitterDate: Thu, 30 Nov 2023 09:34:40 +01:00

perf/x86/amd: Reject branch stack for IBS events

The AMD IBS PMU doesn't handle branch stacks, so it should not accept
events with brstack.

Signed-off-by: Namhyung Kim <[email protected]>
Signed-off-by: Ravi Bangoria <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
arch/x86/events/amd/ibs.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c
index 6911c53..e91970b 100644
--- a/arch/x86/events/amd/ibs.c
+++ b/arch/x86/events/amd/ibs.c
@@ -287,6 +287,9 @@ static int perf_ibs_init(struct perf_event *event)
if (config & ~perf_ibs->config_mask)
return -EINVAL;

+ if (has_branch_stack(event))
+ return -EOPNOTSUPP;
+
ret = validate_group(event);
if (ret)
return ret;