Skip to content

Commit 1070d5a

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fix from Ingo Molnar: "An x86/intel event constraint fix" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86: Fix constraint table end marker bug
2 parents 0eda402 + cf30d52 commit 1070d5a

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎arch/x86/kernel/cpu/perf_event.h‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,20 @@ struct cpu_hw_events {
262262
__EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK, \
263263
HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST_HSW)
264264

265-
#define EVENT_CONSTRAINT_END \
266-
EVENT_CONSTRAINT(0, 0, 0)
265+
/*
266+
* We define the end marker as having a weight of -1
267+
* to enable blacklisting of events using a counter bitmask
268+
* of zero and thus a weight of zero.
269+
* The end marker has a weight that cannot possibly be
270+
* obtained from counting the bits in the bitmask.
271+
*/
272+
#define EVENT_CONSTRAINT_END { .weight = -1 }
267273

274+
/*
275+
* Check for end marker with weight == -1
276+
*/
268277
#define for_each_event_constraint(e, c) \
269-
for ((e) = (c); (e)->weight; (e)++)
278+
for ((e) = (c); (e)->weight != -1; (e)++)
270279

271280
/*
272281
* Extra registers for specific events.

0 commit comments

Comments
 (0)