diff options
author | Andi Kleen <ak@linux.intel.com> | 2013-06-17 20:36:49 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-06-19 08:43:33 -0400 |
commit | 3044318f1f3a2a0a636b4c751ddb7169cb1b11b2 (patch) | |
tree | 704f1421c4862e7182764ddb668a7eba6d89146c | |
parent | 3a632cb229bfb18b6d09822cc842451ea46c013e (diff) |
perf/x86/intel: Add Haswell PEBS support
Add simple PEBS support for Haswell.
The constraints are similar to SandyBridge with a few new
events.
Reviewed-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Cc: Andi Kleen <ak@linux.jf.intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: http://lkml.kernel.org/r/1371515812-9646-4-git-send-email-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel_ds.c | 36 |
3 files changed, 42 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index 259ac3fddd9e..fb7fe44e6b96 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -636,6 +636,8 @@ extern struct event_constraint intel_snb_pebs_event_constraints[]; | |||
636 | 636 | ||
637 | extern struct event_constraint intel_ivb_pebs_event_constraints[]; | 637 | extern struct event_constraint intel_ivb_pebs_event_constraints[]; |
638 | 638 | ||
639 | extern struct event_constraint intel_hsw_pebs_event_constraints[]; | ||
640 | |||
639 | struct event_constraint *intel_pebs_constraints(struct perf_event *event); | 641 | struct event_constraint *intel_pebs_constraints(struct perf_event *event); |
640 | 642 | ||
641 | void intel_pmu_pebs_enable(struct perf_event *event); | 643 | void intel_pmu_pebs_enable(struct perf_event *event); |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 4e995af0d384..4a4c4ba0c1d7 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -889,7 +889,8 @@ static inline bool intel_pmu_needs_lbr_smpl(struct perf_event *event) | |||
889 | return true; | 889 | return true; |
890 | 890 | ||
891 | /* implicit branch sampling to correct PEBS skid */ | 891 | /* implicit branch sampling to correct PEBS skid */ |
892 | if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1) | 892 | if (x86_pmu.intel_cap.pebs_trap && event->attr.precise_ip > 1 && |
893 | x86_pmu.intel_cap.pebs_format < 2) | ||
893 | return true; | 894 | return true; |
894 | 895 | ||
895 | return false; | 896 | return false; |
@@ -2265,8 +2266,9 @@ __init int intel_pmu_init(void) | |||
2265 | intel_pmu_lbr_init_snb(); | 2266 | intel_pmu_lbr_init_snb(); |
2266 | 2267 | ||
2267 | x86_pmu.event_constraints = intel_hsw_event_constraints; | 2268 | x86_pmu.event_constraints = intel_hsw_event_constraints; |
2268 | 2269 | x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints; | |
2269 | x86_pmu.extra_regs = intel_snb_extra_regs; | 2270 | x86_pmu.extra_regs = intel_snb_extra_regs; |
2271 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | ||
2270 | /* all extra regs are per-cpu when HT is on */ | 2272 | /* all extra regs are per-cpu when HT is on */ |
2271 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | 2273 | x86_pmu.er_flags |= ERF_HAS_RSP_1; |
2272 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | 2274 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; |
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c index 2a63d1307804..e83148ffe392 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c | |||
@@ -564,6 +564,42 @@ struct event_constraint intel_ivb_pebs_event_constraints[] = { | |||
564 | EVENT_CONSTRAINT_END | 564 | EVENT_CONSTRAINT_END |
565 | }; | 565 | }; |
566 | 566 | ||
567 | struct event_constraint intel_hsw_pebs_event_constraints[] = { | ||
568 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ | ||
569 | INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ | ||
570 | INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */ | ||
571 | INTEL_EVENT_CONSTRAINT(0xc4, 0xf), /* BR_INST_RETIRED.* */ | ||
572 | INTEL_UEVENT_CONSTRAINT(0x01c5, 0xf), /* BR_MISP_RETIRED.CONDITIONAL */ | ||
573 | INTEL_UEVENT_CONSTRAINT(0x04c5, 0xf), /* BR_MISP_RETIRED.ALL_BRANCHES */ | ||
574 | INTEL_UEVENT_CONSTRAINT(0x20c5, 0xf), /* BR_MISP_RETIRED.NEAR_TAKEN */ | ||
575 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.* */ | ||
576 | /* MEM_UOPS_RETIRED.STLB_MISS_LOADS */ | ||
577 | INTEL_UEVENT_CONSTRAINT(0x11d0, 0xf), | ||
578 | /* MEM_UOPS_RETIRED.STLB_MISS_STORES */ | ||
579 | INTEL_UEVENT_CONSTRAINT(0x12d0, 0xf), | ||
580 | INTEL_UEVENT_CONSTRAINT(0x21d0, 0xf), /* MEM_UOPS_RETIRED.LOCK_LOADS */ | ||
581 | INTEL_UEVENT_CONSTRAINT(0x41d0, 0xf), /* MEM_UOPS_RETIRED.SPLIT_LOADS */ | ||
582 | /* MEM_UOPS_RETIRED.SPLIT_STORES */ | ||
583 | INTEL_UEVENT_CONSTRAINT(0x42d0, 0xf), | ||
584 | INTEL_UEVENT_CONSTRAINT(0x81d0, 0xf), /* MEM_UOPS_RETIRED.ALL_LOADS */ | ||
585 | INTEL_UEVENT_CONSTRAINT(0x82d0, 0xf), /* MEM_UOPS_RETIRED.ALL_STORES */ | ||
586 | INTEL_UEVENT_CONSTRAINT(0x01d1, 0xf), /* MEM_LOAD_UOPS_RETIRED.L1_HIT */ | ||
587 | INTEL_UEVENT_CONSTRAINT(0x02d1, 0xf), /* MEM_LOAD_UOPS_RETIRED.L2_HIT */ | ||
588 | INTEL_UEVENT_CONSTRAINT(0x04d1, 0xf), /* MEM_LOAD_UOPS_RETIRED.L3_HIT */ | ||
589 | /* MEM_LOAD_UOPS_RETIRED.HIT_LFB */ | ||
590 | INTEL_UEVENT_CONSTRAINT(0x40d1, 0xf), | ||
591 | /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS */ | ||
592 | INTEL_UEVENT_CONSTRAINT(0x01d2, 0xf), | ||
593 | /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HIT */ | ||
594 | INTEL_UEVENT_CONSTRAINT(0x02d2, 0xf), | ||
595 | /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.LOCAL_DRAM */ | ||
596 | INTEL_UEVENT_CONSTRAINT(0x01d3, 0xf), | ||
597 | INTEL_UEVENT_CONSTRAINT(0x04c8, 0xf), /* HLE_RETIRED.Abort */ | ||
598 | INTEL_UEVENT_CONSTRAINT(0x04c9, 0xf), /* RTM_RETIRED.Abort */ | ||
599 | |||
600 | EVENT_CONSTRAINT_END | ||
601 | }; | ||
602 | |||
567 | struct event_constraint *intel_pebs_constraints(struct perf_event *event) | 603 | struct event_constraint *intel_pebs_constraints(struct perf_event *event) |
568 | { | 604 | { |
569 | struct event_constraint *c; | 605 | struct event_constraint *c; |