#235 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 duplicated 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 duplicated 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 something like the following:

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 i it is clearly ambiguous. Such unit mask bitmask specifications should be detected, and we should exit gracefully with an informative error message.


  • Maynard Johnson

    Maynard Johnson - 2013-01-04
    • summary: Unit mask bitmasks of duplicated values should fail --> Unit mask bitmasks containing non-unique values should fail
  • Maynard Johnson

    Maynard Johnson - 2013-01-08

    A patch was posted for review on Jan 4.

  • Maynard Johnson

    Maynard Johnson - 2013-01-29

    The patch was committed on Jan 23.

  • Maynard Johnson

    Maynard Johnson - 2013-01-29
    • status: open --> open-fixed
  • Maynard Johnson

    Maynard Johnson - 2013-07-17
    • assigned_to: Maynard Johnson
    • Group: -->
  • Maynard Johnson

    Maynard Johnson - 2013-07-29
    • status: open-fixed --> closed-fixed

Log in to post a comment.