diff options
author | Robert Richter <robert.richter@amd.com> | 2011-02-02 11:36:12 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-02-16 07:30:53 -0500 |
commit | 4979d2729af22f6ce8faa325fc60a85a2c2daa02 (patch) | |
tree | 5c08ce1b206375eb457f1d467f5eeac6981c8954 /arch/x86/kernel/cpu/perf_event.c | |
parent | 73d6e52206a20354738418625cedc244cbfd5023 (diff) |
perf, x86: Add support for AMD family 15h core counters
This patch adds support for AMD family 15h core counters. There are
major changes compared to family 10h. First, there is a new perfctr
msr range for up to 6 counters. Northbridge counters are separate
now. This patch only adds support for core counters. Second, certain
events may only be scheduled on certain counters. For this we need to
extend the event scheduling and constraints.
We use cpu feature flags to calculate family 15h msr address offsets.
This way we later can implement a faster ALTERNATIVE() version for
this.
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20110215135210.GB5874@erda.amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event.c')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 316194330da..10bfe2472d1 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -321,14 +321,22 @@ again: | |||
321 | return new_raw_count; | 321 | return new_raw_count; |
322 | } | 322 | } |
323 | 323 | ||
324 | /* using X86_FEATURE_PERFCTR_CORE to later implement ALTERNATIVE() here */ | ||
325 | static inline int x86_pmu_addr_offset(int index) | ||
326 | { | ||
327 | if (boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) | ||
328 | return index << 1; | ||
329 | return index; | ||
330 | } | ||
331 | |||
324 | static inline unsigned int x86_pmu_config_addr(int index) | 332 | static inline unsigned int x86_pmu_config_addr(int index) |
325 | { | 333 | { |
326 | return x86_pmu.eventsel + index; | 334 | return x86_pmu.eventsel + x86_pmu_addr_offset(index); |
327 | } | 335 | } |
328 | 336 | ||
329 | static inline unsigned int x86_pmu_event_addr(int index) | 337 | static inline unsigned int x86_pmu_event_addr(int index) |
330 | { | 338 | { |
331 | return x86_pmu.perfctr + index; | 339 | return x86_pmu.perfctr + x86_pmu_addr_offset(index); |
332 | } | 340 | } |
333 | 341 | ||
334 | static atomic_t active_events; | 342 | static atomic_t active_events; |