[PATCH] perf/x86: Reject pair-counter groups with no GP budget
From: Zhao Gongyi
Date: Mon Nov 09 2026 - 06:04:52 EST
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@xxxxxxxxxxxxxxx
Signed-off-by: Zhao Gongyi <zhaogongyi@xxxxxxxxxxxxx>
---
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)