From: Peter Zijlstra <peterz@infradead.org>
To: Kan Liang <kan.liang@intel.com>
Cc: mingo@kernel.org, acme@infradead.org, eranian@google.com,
andi@firstfloor.org, linux-kernel@vger.kernel.org
Subject: [RFC][PATCH] perf, pebs: Add PEBS v3 record decoding
Date: Tue, 12 May 2015 15:25:57 +0200 [thread overview]
Message-ID: <20150512132557.GQ21418@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1431285195-14269-4-git-send-email-kan.liang@intel.com>
So seeing how I have both this series and Andi's SKL patches, I did the
below on top of them both.
Could someone try that?
---
Subject: perf, pebs: Add PEBS v3 record decoding
From: Peter Zijlstra <peterz@infradead.org>
Date: Tue May 12 15:18:18 CEST 2015
PEBS v3 as present on Skylake fixed the long standing issue of the
status bits. They now really reflect the events that generated the
record.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/kernel/cpu/perf_event_intel_ds.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -1034,6 +1034,9 @@ get_next_pebs_record_by_bit(void *base,
struct pebs_record_nhm *p = at;
if (test_bit(bit, (unsigned long *)&p->status)) {
+ /* PEBS v3 has accurate status bits */
+ if (x86_pmu.intel_cap.pebs_format >= 3)
+ return at;
if (p->status == (1 << bit))
return at;
@@ -1055,20 +1058,18 @@ static void __intel_pmu_pebs_event(struc
{
struct perf_sample_data data;
struct pt_regs regs;
- int i;
void *at = get_next_pebs_record_by_bit(base, top, bit);
if (!intel_pmu_save_and_restart(event) &&
!(event->hw.flags & PERF_X86_EVENT_AUTO_RELOAD))
return;
- if (count > 1) {
- for (i = 0; i < count - 1; i++) {
- setup_pebs_sample_data(event, iregs, at, &data, ®s);
- perf_event_output(event, &data, ®s);
- at += x86_pmu.pebs_record_size;
- at = get_next_pebs_record_by_bit(at, top, bit);
- }
+ while (count > 1) {
+ setup_pebs_sample_data(event, iregs, at, &data, ®s);
+ perf_event_output(event, &data, ®s);
+ at += x86_pmu.pebs_record_size;
+ at = get_next_pebs_record_by_bit(at, top, bit);
+ count--;
}
setup_pebs_sample_data(event, iregs, at, &data, ®s);
@@ -1124,9 +1125,9 @@ static void intel_pmu_drain_pebs_nhm(str
struct debug_store *ds = cpuc->ds;
struct perf_event *event;
void *base, *at, *top;
- int bit;
short counts[MAX_PEBS_EVENTS] = {};
short error[MAX_PEBS_EVENTS] = {};
+ int bit, i;
if (!x86_pmu.pebs_active)
return;
@@ -1142,6 +1143,15 @@ static void intel_pmu_drain_pebs_nhm(str
for (at = base; at < top; at += x86_pmu.pebs_record_size) {
struct pebs_record_nhm *p = at;
+ /* PEBS v3 has accurate status bits */
+ if (x86_pmu.intel_cap.pebs_format >= 3) {
+ for_each_set_bit(bit, (unsigned long *)&p->status,
+ MAX_PEBS_EVENTS)
+ counts[bit]++;
+
+ continue;
+ }
+
bit = find_first_bit((unsigned long *)&p->status,
x86_pmu.max_pebs_events);
if (bit >= x86_pmu.max_pebs_events)
@@ -1171,8 +1181,6 @@ static void intel_pmu_drain_pebs_nhm(str
pebs_status = p->status & cpuc->pebs_enabled;
pebs_status &= (1ULL << MAX_PEBS_EVENTS) - 1;
if (pebs_status != (1 << bit)) {
- u8 i;
-
for_each_set_bit(i, (unsigned long *)&pebs_status,
MAX_PEBS_EVENTS)
error[i]++;
next prev parent reply other threads:[~2015-05-12 13:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-10 19:13 [PATCH V9 0/8] large PEBS interrupt threshold Kan Liang
2015-05-10 19:13 ` [PATCH V9 1/8] perf, x86: use the PEBS auto reload mechanism when possible Kan Liang
2015-05-10 19:13 ` [PATCH V9 2/8] perf, x86: introduce setup_pebs_sample_data() Kan Liang
2015-05-10 19:13 ` [PATCH V9 3/8] perf, x86: handle multiple records in PEBS buffer Kan Liang
2015-05-12 13:25 ` Peter Zijlstra [this message]
2015-05-12 18:08 ` [RFC][PATCH] perf, pebs: Add PEBS v3 record decoding Andi Kleen
2015-05-13 1:31 ` Liang, Kan
2015-05-10 19:13 ` [PATCH V9 4/8] perf, x86: large PEBS interrupt threshold Kan Liang
2015-05-10 19:13 ` [PATCH V9 5/8] perf, x86: drain PEBS buffer during context switch Kan Liang
2015-05-10 19:13 ` [PATCH V9 6/8] perf, x86: enlarge PEBS buffer Kan Liang
2015-05-10 19:13 ` [PATCH V9 7/8] perf, x86: introduce PERF_RECORD_LOST_SAMPLES Kan Liang
2015-05-11 19:06 ` Arnaldo Carvalho de Melo
2015-06-07 17:50 ` [tip:perf/core] perf/x86/intel: Introduce PERF_RECORD_LOST_SAMPLES tip-bot for Kan Liang
2015-05-10 19:13 ` [PATCH V9 8/8] perf tools: handle PERF_RECORD_LOST_SAMPLES Kan Liang
2015-05-11 19:22 ` Arnaldo Carvalho de Melo
2015-05-11 20:40 ` Liang, Kan
2015-05-11 21:27 ` Arnaldo Carvalho de Melo
2015-05-12 12:43 ` Peter Zijlstra
2015-05-12 13:04 ` Arnaldo Carvalho de Melo
2015-06-07 17:51 ` [tip:perf/core] " tip-bot for Kan Liang
2015-05-11 16:06 ` [PATCH V9 0/8] large PEBS interrupt threshold Peter Zijlstra
2015-05-11 16:08 ` Liang, Kan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150512132557.GQ21418@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@infradead.org \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®