aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/events/intel/ds.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/arch/x86/events/intel/ds.c b/arch/x86/events/intel/ds.c
index d8015235ba76..5e526c54247e 100644
--- a/arch/x86/events/intel/ds.c
+++ b/arch/x86/events/intel/ds.c
@@ -1153,6 +1153,7 @@ static void setup_pebs_sample_data(struct perf_event *event,
1153 if (pebs == NULL) 1153 if (pebs == NULL)
1154 return; 1154 return;
1155 1155
1156 regs->flags &= ~PERF_EFLAGS_EXACT;
1156 sample_type = event->attr.sample_type; 1157 sample_type = event->attr.sample_type;
1157 dsrc = sample_type & PERF_SAMPLE_DATA_SRC; 1158 dsrc = sample_type & PERF_SAMPLE_DATA_SRC;
1158 1159
@@ -1197,7 +1198,6 @@ static void setup_pebs_sample_data(struct perf_event *event,
1197 */ 1198 */
1198 *regs = *iregs; 1199 *regs = *iregs;
1199 regs->flags = pebs->flags; 1200 regs->flags = pebs->flags;
1200 set_linear_ip(regs, pebs->ip);
1201 1201
1202 if (sample_type & PERF_SAMPLE_REGS_INTR) { 1202 if (sample_type & PERF_SAMPLE_REGS_INTR) {
1203 regs->ax = pebs->ax; 1203 regs->ax = pebs->ax;
@@ -1233,13 +1233,22 @@ static void setup_pebs_sample_data(struct perf_event *event,
1233#endif 1233#endif
1234 } 1234 }
1235 1235
1236 if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) { 1236 if (event->attr.precise_ip > 1) {
1237 regs->ip = pebs->real_ip; 1237 /* Haswell and later have the eventing IP, so use it: */
1238 regs->flags |= PERF_EFLAGS_EXACT; 1238 if (x86_pmu.intel_cap.pebs_format >= 2) {
1239 } else if (event->attr.precise_ip > 1 && intel_pmu_pebs_fixup_ip(regs)) 1239 set_linear_ip(regs, pebs->real_ip);
1240 regs->flags |= PERF_EFLAGS_EXACT; 1240 regs->flags |= PERF_EFLAGS_EXACT;
1241 else 1241 } else {
1242 regs->flags &= ~PERF_EFLAGS_EXACT; 1242 /* Otherwise use PEBS off-by-1 IP: */
1243 set_linear_ip(regs, pebs->ip);
1244
1245 /* ... and try to fix it up using the LBR entries: */
1246 if (intel_pmu_pebs_fixup_ip(regs))
1247 regs->flags |= PERF_EFLAGS_EXACT;
1248 }
1249 } else
1250 set_linear_ip(regs, pebs->ip);
1251
1243 1252
1244 if ((sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR)) && 1253 if ((sample_type & (PERF_SAMPLE_ADDR | PERF_SAMPLE_PHYS_ADDR)) &&
1245 x86_pmu.intel_cap.pebs_format >= 1) 1254 x86_pmu.intel_cap.pebs_format >= 1)