aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/perf_event_intel_lbr.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-03-03 11:07:40 -0500
committerIngo Molnar <mingo@elte.hu>2010-03-10 07:23:33 -0500
commit8db909a7e3c888b5d45aef7650d74ccebe3ce725 (patch)
tree1f930572b6468fa212f599285e2de772aefdd361 /arch/x86/kernel/cpu/perf_event_intel_lbr.c
parent1676b8a077c352085d52578fb4f29350b58b6e74 (diff)
perf, x86: Clean up IA32_PERF_CAPABILITIES usage
Saner PERF_CAPABILITIES support, which also exposes pebs_trap. Use that latter to make PEBS's use of LBR conditional since a fault-like pebs should already report the correct IP. ( As of this writing there is no known hardware that implements !pebs_trap ) Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: paulus@samba.org Cc: eranian@google.com Cc: robert.richter@amd.com Cc: fweisbec@gmail.com LKML-Reference: <20100304140100.770650663@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event_intel_lbr.c')
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index ea3e99ed82ce..4f3a124329c4 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -53,7 +53,7 @@ static void intel_pmu_lbr_reset_64(void)
53 53
54static void intel_pmu_lbr_reset(void) 54static void intel_pmu_lbr_reset(void)
55{ 55{
56 if (x86_pmu.lbr_format == LBR_FORMAT_32) 56 if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_32)
57 intel_pmu_lbr_reset_32(); 57 intel_pmu_lbr_reset_32();
58 else 58 else
59 intel_pmu_lbr_reset_64(); 59 intel_pmu_lbr_reset_64();
@@ -155,6 +155,7 @@ static void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc)
155static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc) 155static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
156{ 156{
157 unsigned long mask = x86_pmu.lbr_nr - 1; 157 unsigned long mask = x86_pmu.lbr_nr - 1;
158 int lbr_format = x86_pmu.intel_cap.lbr_format;
158 u64 tos = intel_pmu_lbr_tos(); 159 u64 tos = intel_pmu_lbr_tos();
159 int i; 160 int i;
160 161
@@ -165,7 +166,7 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
165 rdmsrl(x86_pmu.lbr_from + lbr_idx, from); 166 rdmsrl(x86_pmu.lbr_from + lbr_idx, from);
166 rdmsrl(x86_pmu.lbr_to + lbr_idx, to); 167 rdmsrl(x86_pmu.lbr_to + lbr_idx, to);
167 168
168 if (x86_pmu.lbr_format == LBR_FORMAT_EIP_FLAGS) { 169 if (lbr_format == LBR_FORMAT_EIP_FLAGS) {
169 flags = !!(from & LBR_FROM_FLAG_MISPRED); 170 flags = !!(from & LBR_FROM_FLAG_MISPRED);
170 from = (u64)((((s64)from) << 1) >> 1); 171 from = (u64)((((s64)from) << 1) >> 1);
171 } 172 }
@@ -184,23 +185,14 @@ static void intel_pmu_lbr_read(void)
184 if (!cpuc->lbr_users) 185 if (!cpuc->lbr_users)
185 return; 186 return;
186 187
187 if (x86_pmu.lbr_format == LBR_FORMAT_32) 188 if (x86_pmu.intel_cap.lbr_format == LBR_FORMAT_32)
188 intel_pmu_lbr_read_32(cpuc); 189 intel_pmu_lbr_read_32(cpuc);
189 else 190 else
190 intel_pmu_lbr_read_64(cpuc); 191 intel_pmu_lbr_read_64(cpuc);
191} 192}
192 193
193static int intel_pmu_lbr_format(void)
194{
195 u64 capabilities;
196
197 rdmsrl(MSR_IA32_PERF_CAPABILITIES, capabilities);
198 return capabilities & 0x1f;
199}
200
201static void intel_pmu_lbr_init_core(void) 194static void intel_pmu_lbr_init_core(void)
202{ 195{
203 x86_pmu.lbr_format = intel_pmu_lbr_format();
204 x86_pmu.lbr_nr = 4; 196 x86_pmu.lbr_nr = 4;
205 x86_pmu.lbr_tos = 0x01c9; 197 x86_pmu.lbr_tos = 0x01c9;
206 x86_pmu.lbr_from = 0x40; 198 x86_pmu.lbr_from = 0x40;
@@ -209,7 +201,6 @@ static void intel_pmu_lbr_init_core(void)
209 201
210static void intel_pmu_lbr_init_nhm(void) 202static void intel_pmu_lbr_init_nhm(void)
211{ 203{
212 x86_pmu.lbr_format = intel_pmu_lbr_format();
213 x86_pmu.lbr_nr = 16; 204 x86_pmu.lbr_nr = 16;
214 x86_pmu.lbr_tos = 0x01c9; 205 x86_pmu.lbr_tos = 0x01c9;
215 x86_pmu.lbr_from = 0x680; 206 x86_pmu.lbr_from = 0x680;
@@ -218,7 +209,6 @@ static void intel_pmu_lbr_init_nhm(void)
218 209
219static void intel_pmu_lbr_init_atom(void) 210static void intel_pmu_lbr_init_atom(void)
220{ 211{
221 x86_pmu.lbr_format = intel_pmu_lbr_format();
222 x86_pmu.lbr_nr = 8; 212 x86_pmu.lbr_nr = 8;
223 x86_pmu.lbr_tos = 0x01c9; 213 x86_pmu.lbr_tos = 0x01c9;
224 x86_pmu.lbr_from = 0x40; 214 x86_pmu.lbr_from = 0x40;