diff mbox

[10/13] tool/perf: Add support for perf_arch_regs

Message ID 1472418058-28659-11-git-send-email-maddy@linux.vnet.ibm.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

maddy Aug. 28, 2016, 9 p.m. UTC
Update the structure regs_dump with the arch_regs_mask
variable. Update perf_evsel__parse_sample() and
perf_event__sample_event_size() to include arch_regs_mask variable.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Stephane Eranian <eranian@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
---
 tools/perf/util/event.h |  1 +
 tools/perf/util/evsel.c | 11 +++++++++++
 2 files changed, 12 insertions(+)
diff mbox

Patch

diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 8d363d5e65a2..aee0ff536e29 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -94,6 +94,7 @@  struct sample_event {
 struct regs_dump {
 	u64 abi;
 	u64 mask;
+	u64 arch_regs_mask;
 	u64 *regs;
 
 	/* Cached values/mask filled by first register access. */
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 21fd573106ed..aac8820b3bd5 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1902,6 +1902,8 @@  int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
 		OVERFLOW_CHECK_u64(array);
 		data->user_regs.abi = *array;
 		array++;
+		data->user_regs.arch_regs_mask = *array;
+		array++;
 
 		if (data->user_regs.abi) {
 			u64 mask = evsel->attr.sample_regs_user;
@@ -1961,11 +1963,14 @@  int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
 		OVERFLOW_CHECK_u64(array);
 		data->intr_regs.abi = *array;
 		array++;
+		data->intr_regs.arch_regs_mask = *array;
+		array++;
 
 		if (data->intr_regs.abi != PERF_SAMPLE_REGS_ABI_NONE) {
 			u64 mask = evsel->attr.sample_regs_intr;
 
 			sz = hweight_long(mask) * sizeof(u64);
+			sz += hweight_long(data->intr_regs.arch_regs_mask) * sizeof(u64);
 			OVERFLOW_CHECK(array, sz, max_size);
 			data->intr_regs.mask = mask;
 			data->intr_regs.regs = (u64 *)array;
@@ -2044,6 +2049,7 @@  size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
 		if (sample->user_regs.abi) {
 			result += sizeof(u64);
 			sz = hweight_long(sample->user_regs.mask) * sizeof(u64);
+			sz += hweight_long(sample->user_regs.arch_regs_mask) * sizeof(u64);
 			result += sz;
 		} else {
 			result += sizeof(u64);
@@ -2072,6 +2078,7 @@  size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type,
 		if (sample->intr_regs.abi) {
 			result += sizeof(u64);
 			sz = hweight_long(sample->intr_regs.mask) * sizeof(u64);
+			sz += hweight_long(sample->intr_regs.arch_regs_mask) * sizeof(u64);
 			result += sz;
 		} else {
 			result += sizeof(u64);
@@ -2223,7 +2230,9 @@  int perf_event__synthesize_sample(union perf_event *event, u64 type,
 	if (type & PERF_SAMPLE_REGS_USER) {
 		if (sample->user_regs.abi) {
 			*array++ = sample->user_regs.abi;
+			*array++ = sample->user_regs.arch_regs_mask;
 			sz = hweight_long(sample->user_regs.mask) * sizeof(u64);
+			sz += hweight_long(sample->user_regs.arch_regs_mask) * sizeof(u64);
 			memcpy(array, sample->user_regs.regs, sz);
 			array = (void *)array + sz;
 		} else {
@@ -2259,7 +2268,9 @@  int perf_event__synthesize_sample(union perf_event *event, u64 type,
 	if (type & PERF_SAMPLE_REGS_INTR) {
 		if (sample->intr_regs.abi) {
 			*array++ = sample->intr_regs.abi;
+			*array++ = sample->intr_regs.arch_regs_mask;
 			sz = hweight_long(sample->intr_regs.mask) * sizeof(u64);
+			sz += hweight_long(sample->intr_regs.arch_regs_mask) * sizeof(u64);
 			memcpy(array, sample->intr_regs.regs, sz);
 			array = (void *)array + sz;
 		} else {