lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 21 Jun 2013 16:20:46 +0200
From:	Stephane Eranian <eranian@...gle.com>
To:	linux-kernel@...r.kernel.org
Cc:	peterz@...radead.org, mingo@...e.hu, ak@...ux.intel.com,
	acme@...hat.com, jolsa@...hat.com, namhyung.kim@....com
Subject: [PATCH 6/8] perf tools: add infrastructure to handle PERF_SAMPLE_PHYS_ADDR

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@...gle.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ