diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2009-06-08 16:33:10 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2009-06-08 17:10:37 -0400 |
| commit | f86748e91a14bd6cc49477560f33ed5d59896e89 (patch) | |
| tree | 4c77717a4e050f7e5b7a5ead8eb31c5e219cc0d7 | |
| parent | 1123e3ad73697d64ad99f0104bbe49f8b52d7d65 (diff) | |
perf_counter, x86: Implement generalized cache event types, add AMD support
Fill in amd_hw_cache_event_id[] with the AMD CPU specific events,
for family 0x0f, 0x10 and 0x11.
There's apparently no distinction between load and store events, so
we only fill in the load events.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
| -rw-r--r-- | arch/x86/kernel/cpu/perf_counter.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c index 0339d195a3f0..93af821ebe51 100644 --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c | |||
| @@ -389,6 +389,97 @@ static u64 intel_pmu_raw_event(u64 event) | |||
| 389 | return event & CORE_EVNTSEL_MASK; | 389 | return event & CORE_EVNTSEL_MASK; |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | static const u64 amd_0f_hw_cache_event_ids | ||
| 393 | [PERF_COUNT_HW_CACHE_MAX] | ||
| 394 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
| 395 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
| 396 | { | ||
| 397 | [ C(L1D) ] = { | ||
| 398 | [ C(OP_READ) ] = { | ||
| 399 | [ C(RESULT_ACCESS) ] = 0, | ||
| 400 | [ C(RESULT_MISS) ] = 0, | ||
| 401 | }, | ||
| 402 | [ C(OP_WRITE) ] = { | ||
| 403 | [ C(RESULT_ACCESS) ] = 0, | ||
| 404 | [ C(RESULT_MISS) ] = 0, | ||
| 405 | }, | ||
| 406 | [ C(OP_PREFETCH) ] = { | ||
| 407 | [ C(RESULT_ACCESS) ] = 0, | ||
| 408 | [ C(RESULT_MISS) ] = 0, | ||
| 409 | }, | ||
| 410 | }, | ||
| 411 | [ C(L1I ) ] = { | ||
| 412 | [ C(OP_READ) ] = { | ||
| 413 | [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction cache fetches */ | ||
| 414 | [ C(RESULT_MISS) ] = 0x0081, /* Instruction cache misses */ | ||
| 415 | }, | ||
| 416 | [ C(OP_WRITE) ] = { | ||
| 417 | [ C(RESULT_ACCESS) ] = -1, | ||
| 418 | [ C(RESULT_MISS) ] = -1, | ||
| 419 | }, | ||
| 420 | [ C(OP_PREFETCH) ] = { | ||
| 421 | [ C(RESULT_ACCESS) ] = 0, | ||
| 422 | [ C(RESULT_MISS) ] = 0, | ||
| 423 | }, | ||
| 424 | }, | ||
| 425 | [ C(L2 ) ] = { | ||
| 426 | [ C(OP_READ) ] = { | ||
| 427 | [ C(RESULT_ACCESS) ] = 0, | ||
| 428 | [ C(RESULT_MISS) ] = 0, | ||
| 429 | }, | ||
| 430 | [ C(OP_WRITE) ] = { | ||
| 431 | [ C(RESULT_ACCESS) ] = 0, | ||
| 432 | [ C(RESULT_MISS) ] = 0, | ||
| 433 | }, | ||
| 434 | [ C(OP_PREFETCH) ] = { | ||
| 435 | [ C(RESULT_ACCESS) ] = 0, | ||
| 436 | [ C(RESULT_MISS) ] = 0, | ||
| 437 | }, | ||
| 438 | }, | ||
| 439 | [ C(DTLB) ] = { | ||
| 440 | [ C(OP_READ) ] = { | ||
| 441 | [ C(RESULT_ACCESS) ] = 0, | ||
| 442 | [ C(RESULT_MISS) ] = 0, | ||
| 443 | }, | ||
| 444 | [ C(OP_WRITE) ] = { | ||
| 445 | [ C(RESULT_ACCESS) ] = 0, | ||
| 446 | [ C(RESULT_MISS) ] = 0, | ||
| 447 | }, | ||
| 448 | [ C(OP_PREFETCH) ] = { | ||
| 449 | [ C(RESULT_ACCESS) ] = 0, | ||
| 450 | [ C(RESULT_MISS) ] = 0, | ||
| 451 | }, | ||
| 452 | }, | ||
| 453 | [ C(ITLB) ] = { | ||
| 454 | [ C(OP_READ) ] = { | ||
| 455 | [ C(RESULT_ACCESS) ] = 0x0080, /* Instruction fecthes */ | ||
| 456 | [ C(RESULT_MISS) ] = 0x0085, /* Instr. fetch ITLB misses */ | ||
| 457 | }, | ||
| 458 | [ C(OP_WRITE) ] = { | ||
| 459 | [ C(RESULT_ACCESS) ] = -1, | ||
| 460 | [ C(RESULT_MISS) ] = -1, | ||
| 461 | }, | ||
| 462 | [ C(OP_PREFETCH) ] = { | ||
| 463 | [ C(RESULT_ACCESS) ] = -1, | ||
| 464 | [ C(RESULT_MISS) ] = -1, | ||
| 465 | }, | ||
| 466 | }, | ||
| 467 | [ C(BPU ) ] = { | ||
| 468 | [ C(OP_READ) ] = { | ||
| 469 | [ C(RESULT_ACCESS) ] = 0x00c2, /* Retired Branch Instr. */ | ||
| 470 | [ C(RESULT_MISS) ] = 0x00c3, /* Retired Mispredicted BI */ | ||
| 471 | }, | ||
| 472 | [ C(OP_WRITE) ] = { | ||
| 473 | [ C(RESULT_ACCESS) ] = -1, | ||
| 474 | [ C(RESULT_MISS) ] = -1, | ||
| 475 | }, | ||
| 476 | [ C(OP_PREFETCH) ] = { | ||
| 477 | [ C(RESULT_ACCESS) ] = -1, | ||
| 478 | [ C(RESULT_MISS) ] = -1, | ||
| 479 | }, | ||
| 480 | }, | ||
| 481 | }; | ||
| 482 | |||
| 392 | /* | 483 | /* |
| 393 | * AMD Performance Monitor K7 and later. | 484 | * AMD Performance Monitor K7 and later. |
| 394 | */ | 485 | */ |
| @@ -1345,6 +1436,17 @@ static int intel_pmu_init(void) | |||
| 1345 | static int amd_pmu_init(void) | 1436 | static int amd_pmu_init(void) |
| 1346 | { | 1437 | { |
| 1347 | x86_pmu = amd_pmu; | 1438 | x86_pmu = amd_pmu; |
| 1439 | |||
| 1440 | switch (boot_cpu_data.x86) { | ||
| 1441 | case 0x0f: | ||
| 1442 | case 0x10: | ||
| 1443 | case 0x11: | ||
| 1444 | memcpy(hw_cache_event_ids, amd_0f_hw_cache_event_ids, | ||
| 1445 | sizeof(hw_cache_event_ids)); | ||
| 1446 | |||
| 1447 | pr_cont("AMD Family 0f/10/11 events, "); | ||
| 1448 | break; | ||
| 1449 | } | ||
| 1348 | return 0; | 1450 | return 0; |
| 1349 | } | 1451 | } |
| 1350 | 1452 | ||
