perf_counter: Generic per counter interrupt throttle
Introduce a generic per counter interrupt throttle. This uses the perf_counter_overflow() quick disable to throttle a specific counter when its going too fast when a pmu->unthrottle() method is provided which can undo the quick disable. Power needs to implement both the quick disable and the unthrottle method. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: John Kacur <jkacur@redhat.com> LKML-Reference: <20090525153931.703093461@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
48e22d56ec
commit
a78ac32587
@@ -623,6 +623,18 @@ try_generic:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void x86_pmu_unthrottle(struct perf_counter *counter)
|
||||
{
|
||||
struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
|
||||
struct hw_perf_counter *hwc = &counter->hw;
|
||||
|
||||
if (WARN_ON_ONCE(hwc->idx >= X86_PMC_IDX_MAX ||
|
||||
cpuc->counters[hwc->idx] != counter))
|
||||
return;
|
||||
|
||||
x86_pmu.enable(hwc, hwc->idx);
|
||||
}
|
||||
|
||||
void perf_counter_print_debug(void)
|
||||
{
|
||||
u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;
|
||||
@@ -1038,6 +1050,7 @@ static const struct pmu pmu = {
|
||||
.enable = x86_pmu_enable,
|
||||
.disable = x86_pmu_disable,
|
||||
.read = x86_pmu_read,
|
||||
.unthrottle = x86_pmu_unthrottle,
|
||||
};
|
||||
|
||||
const struct pmu *hw_perf_counter_init(struct perf_counter *counter)
|
||||
|
Reference in New Issue
Block a user