diff options
author | Maria Dimakopoulou <maria.n.dimakopoulou@gmail.com> | 2014-11-17 14:06:59 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-02 11:33:12 -0400 |
commit | 93fcf72cc0fa286aa8c3e11a1a8fd4659f0e27c0 (patch) | |
tree | 320f8623ec36dc19ccdb3c82077145c3cded647f | |
parent | e979121b1b1556e184492e6fc149bbe188fc83e6 (diff) |
perf/x86/intel: Enforce HT bug workaround for SNB/IVB/HSW
This patches activates the HT bug workaround for the
SNB/IVB/HSW processors. This covers non-PEBS mode.
Activation is done thru the constraint tables.
Both client and server processors needs this workaround.
Signed-off-by: Maria Dimakopoulou <maria.n.dimakopoulou@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Stephane Eranian <eranian@google.com>
Cc: bp@alien8.de
Cc: jolsa@redhat.com
Cc: kan.liang@intel.com
Link: http://lkml.kernel.org/r/1416251225-17721-8-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel.c | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 91cc7749d7ce..9350de0f5407 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -113,6 +113,12 @@ static struct event_constraint intel_snb_event_constraints[] __read_mostly = | |||
113 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ | 113 | INTEL_EVENT_CONSTRAINT(0xcd, 0x8), /* MEM_TRANS_RETIRED.LOAD_LATENCY */ |
114 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), /* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */ | 114 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), /* CYCLE_ACTIVITY.CYCLES_NO_DISPATCH */ |
115 | INTEL_UEVENT_CONSTRAINT(0x02a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ | 115 | INTEL_UEVENT_CONSTRAINT(0x02a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ |
116 | |||
117 | INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOPS_RETIRED.* */ | ||
118 | INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ | ||
119 | INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | ||
120 | INTEL_EXCLEVT_CONSTRAINT(0xd3, 0xf), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */ | ||
121 | |||
116 | EVENT_CONSTRAINT_END | 122 | EVENT_CONSTRAINT_END |
117 | }; | 123 | }; |
118 | 124 | ||
@@ -131,15 +137,12 @@ static struct event_constraint intel_ivb_event_constraints[] __read_mostly = | |||
131 | INTEL_UEVENT_CONSTRAINT(0x08a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ | 137 | INTEL_UEVENT_CONSTRAINT(0x08a3, 0x4), /* CYCLE_ACTIVITY.CYCLES_L1D_PENDING */ |
132 | INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */ | 138 | INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4), /* CYCLE_ACTIVITY.STALLS_L1D_PENDING */ |
133 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ | 139 | INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PREC_DIST */ |
134 | /* | 140 | |
135 | * Errata BV98 -- MEM_*_RETIRED events can leak between counters of SMT | 141 | INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOPS_RETIRED.* */ |
136 | * siblings; disable these events because they can corrupt unrelated | 142 | INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ |
137 | * counters. | 143 | INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ |
138 | */ | 144 | INTEL_EXCLEVT_CONSTRAINT(0xd3, 0xf), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */ |
139 | INTEL_EVENT_CONSTRAINT(0xd0, 0x0), /* MEM_UOPS_RETIRED.* */ | 145 | |
140 | INTEL_EVENT_CONSTRAINT(0xd1, 0x0), /* MEM_LOAD_UOPS_RETIRED.* */ | ||
141 | INTEL_EVENT_CONSTRAINT(0xd2, 0x0), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | ||
142 | INTEL_EVENT_CONSTRAINT(0xd3, 0x0), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */ | ||
143 | EVENT_CONSTRAINT_END | 146 | EVENT_CONSTRAINT_END |
144 | }; | 147 | }; |
145 | 148 | ||
@@ -217,6 +220,12 @@ static struct event_constraint intel_hsw_event_constraints[] = { | |||
217 | INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4), | 220 | INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4), |
218 | /* CYCLE_ACTIVITY.CYCLES_NO_EXECUTE */ | 221 | /* CYCLE_ACTIVITY.CYCLES_NO_EXECUTE */ |
219 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), | 222 | INTEL_UEVENT_CONSTRAINT(0x04a3, 0xf), |
223 | |||
224 | INTEL_EXCLEVT_CONSTRAINT(0xd0, 0xf), /* MEM_UOPS_RETIRED.* */ | ||
225 | INTEL_EXCLEVT_CONSTRAINT(0xd1, 0xf), /* MEM_LOAD_UOPS_RETIRED.* */ | ||
226 | INTEL_EXCLEVT_CONSTRAINT(0xd2, 0xf), /* MEM_LOAD_UOPS_LLC_HIT_RETIRED.* */ | ||
227 | INTEL_EXCLEVT_CONSTRAINT(0xd3, 0xf), /* MEM_LOAD_UOPS_LLC_MISS_RETIRED.* */ | ||
228 | |||
220 | EVENT_CONSTRAINT_END | 229 | EVENT_CONSTRAINT_END |
221 | }; | 230 | }; |
222 | 231 | ||
@@ -2865,6 +2874,27 @@ static __init void intel_nehalem_quirk(void) | |||
2865 | } | 2874 | } |
2866 | } | 2875 | } |
2867 | 2876 | ||
2877 | /* | ||
2878 | * enable software workaround for errata: | ||
2879 | * SNB: BJ122 | ||
2880 | * IVB: BV98 | ||
2881 | * HSW: HSD29 | ||
2882 | * | ||
2883 | * Only needed when HT is enabled. However detecting | ||
2884 | * this is too difficult and model specific so we enable | ||
2885 | * it even with HT off for now. | ||
2886 | */ | ||
2887 | static __init void intel_ht_bug(void) | ||
2888 | { | ||
2889 | x86_pmu.flags |= PMU_FL_EXCL_CNTRS; | ||
2890 | |||
2891 | x86_pmu.commit_scheduling = intel_commit_scheduling; | ||
2892 | x86_pmu.start_scheduling = intel_start_scheduling; | ||
2893 | x86_pmu.stop_scheduling = intel_stop_scheduling; | ||
2894 | |||
2895 | pr_info("CPU erratum BJ122, BV98, HSD29 worked around\n"); | ||
2896 | } | ||
2897 | |||
2868 | EVENT_ATTR_STR(mem-loads, mem_ld_hsw, "event=0xcd,umask=0x1,ldlat=3"); | 2898 | EVENT_ATTR_STR(mem-loads, mem_ld_hsw, "event=0xcd,umask=0x1,ldlat=3"); |
2869 | EVENT_ATTR_STR(mem-stores, mem_st_hsw, "event=0xd0,umask=0x82") | 2899 | EVENT_ATTR_STR(mem-stores, mem_st_hsw, "event=0xd0,umask=0x82") |
2870 | 2900 | ||
@@ -3079,6 +3109,7 @@ __init int intel_pmu_init(void) | |||
3079 | case 42: /* 32nm SandyBridge */ | 3109 | case 42: /* 32nm SandyBridge */ |
3080 | case 45: /* 32nm SandyBridge-E/EN/EP */ | 3110 | case 45: /* 32nm SandyBridge-E/EN/EP */ |
3081 | x86_add_quirk(intel_sandybridge_quirk); | 3111 | x86_add_quirk(intel_sandybridge_quirk); |
3112 | x86_add_quirk(intel_ht_bug); | ||
3082 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 3113 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
3083 | sizeof(hw_cache_event_ids)); | 3114 | sizeof(hw_cache_event_ids)); |
3084 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, | 3115 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, |
@@ -3093,6 +3124,8 @@ __init int intel_pmu_init(void) | |||
3093 | x86_pmu.extra_regs = intel_snbep_extra_regs; | 3124 | x86_pmu.extra_regs = intel_snbep_extra_regs; |
3094 | else | 3125 | else |
3095 | x86_pmu.extra_regs = intel_snb_extra_regs; | 3126 | x86_pmu.extra_regs = intel_snb_extra_regs; |
3127 | |||
3128 | |||
3096 | /* all extra regs are per-cpu when HT is on */ | 3129 | /* all extra regs are per-cpu when HT is on */ |
3097 | x86_pmu.flags |= PMU_FL_HAS_RSP_1; | 3130 | x86_pmu.flags |= PMU_FL_HAS_RSP_1; |
3098 | x86_pmu.flags |= PMU_FL_NO_HT_SHARING; | 3131 | x86_pmu.flags |= PMU_FL_NO_HT_SHARING; |
@@ -3111,6 +3144,7 @@ __init int intel_pmu_init(void) | |||
3111 | 3144 | ||
3112 | case 58: /* 22nm IvyBridge */ | 3145 | case 58: /* 22nm IvyBridge */ |
3113 | case 62: /* 22nm IvyBridge-EP/EX */ | 3146 | case 62: /* 22nm IvyBridge-EP/EX */ |
3147 | x86_add_quirk(intel_ht_bug); | ||
3114 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, | 3148 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, |
3115 | sizeof(hw_cache_event_ids)); | 3149 | sizeof(hw_cache_event_ids)); |
3116 | /* dTLB-load-misses on IVB is different than SNB */ | 3150 | /* dTLB-load-misses on IVB is different than SNB */ |
@@ -3146,6 +3180,7 @@ __init int intel_pmu_init(void) | |||
3146 | case 63: /* 22nm Haswell Server */ | 3180 | case 63: /* 22nm Haswell Server */ |
3147 | case 69: /* 22nm Haswell ULT */ | 3181 | case 69: /* 22nm Haswell ULT */ |
3148 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ | 3182 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ |
3183 | x86_add_quirk(intel_ht_bug); | ||
3149 | x86_pmu.late_ack = true; | 3184 | x86_pmu.late_ack = true; |
3150 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | 3185 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); |
3151 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); | 3186 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); |