• Paul Mackerras's avatar
    perf_counter: Add optional hw_perf_group_sched_in arch function · 3cbed429
    Paul Mackerras authored
    Impact: extend perf_counter infrastructure
    
    This adds an optional hw_perf_group_sched_in() arch function that enables
    a whole group of counters in one go.  It returns 1 if it added the group
    successfully, 0 if it did nothing (and therefore the core needs to add
    the counters individually), or a negative number if an error occurred.
    It should add all the counters and enable any software counters in the
    group, or else add none of them and return an error.
    
    There are a couple of related changes/improvements in the group handling
    here:
    
    * As an optimization, group_sched_out() and group_sched_in() now check the
      state of the group leader, and do nothing if the leader is not active
      or disabled.
    
    * We now call hw_perf_save_disable/hw_perf_restore around the complete
      set of counter enable/disable calls in __perf_counter_sched_in/out,
      to give the arch code the opportunity to defer updating the hardware
      state until the hw_perf_restore call if it wants.
    
    * We no longer stop adding groups after we get to a group that has more
      than one counter.  We will ultimately add an option for a group to be
      exclusive.  The current code doesn't really implement exclusive groups
      anyway, since a group could end up going on with other counters that
      get added before it.
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    3cbed429
perf_counter.c 39.8 KB