aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-01-27 17:07:48 -0500
committerIngo Molnar <mingo@elte.hu>2010-01-29 03:01:48 -0500
commit452a339a976e7f782c786eb3f73080401e2fa3a6 (patch)
tree194e93ccfe656202fa777bf005ea6130f0581d44 /arch
parent1a6e21f791fe85b40a9ddbafe999ab8ccffc3f78 (diff)
perf_events, x86: Implement Intel Westmere support
The new Intel documentation includes Westmere arch specific event maps that are significantly different from the Nehalem ones. Add support for this generation. Found the CPUID model numbers on wikipedia. Also ammend some Nehalem constraints, spotted those when looking for the differences between Nehalem and Westmere. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <20100127221122.151865645@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c124
1 files changed, 117 insertions, 7 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index cf10839f20ea..3fac0bfc2dee 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -244,18 +244,26 @@ static struct event_constraint intel_core_event_constraints[] =
244 244
245static struct event_constraint intel_nehalem_event_constraints[] = 245static struct event_constraint intel_nehalem_event_constraints[] =
246{ 246{
247 FIXED_EVENT_CONSTRAINT(0xc0, (0x3|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */ 247 FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
248 FIXED_EVENT_CONSTRAINT(0x3c, (0x3|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */ 248 FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
249 INTEL_EVENT_CONSTRAINT(0x40, 0x3), /* L1D_CACHE_LD */ 249 INTEL_EVENT_CONSTRAINT(0x40, 0x3), /* L1D_CACHE_LD */
250 INTEL_EVENT_CONSTRAINT(0x41, 0x3), /* L1D_CACHE_ST */ 250 INTEL_EVENT_CONSTRAINT(0x41, 0x3), /* L1D_CACHE_ST */
251 INTEL_EVENT_CONSTRAINT(0x42, 0x3), /* L1D_CACHE_LOCK */ 251 INTEL_EVENT_CONSTRAINT(0x42, 0x3), /* L1D_CACHE_LOCK */
252 INTEL_EVENT_CONSTRAINT(0x43, 0x3), /* L1D_ALL_REF */ 252 INTEL_EVENT_CONSTRAINT(0x43, 0x3), /* L1D_ALL_REF */
253 INTEL_EVENT_CONSTRAINT(0x48, 0x3), /* L1D_PEND_MISS */
253 INTEL_EVENT_CONSTRAINT(0x4e, 0x3), /* L1D_PREFETCH */ 254 INTEL_EVENT_CONSTRAINT(0x4e, 0x3), /* L1D_PREFETCH */
254 INTEL_EVENT_CONSTRAINT(0x4c, 0x3), /* LOAD_HIT_PRE */
255 INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */ 255 INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
256 INTEL_EVENT_CONSTRAINT(0x52, 0x3), /* L1D_CACHE_PREFETCH_LOCK_FB_HIT */ 256 INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
257 INTEL_EVENT_CONSTRAINT(0x53, 0x3), /* L1D_CACHE_LOCK_FB_HIT */ 257 EVENT_CONSTRAINT_END
258 INTEL_EVENT_CONSTRAINT(0xc5, 0x3), /* CACHE_LOCK_CYCLES */ 258};
259
260static struct event_constraint intel_westmere_event_constraints[] =
261{
262 FIXED_EVENT_CONSTRAINT(0xc0, (0xf|(1ULL<<32))), /* INSTRUCTIONS_RETIRED */
263 FIXED_EVENT_CONSTRAINT(0x3c, (0xf|(1ULL<<33))), /* UNHALTED_CORE_CYCLES */
264 INTEL_EVENT_CONSTRAINT(0x51, 0x3), /* L1D */
265 INTEL_EVENT_CONSTRAINT(0x60, 0x1), /* OFFCORE_REQUESTS_OUTSTANDING */
266 INTEL_EVENT_CONSTRAINT(0x63, 0x3), /* CACHE_LOCK_CYCLES */
259 EVENT_CONSTRAINT_END 267 EVENT_CONSTRAINT_END
260}; 268};
261 269
@@ -286,6 +294,97 @@ static u64 __read_mostly hw_cache_event_ids
286 [PERF_COUNT_HW_CACHE_OP_MAX] 294 [PERF_COUNT_HW_CACHE_OP_MAX]
287 [PERF_COUNT_HW_CACHE_RESULT_MAX]; 295 [PERF_COUNT_HW_CACHE_RESULT_MAX];
288 296
297static __initconst u64 westmere_hw_cache_event_ids
298 [PERF_COUNT_HW_CACHE_MAX]
299 [PERF_COUNT_HW_CACHE_OP_MAX]
300 [PERF_COUNT_HW_CACHE_RESULT_MAX] =
301{
302 [ C(L1D) ] = {
303 [ C(OP_READ) ] = {
304 [ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS */
305 [ C(RESULT_MISS) ] = 0x0151, /* L1D.REPL */
306 },
307 [ C(OP_WRITE) ] = {
308 [ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES */
309 [ C(RESULT_MISS) ] = 0x0251, /* L1D.M_REPL */
310 },
311 [ C(OP_PREFETCH) ] = {
312 [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS */
313 [ C(RESULT_MISS) ] = 0x024e, /* L1D_PREFETCH.MISS */
314 },
315 },
316 [ C(L1I ) ] = {
317 [ C(OP_READ) ] = {
318 [ C(RESULT_ACCESS) ] = 0x0380, /* L1I.READS */
319 [ C(RESULT_MISS) ] = 0x0280, /* L1I.MISSES */
320 },
321 [ C(OP_WRITE) ] = {
322 [ C(RESULT_ACCESS) ] = -1,
323 [ C(RESULT_MISS) ] = -1,
324 },
325 [ C(OP_PREFETCH) ] = {
326 [ C(RESULT_ACCESS) ] = 0x0,
327 [ C(RESULT_MISS) ] = 0x0,
328 },
329 },
330 [ C(LL ) ] = {
331 [ C(OP_READ) ] = {
332 [ C(RESULT_ACCESS) ] = 0x0324, /* L2_RQSTS.LOADS */
333 [ C(RESULT_MISS) ] = 0x0224, /* L2_RQSTS.LD_MISS */
334 },
335 [ C(OP_WRITE) ] = {
336 [ C(RESULT_ACCESS) ] = 0x0c24, /* L2_RQSTS.RFOS */
337 [ C(RESULT_MISS) ] = 0x0824, /* L2_RQSTS.RFO_MISS */
338 },
339 [ C(OP_PREFETCH) ] = {
340 [ C(RESULT_ACCESS) ] = 0x4f2e, /* LLC Reference */
341 [ C(RESULT_MISS) ] = 0x412e, /* LLC Misses */
342 },
343 },
344 [ C(DTLB) ] = {
345 [ C(OP_READ) ] = {
346 [ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS */
347 [ C(RESULT_MISS) ] = 0x0108, /* DTLB_LOAD_MISSES.ANY */
348 },
349 [ C(OP_WRITE) ] = {
350 [ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES */
351 [ C(RESULT_MISS) ] = 0x010c, /* MEM_STORE_RETIRED.DTLB_MISS */
352 },
353 [ C(OP_PREFETCH) ] = {
354 [ C(RESULT_ACCESS) ] = 0x0,
355 [ C(RESULT_MISS) ] = 0x0,
356 },
357 },
358 [ C(ITLB) ] = {
359 [ C(OP_READ) ] = {
360 [ C(RESULT_ACCESS) ] = 0x01c0, /* INST_RETIRED.ANY_P */
361 [ C(RESULT_MISS) ] = 0x0185, /* ITLB_MISSES.ANY */
362 },
363 [ C(OP_WRITE) ] = {
364 [ C(RESULT_ACCESS) ] = -1,
365 [ C(RESULT_MISS) ] = -1,
366 },
367 [ C(OP_PREFETCH) ] = {
368 [ C(RESULT_ACCESS) ] = -1,
369 [ C(RESULT_MISS) ] = -1,
370 },
371 },
372 [ C(BPU ) ] = {
373 [ C(OP_READ) ] = {
374 [ C(RESULT_ACCESS) ] = 0x00c4, /* BR_INST_RETIRED.ALL_BRANCHES */
375 [ C(RESULT_MISS) ] = 0x03e8, /* BPU_CLEARS.ANY */
376 },
377 [ C(OP_WRITE) ] = {
378 [ C(RESULT_ACCESS) ] = -1,
379 [ C(RESULT_MISS) ] = -1,
380 },
381 [ C(OP_PREFETCH) ] = {
382 [ C(RESULT_ACCESS) ] = -1,
383 [ C(RESULT_MISS) ] = -1,
384 },
385 },
386};
387
289static __initconst u64 nehalem_hw_cache_event_ids 388static __initconst u64 nehalem_hw_cache_event_ids
290 [PERF_COUNT_HW_CACHE_MAX] 389 [PERF_COUNT_HW_CACHE_MAX]
291 [PERF_COUNT_HW_CACHE_OP_MAX] 390 [PERF_COUNT_HW_CACHE_OP_MAX]
@@ -2423,7 +2522,9 @@ static __init int intel_pmu_init(void)
2423 x86_pmu.event_constraints = intel_core_event_constraints; 2522 x86_pmu.event_constraints = intel_core_event_constraints;
2424 pr_cont("Core2 events, "); 2523 pr_cont("Core2 events, ");
2425 break; 2524 break;
2426 case 26: 2525
2526 case 26: /* 45 nm nehalem, "Bloomfield" */
2527 case 30: /* 45 nm nehalem, "Lynnfield" */
2427 memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids, 2528 memcpy(hw_cache_event_ids, nehalem_hw_cache_event_ids,
2428 sizeof(hw_cache_event_ids)); 2529 sizeof(hw_cache_event_ids));
2429 2530
@@ -2437,6 +2538,15 @@ static __init int intel_pmu_init(void)
2437 x86_pmu.event_constraints = intel_gen_event_constraints; 2538 x86_pmu.event_constraints = intel_gen_event_constraints;
2438 pr_cont("Atom events, "); 2539 pr_cont("Atom events, ");
2439 break; 2540 break;
2541
2542 case 37: /* 32 nm nehalem, "Clarkdale" */
2543 case 44: /* 32 nm nehalem, "Gulftown" */
2544 memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids,
2545 sizeof(hw_cache_event_ids));
2546
2547 x86_pmu.event_constraints = intel_westmere_event_constraints;
2548 pr_cont("Westmere events, ");
2549 break;
2440 default: 2550 default:
2441 /* 2551 /*
2442 * default constraints for v2 and up 2552 * default constraints for v2 and up