public inbox for linux-kernel@vger.kernel.org
 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,
	acme@redhat.com, jolsa@redhat.com, namhyung.kim@lge.com
Subject: [PATCH 6/8] perf tools: add infrastructure to handle PERF_SAMPLE_PHYS_ADDR
Date: Fri, 21 Jun 2013 16:20:46 +0200	[thread overview]
Message-ID: <1371824448-7306-7-git-send-email-eranian@google.com> (raw)
In-Reply-To: <1371824448-7306-1-git-send-email-eranian@google.com>

Provide infratstructure to request and dump samples with
PERF_SAMPLE_PHYS_ADDR sample type, i.e., physical address
sampling. This is useful for memory access sampling support.

Signed-off-by: Stephane Eranian <eranian@google.com>
---
 tools/perf/perf.h         |  1 +
 tools/perf/util/event.h   |  1 +
 tools/perf/util/evsel.c   | 16 +++++++++++++++-
 tools/perf/util/session.c |  6 ++++++
 4 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 32bd102..17f2c11 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -218,6 +218,7 @@ struct perf_record_opts {
 	bool	     pipe_output;
 	bool	     raw_samples;
 	bool	     sample_address;
+	bool	     sample_phys_address;
 	bool	     sample_weight;
 	bool	     sample_time;
 	bool	     period;
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 1813895..373f0eb 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -85,6 +85,7 @@ struct perf_sample {
 	u32 pid, tid;
 	u64 time;
 	u64 addr;
+	u64 paddr;
 	u64 id;
 	u64 stream_id;
 	u64 period;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 63b6f8c..15e0cca 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -524,7 +524,11 @@ void perf_evsel__config(struct perf_evsel *evsel,
 		perf_evsel__set_sample_bit(evsel, ADDR);
 		attr->mmap_data = track;
 	}
-
+	if (opts->sample_phys_address) {
+		perf_evsel__set_sample_bit(evsel, PHYS_ADDR);
+		attr->mmap_data = track;
+	}
+	
 	if (opts->call_graph) {
 		perf_evsel__set_sample_bit(evsel, CALLCHAIN);
 
@@ -1186,6 +1190,11 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
 		array++;
 	}
 
+	data->paddr = 0;
+	if (type & PERF_SAMPLE_PHYS_ADDR) {
+		data->paddr = *array;
+		array++;
+	}
 	return 0;
 }
 
@@ -1262,6 +1271,11 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
 		array++;
 	}
 
+	if (type & PERF_SAMPLE_PHYS_ADDR) {
+		*array = sample->paddr;
+		array++;
+	}
+
 	return 0;
 }
 
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index cf1fe01..fa9bf46 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -804,6 +804,12 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
 
 	if (sample_type & PERF_SAMPLE_DATA_SRC)
 		printf(" . data_src: 0x%"PRIx64"\n", sample->data_src);
+
+	if (sample_type & PERF_SAMPLE_ADDR)
+		printf(" . addr: 0x%"PRIx64"\n", sample->addr);
+
+	if (sample_type & PERF_SAMPLE_PHYS_ADDR)
+		printf(" . phys_addr: 0x%"PRIx64"\n", sample->paddr);
 }
 
 static struct machine *
-- 
1.8.1.2


  parent reply	other threads:[~2013-06-21 14:22 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21 14:20 [PATCH 0/8] perf: add ability to sample physical data addresses Stephane Eranian
2013-06-21 14:20 ` [PATCH 1/8] perf,x86: disable PEBS-LL in intel_pmu_pebs_disable() Stephane Eranian
2013-06-24  8:44   ` Peter Zijlstra
2013-06-26  7:35     ` Stephane Eranian
2013-06-27  9:01   ` [tip:perf/core] perf/x86: Disable " tip-bot for Stephane Eranian
2013-06-21 14:20 ` [PATCH 2/8] perf,x86: drop event->flags and use hw.constraint->flags Stephane Eranian
2013-06-24  8:45   ` Peter Zijlstra
2013-06-26  7:36     ` Stephane Eranian
2013-06-26 10:36       ` Peter Zijlstra
2013-06-27 10:23         ` Stephane Eranian
2013-06-27 10:48           ` Peter Zijlstra
2013-06-27 11:01             ` Stephane Eranian
2013-06-27 11:14               ` Peter Zijlstra
2013-06-27 12:33                 ` Stephane Eranian
2013-06-27 14:10                   ` Peter Zijlstra
2013-06-21 14:20 ` [PATCH 3/8] perf,x86: add uvirt_to_phys_nmi helper function Stephane Eranian
2013-06-21 14:20 ` [PATCH 4/8] perf: add PERF_SAMPLE_PHYS_ADDR sample type Stephane Eranian
2013-06-21 14:20 ` [PATCH 5/8] perf,x86: add support for PERF_SAMPLE_PHYS_ADDR for PEBS-LL Stephane Eranian
2013-06-21 14:20 ` Stephane Eranian [this message]
2013-06-21 14:20 ` [PATCH 7/8] perf record: add option to sample physical load/store addresses Stephane Eranian
2013-06-21 14:20 ` [PATCH 8/8] perf mem: add physical addr sampling support Stephane Eranian
2013-06-23 21:58 ` [PATCH 0/8] perf: add ability to sample physical data addresses Jiri Olsa
2013-06-24  8:16   ` Stephane Eranian
2013-06-24  8:45     ` Jiri Olsa
2013-06-24  8:43 ` Peter Zijlstra
2013-06-25  9:59   ` Stephane Eranian
2013-06-25 10:47     ` Peter Zijlstra
2013-06-25 10:51       ` Ingo Molnar
2013-06-26 10:33         ` Peter Zijlstra
2013-06-26 19:10           ` Stephane Eranian
2013-06-28  9:58             ` Peter Zijlstra
2013-07-05 22:48               ` Stephane Eranian
2013-07-08  8:19                 ` Peter Zijlstra
2013-07-09  6:02                   ` Stephane Eranian
2013-07-30  8:02                   ` Stephane Eranian
2013-07-30  8:37                     ` Peter Zijlstra
2013-07-30  8:51                       ` Stephane Eranian
2013-07-30  9:02                         ` Peter Zijlstra
2013-07-30 13:09                           ` Stephane Eranian
2013-07-30 14:21                             ` Stephane Eranian
2013-07-30 14:50                               ` David Ahern
2013-07-30 14:53                                 ` Stephane Eranian
2013-07-30 14:59                                   ` David Ahern
2013-07-30 15:52                               ` Peter Zijlstra
2013-07-30 16:09                                 ` Stephane Eranian
2013-07-30 16:16                                   ` Peter Zijlstra
2013-06-26 13:29       ` Ingo Molnar

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=1371824448-7306-7-git-send-email-eranian@google.com \
    --to=eranian@google.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung.kim@lge.com \
    --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