diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-12-22 05:10:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-12-23 06:45:25 -0500 |
commit | 2f18d1e8d07ae67dd0afce875287756d4bd31a46 (patch) | |
tree | bad96eb7e3330ac470b98d22ec7650da7b7b8910 /arch/x86/include/asm/perf_counter.h | |
parent | f650a672359819454c3d8d4135ecd1558cde0b24 (diff) |
x86, perfcounters: add support for fixed-function pmcs
Impact: extend performance counter support on x86 Intel CPUs
Modern Intel CPUs have 3 "fixed-function" performance counters, which
count these hardware events:
Instr_Retired.Any
CPU_CLK_Unhalted.Core
CPU_CLK_Unhalted.Ref
Add support for them to the performance counters subsystem.
Their use is transparent to user-space: the counter scheduler is
extended to automatically recognize the cases where a fixed-function
PMC can be utilized instead of a generic PMC. In such cases the
generic PMC is kept available for more counters.
The above fixed-function events map to these generic counter hw events:
PERF_COUNT_INSTRUCTIONS
PERF_COUNT_CPU_CYCLES
PERF_COUNT_BUS_CYCLES
(The 'bus' cycles are in reality often CPU-ish cycles, just with a fixed
frequency.)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/perf_counter.h')
-rw-r--r-- | arch/x86/include/asm/perf_counter.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/include/asm/perf_counter.h b/arch/x86/include/asm/perf_counter.h index 13745deb16c8..2e08ed736647 100644 --- a/arch/x86/include/asm/perf_counter.h +++ b/arch/x86/include/asm/perf_counter.h | |||
@@ -23,6 +23,11 @@ | |||
23 | #define ARCH_PERFMON_EVENTSEL_OS (1 << 17) | 23 | #define ARCH_PERFMON_EVENTSEL_OS (1 << 17) |
24 | #define ARCH_PERFMON_EVENTSEL_USR (1 << 16) | 24 | #define ARCH_PERFMON_EVENTSEL_USR (1 << 16) |
25 | 25 | ||
26 | /* | ||
27 | * Includes eventsel and unit mask as well: | ||
28 | */ | ||
29 | #define ARCH_PERFMON_EVENT_MASK 0xffff | ||
30 | |||
26 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c | 31 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c |
27 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) | 32 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) |
28 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0 | 33 | #define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0 |
@@ -69,12 +74,15 @@ union cpuid10_edx { | |||
69 | 74 | ||
70 | /* Instr_Retired.Any: */ | 75 | /* Instr_Retired.Any: */ |
71 | #define MSR_ARCH_PERFMON_FIXED_CTR0 0x309 | 76 | #define MSR_ARCH_PERFMON_FIXED_CTR0 0x309 |
77 | #define X86_PMC_IDX_FIXED_INSTRUCTIONS (X86_PMC_IDX_FIXED + 0) | ||
72 | 78 | ||
73 | /* CPU_CLK_Unhalted.Core: */ | 79 | /* CPU_CLK_Unhalted.Core: */ |
74 | #define MSR_ARCH_PERFMON_FIXED_CTR1 0x30a | 80 | #define MSR_ARCH_PERFMON_FIXED_CTR1 0x30a |
81 | #define X86_PMC_IDX_FIXED_CPU_CYCLES (X86_PMC_IDX_FIXED + 1) | ||
75 | 82 | ||
76 | /* CPU_CLK_Unhalted.Ref: */ | 83 | /* CPU_CLK_Unhalted.Ref: */ |
77 | #define MSR_ARCH_PERFMON_FIXED_CTR2 0x30b | 84 | #define MSR_ARCH_PERFMON_FIXED_CTR2 0x30b |
85 | #define X86_PMC_IDX_FIXED_BUS_CYCLES (X86_PMC_IDX_FIXED + 2) | ||
78 | 86 | ||
79 | #ifdef CONFIG_PERF_COUNTERS | 87 | #ifdef CONFIG_PERF_COUNTERS |
80 | extern void init_hw_perf_counters(void); | 88 | extern void init_hw_perf_counters(void); |