• L
    perf: Add group scheduling transactional APIs · 6bde9b6c
    Lin Ming 提交于
    Add group scheduling transactional APIs to struct pmu.
    These APIs will be implemented in arch code, based on Peter's idea as
    below.
    
    > the idea behind hw_perf_group_sched_in() is to not perform
    > schedulability tests on each event in the group, but to add the group
    > as a whole and then perform one test.
    >
    > Of course, when that test fails, you'll have to roll-back the whole
    > group again.
    >
    > So start_txn (or a better name) would simply toggle a flag in the pmu
    > implementation that will make pmu::enable() not perform the
    > schedulablilty test.
    >
    > Then commit_txn() will perform the schedulability test (so note the
    > method has to have a !void return value.
    >
    > This will allow us to use the regular
    > kernel/perf_event.c::group_sched_in() and all the rollback code.
    > Currently each hw_perf_group_sched_in() implementation duplicates all
    > the rolllback code (with various bugs).
    
    ->start_txn:
    Start group events scheduling transaction, set a flag to make
    pmu::enable() not perform the schedulability test, it will be performed
    at commit time.
    
    ->commit_txn:
    Commit group events scheduling transaction, perform the group
    schedulability as a whole
    
    ->cancel_txn:
    Stop group events scheduling transaction, clear the flag so
    pmu::enable() will perform the schedulability test.
    Reviewed-by: NStephane Eranian <eranian@google.com>
    Reviewed-by: NFrederic Weisbecker <fweisbec@gmail.com>
    Signed-off-by: NLin Ming <ming.m.lin@intel.com>
    Cc: David Miller <davem@davemloft.net>
    Cc: Paul Mackerras <paulus@samba.org>
    Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <1272002160.5707.60.camel@minggr.sh.intel.com>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    6bde9b6c
perf_event.c 129.4 KB