• Stephane Eranian's avatar
    perf_events: Add new start/stop PMU callbacks · d76a0812
    Stephane Eranian authored
    In certain situations, the kernel may need to stop and start the same
    event rapidly. The current PMU callbacks do not distinguish between stop
    and release (i.e., stop + free the resource). Thus, a counter may be
    released, then it will be immediately re-acquired. Event scheduling will
    again take place with no guarantee to assign the same counter. On some
    processors, this may event yield to failure to assign the event back due
    to competion between cores.
    
    This patch is adding a new pair of callback to stop and restart a counter
    without actually release the underlying counter resource. On stop, the
    counter is stopped, its values saved and that's it. On start, the value
    is reloaded and counter is restarted (on x86, actual restart is delayed
    until perf_enable()).
    Signed-off-by: default avatarStephane Eranian <eranian@google.com>
    [ added fallback to ->enable/->disable for all other PMUs
      fixed x86_pmu_start() to call x86_pmu.enable()
      merged __x86_pmu_disable into x86_pmu_stop() ]
    Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <4b703875.0a04d00a.7896.ffffb824@mx.google.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    d76a0812
perf_event.c 68.8 KB