aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-05-25 11:39:05 -0400
committerIngo Molnar <mingo@elte.hu>2009-05-25 15:41:12 -0400
commita78ac3258782f3e64cb40beb5990808e1febcc0c (patch)
tree692462a974e4c26bdb7fa7fae727a6b326a0eeee /arch/x86/kernel
parent48e22d56ecdeddd1ffb42a02fccba5c6ef42b133 (diff)
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>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/cpu/perf_counter.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 8c8177f859fe..c4b543d1a86f 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -623,6 +623,18 @@ try_generic:
623 return 0; 623 return 0;
624} 624}
625 625
626static void x86_pmu_unthrottle(struct perf_counter *counter)
627{
628 struct cpu_hw_counters *cpuc = &__get_cpu_var(cpu_hw_counters);
629 struct hw_perf_counter *hwc = &counter->hw;
630
631 if (WARN_ON_ONCE(hwc->idx >= X86_PMC_IDX_MAX ||
632 cpuc->counters[hwc->idx] != counter))
633 return;
634
635 x86_pmu.enable(hwc, hwc->idx);
636}
637
626void perf_counter_print_debug(void) 638void perf_counter_print_debug(void)
627{ 639{
628 u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed; 640 u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;
@@ -1038,6 +1050,7 @@ static const struct pmu pmu = {
1038 .enable = x86_pmu_enable, 1050 .enable = x86_pmu_enable,
1039 .disable = x86_pmu_disable, 1051 .disable = x86_pmu_disable,
1040 .read = x86_pmu_read, 1052 .read = x86_pmu_read,
1053 .unthrottle = x86_pmu_unthrottle,
1041}; 1054};
1042 1055
1043const struct pmu *hw_perf_counter_init(struct perf_counter *counter) 1056const struct pmu *hw_perf_counter_init(struct perf_counter *counter)