• Stephane Eranian's avatar
    perf, x86: Fix Intel fixed counters base initialization · fc66c521
    Stephane Eranian authored
    The following patch solves the problems introduced by Robert's
    commit 41bf4989 and reported by Arun Sharma. This commit gets rid
    of the base + index notation for reading and writing PMU msrs.
    
    The problem is that for fixed counters, the new calculation for
    the base did not take into account the fixed counter indexes,
    thus all fixed counters were read/written from fixed counter 0.
    Although all fixed counters share the same config MSR, they each
    have their own counter register.
    
    Without:
    
     $ task -e unhalted_core_cycles -e instructions_retired -e baclears noploop 1 noploop for 1 seconds
    
      242202299 unhalted_core_cycles (0.00% scaling, ena=1000790892, run=1000790892)
     2389685946 instructions_retired (0.00% scaling, ena=1000790892, run=1000790892)
          49473 baclears             (0.00% scaling, ena=1000790892, run=1000790892)
    
    With:
    
     $ task -e unhalted_core_cycles -e instructions_retired -e baclears noploop 1 noploop for 1 seconds
    
     2392703238 unhalted_core_cycles (0.00% scaling, ena=1000840809, run=1000840809)
     2389793744 instructions_retired (0.00% scaling, ena=1000840809, run=1000840809)
          47863 baclears             (0.00% scaling, ena=1000840809, run=1000840809)
    Signed-off-by: default avatarStephane Eranian <eranian@google.com>
    Cc: peterz@infradead.org
    Cc: ming.m.lin@intel.com
    Cc: robert.richter@amd.com
    Cc: asharma@fb.com
    Cc: perfmon2-devel@lists.sf.net
    LKML-Reference: <20110319172005.GB4978@quad>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    fc66c521
perf_event.c 42.4 KB