* [PATCH] perf/x86: Reject pair-counter groups with no GP budget
@ 2026-11-09 11:03 Zhao Gongyi
2026-11-12 2:40 ` Hang Zhengyang
0 siblings, 1 reply; 2+ messages in thread
From: Zhao Gongyi @ 2026-11-09 11:03 UTC (permalink / raw)
To: peterz, mingo
Cc: acme, namhyung, mark.rutland, alexander.shishkin, jolsa, irogers,
adrian.hunter, james.clark, x86, kim.phillips, linux-perf-users,
linux-kernel
AMD large-increment events reserve an extra GP counter. A syzkaller
reproducer opens a perf event group until the adjusted GP budget is
exhausted. x86_schedule_events() then WARNs on the unschedulable group.
Treat an exhausted budget as a scheduling failure and return -EINVAL
through the existing cleanup path.
Fixes: 5738891229a2 ("perf/x86/amd: Add support for Large Increment per Cycle Events")
Cc: stable@vger.kernel.org
Signed-off-by: Zhao Gongyi <zhaogongyi@bytedance.com>
---
arch/x86/events/core.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 4e344fb1a..20ba7b5b0 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -1246,11 +1246,13 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
*/
if (x86_pmu.flags & PMU_FL_PAIR) {
gpmax -= cpuc->n_pair;
- WARN_ON(gpmax <= 0);
+ if (gpmax <= 0)
+ unsched = 1;
}
- unsched = perf_assign_events(cpuc->event_constraint, n, wmin,
- wmax, gpmax, assign);
+ if (!unsched)
+ unsched = perf_assign_events(cpuc->event_constraint, n, wmin,
+ wmax, gpmax, assign);
}
/*
base-commit: 59f1398140869432c7171b9a2a279ca315467c4e
--
2.39.5 (Apple Git-154)
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] perf/x86: Reject pair-counter groups with no GP budget
2026-11-09 11:03 [PATCH] perf/x86: Reject pair-counter groups with no GP budget Zhao Gongyi
@ 2026-11-12 2:40 ` Hang Zhengyang
0 siblings, 0 replies; 2+ messages in thread
From: Hang Zhengyang @ 2026-11-12 2:40 UTC (permalink / raw)
To: Zhao Gongyi
Cc: peterz, mingo, acme, namhyung, mark.rutland, alexander.shishkin,
jolsa, irogers, adrian.hunter, james.clark, x86, kim.phillips,
linux-perf-users, linux-kernel
On Mon, 09 Nov 2026 19:03:56 +0800, Zhao Gongyi wrote:
> AMD large-increment events reserve an extra GP counter. A syzkaller
> reproducer opens a perf event group until the adjusted GP budget is
> exhausted. x86_schedule_events() then WARNs on the unschedulable group.
Tested on AMD Zen 3 (KVM guest, tip perf/urgent): a group of six
fp_ret_sse_avx_ops.all events hits the WARN without this patch and not
with it; smaller groups still schedule. Without your n_pair fix the WARN
fires only once per CPU.
Tested-by: Hang Zhengyang <hang.zhengyang1010@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-12 2:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 11:03 [PATCH] perf/x86: Reject pair-counter groups with no GP budget Zhao Gongyi
2026-11-12 2:40 ` Hang Zhengyang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®