#234 operf/opcontrol accept some invalid unit mask values

None
closed-fixed
None
5
2013-07-29
2013-01-03
Maynard Johnson
No

Under certain conditions for events that use a bitmask of unit mask values, an invalid unit mask value specified by the user may be incorrectly accepted as valid. For example:
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:1 will be incorrectly accepted as valid.

The code in libop/op_events.c:op_check_events is faulty in how it ascertains the validity of a passed unit mask value when the given event's unit_type_mask == utm_bitmask.

Discussion

  • Another example for sandybridge:
    l2_rqsts:200000:2
    where the valid unit mask values are:

    name:l2_rqsts type:bitmask default:0x1
    0x1 demand_data_rd_hit Demand Data Read hit L2, no rejects
    0x4 rfo_hit RFO requests that hit L2 cache
    0x8 rfo_miss RFO requests that miss L2 cache
    0x10 code_rd_hit L2 cache hits when fetching instructions, code reads.
    0x20 code_rd_miss L2 cache misses when fetching instructions
    0x40 pf_hit Requests from the L2 hardware prefetchers that hit L2 cache
    0x80 pf_miss Requests from the L2 hardware prefetchers that miss L2 cache
    0x3 all_demand_data_rd Any data read request to L2 cache
    0xc all_rfo Any data RFO request to L2 cache
    0x30 all_code_rd Any code read request to L2 cache
    0xc0 all_pf Any L2 HW prefetch request to L2 cache

     
  • A patch was posted for review on Jan 4.

     
    • status: open --> open-fixed
     
  • Fix committed on Jan 14, 2013.

     
    • assigned_to: Maynard Johnson
    • Group: -->
     
    • status: open-fixed --> closed-fixed