aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2015-12-03 16:22:20 -0500
committerIngo Molnar <mingo@kernel.org>2016-01-06 05:15:31 -0500
commit01330d7288e0050c5aaabc558059ff91589e67cd (patch)
treeee228a018d1a61ec4e5ecfb334c1753725fc1f72
parent957ea1fdbcdb909e1540f06f06f1a9ce6e696efa (diff)
perf/x86: Allow zero PEBS status with only single active event
Normally we drop PEBS events with a zero status field. But when there is only a single PEBS event active we can assume the PEBS record is for that event. The PEBS buffer is always flushed when PEBS events are disabled, so there is no risk of mishandling state PEBS records this way. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Link: http://lkml.kernel.org/r/1449177740-5422-2-git-send-email-andi@firstfloor.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 0e3a9c73187d..cd1993e46d19 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -1230,6 +1230,18 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
1230 pebs_status = p->status & cpuc->pebs_enabled; 1230 pebs_status = p->status & cpuc->pebs_enabled;
1231 pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1; 1231 pebs_status &= (1ULL << x86_pmu.max_pebs_events) - 1;
1232 1232
1233 /*
1234 * On some CPUs the PEBS status can be zero when PEBS is
1235 * racing with clearing of GLOBAL_STATUS.
1236 *
1237 * Normally we would drop that record, but in the
1238 * case when there is only a single active PEBS event
1239 * we can assume it's for that event.
1240 */
1241 if (!pebs_status && cpuc->pebs_enabled &&
1242 !(cpuc->pebs_enabled & (cpuc->pebs_enabled-1)))
1243 pebs_status = cpuc->pebs_enabled;
1244
1233 bit = find_first_bit((unsigned long *)&pebs_status, 1245 bit = find_first_bit((unsigned long *)&pebs_status,
1234 x86_pmu.max_pebs_events); 1246 x86_pmu.max_pebs_events);
1235 if (bit >= x86_pmu.max_pebs_events) 1247 if (bit >= x86_pmu.max_pebs_events)