Hi Peter, On 02-Feb-22 8:06 PM, Peter Zijlstra wrote: > On Wed, Feb 02, 2022 at 04:21:58PM +0530, Ravi Bangoria wrote: >> +/* Overcounting of Retire Based Events Erratum */ >> +static struct event_constraint retire_event_constraints[] __read_mostly = { >> + EVENT_CONSTRAINT(0xC0, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xC1, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xC2, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xC3, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xC4, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xC5, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xC8, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xC9, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xCA, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xCC, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0xD1, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0x1000000C7, 0x4, AMD64_EVENTSEL_EVENT), >> + EVENT_CONSTRAINT(0x1000000D0, 0x4, AMD64_EVENTSEL_EVENT), > > Can't this be encoded nicer? Something like: > > EVENT_CONSTRAINT(0xC0, 0x4, AMD64_EVENTSEL_EVENT & ~0xF). > > To match all of 0xCn ? I don't think so as not all 0xCn events are constrained. But I can probably use EVENT_CONSTRAINT_RANGE() for continuous event codes: EVENT_CONSTRAINT_RANGE(0xC0, 0xC5, 0x4, AMD64_EVENTSEL_EVENT), EVENT_CONSTRAINT_RANGE(0xC8, 0xCA, 0x4, AMD64_EVENTSEL_EVENT), Thanks, Ravi