mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@elte.hu, ak@linux.intel.com,
	jolsa@redhat.com, acme@redhat.com, cebbert.lkml@gmail.com
Subject: [PATCH v6 2/6] perf/x86: add support for sampling PEBS machine state registers
Date: Tue, 23 Sep 2014 16:57:45 +0200	[thread overview]
Message-ID: <1411484269-32311-3-git-send-email-eranian@google.com> (raw)
In-Reply-To: <1411484269-32311-1-git-send-email-eranian@google.com>

PEBS can capture machine state regs at retiremnt of the sampled
instructions. When precise sampling is enabled on an event, PEBS
is used, so substitute the interrupted state with the PEBS state.
Note that not all registers are captured by PEBS. Those missing
are replaced by the interrupt state counter-parts.

Signed-off-by: Stephane Eranian <eranian@google.com>
---
 arch/x86/kernel/cpu/perf_event_intel_ds.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index b1553d0..0318023 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -886,6 +886,28 @@ static void __intel_pmu_pebs_event(struct perf_event *event,
 	regs.bp = pebs->bp;
 	regs.sp = pebs->sp;
 
+	if (sample_type & PERF_SAMPLE_REGS_INTR) {
+		regs.ax = pebs->ax;
+		regs.bx = pebs->bx;
+		regs.cx = pebs->cx;
+		regs.dx = pebs->dx;
+		regs.si = pebs->si;
+		regs.di = pebs->di;
+		regs.sp = pebs->sp;
+		regs.bp = pebs->bp;
+
+		regs.eflags = pebs->flags;
+
+		regs.r8 = pebs->r8;
+		regs.r9 = pebs->r9;
+		regs.r10 = pebs->r10;
+		regs.r11 = pebs->r11;
+		regs.r12 = pebs->r12;
+		regs.r13 = pebs->r13;
+		regs.r14 = pebs->r14;
+		regs.r15 = pebs->r15;
+	}
+
 	if (event->attr.precise_ip > 1 && x86_pmu.intel_cap.pebs_format >= 2) {
 		regs.ip = pebs->real_ip;
 		regs.flags |= PERF_EFLAGS_EXACT;
-- 
1.7.9.5


  parent reply	other threads:[~2014-09-23 14:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23 14:57 [PATCH v6 0/6] perf: add ability to sample interrupted machine state Stephane Eranian
2014-09-23 14:57 ` [PATCH v6 1/6] perf: add ability to sample machine state on interrupt Stephane Eranian
2014-09-23 14:57 ` Stephane Eranian [this message]
2014-09-24  7:49   ` [PATCH v6 2/6] perf/x86: add support for sampling PEBS machine state registers Peter Zijlstra
2014-09-23 14:57 ` [PATCH v6 3/6] perf tools: add core support for sampling intr machine state regs Stephane Eranian
2014-09-23 14:57 ` [PATCH v6 4/6] perf/tests: add interrupted state sample parsing test Stephane Eranian
2014-09-23 14:57 ` [PATCH v6 5/6] perf record: add new -I option to sample interrupted machine state Stephane Eranian
2014-09-23 14:57 ` [PATCH v6 6/6] perf: improve perf_sample_data struct layout Stephane Eranian
2014-09-24  7:49 ` [PATCH v6 0/6] perf: add ability to sample interrupted machine state Peter Zijlstra
2014-09-24  8:31   ` Stephane Eranian

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=1411484269-32311-3-git-send-email-eranian@google.com \
    --to=eranian@google.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=cebbert.lkml@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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®