Unit mask bitmasks containing non-unique values should fail
When named unit mask support was added by Andi Kleen (Intel) in the 0.9.7
timeframe, it became possible for multiple unit masks to have the same
hex value for a given event. The (only) way to disambiguate these non-unique
unit mask values is to specify them by name. It was pointed out during patch
reviews that OR'ing together such unit masks (for bitmask types of unit
masks) was problematic. Andi asserted that bitmasks containing any of the
non-unique values simly would not be supported. Unfortunately, we dropped
the ball and did not document this restriction, and neither did we put any
checks into the code to prevent users from doing this.
On i386/sandybridge, the int_misc event has the following possible unit
mask values that can be put into a bitmask:
Unit masks (default 0x40)
0x40: rat_stall_cycles Cycles Resource Allocation Table (RAT) external
stall is sent to Instruction Decode Queue (IDQ) for this thread.
0x03: recovery_cycles Number of cycles waiting to be recover after Nuke due
to all other cases except JEClear. (extra: cmask=1)
0x03: recovery_stalls_count Edge applied to recovery_cycles, thus counts
occurrences. (extra: edge cmask=1)
The event specification of int_misc:2000000:43 will be incorrectly accepted
as valid even though it is clearly ambiguous. With this patch, such unit mask
bitmask specifications will be detected, and we will exit gracefully with an
informative error message.
Signed-off-by: Maynard Johnson <firstname.lastname@example.org>