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]
Message-ID: <20200724091607.41903-5-liwei391@huawei.com>
Date:   Fri, 24 Jul 2020 17:16:07 +0800
From:   Wei Li <liwei391@...wei.com>
To:     Adrian Hunter <adrian.hunter@...el.com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        James Clark <james.clark@....com>,
        Jiri Olsa <jolsa@...hat.com>, Leo Yan <leo.yan@...aro.org>,
        Mark Rutland <mark.rutland@....com>,
        Namhyung Kim <namhyung@...nel.org>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Will Deacon <will@...nel.org>, <zhangshaokun@...ilicon.com>
CC:     <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>, <guohanjun@...wei.com>
Subject: [PATCH 4/4] perf: arm-spe: Synthesize new events for ARMv8.3-SPE

Synthesize unaligned address access events and partial/empty
predicated SVE operation introduced by ARMv8.3-SPE.

They can be filtered by itrace options when reporting.

Signed-off-by: Wei Li <liwei391@...wei.com>
---
 .../util/arm-spe-decoder/arm-spe-decoder.c    | 11 ++++
 .../util/arm-spe-decoder/arm-spe-decoder.h    |  3 +
 tools/perf/util/arm-spe.c                     | 61 +++++++++++++++++++
 3 files changed, 75 insertions(+)

diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
index 93e063f22be5..fac8102c0149 100644
--- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
+++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.c
@@ -197,6 +197,17 @@ static int arm_spe_read_record(struct arm_spe_decoder *decoder)
 			if (payload & BIT(EV_MISPRED))
 				decoder->record.type |= ARM_SPE_BRANCH_MISS;
 
+			if ((idx == 4 || idx == 8) &&
+			    (payload & BIT(EV_ALIGNMENT)))
+				decoder->record.type |= ARM_SPE_ALIGNMENT;
+
+			if ((idx == 4 || idx == 8) &&
+			    (payload & BIT(EV_PARTIAL_PREDICATE)))
+				decoder->record.type |= ARM_SPE_PARTIAL_PREDICATE;
+
+			if ((idx == 4 || idx == 8) &&
+			    (payload & BIT(EV_EMPTY_PREDICATE)))
+				decoder->record.type |= ARM_SPE_EMPTY_PREDICATE;
 			break;
 		case ARM_SPE_DATA_SOURCE:
 			break;
diff --git a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
index a5111a8d4360..d165418fcc13 100644
--- a/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
+++ b/tools/perf/util/arm-spe-decoder/arm-spe-decoder.h
@@ -39,6 +39,9 @@ enum arm_spe_sample_type {
 	ARM_SPE_TLB_MISS	= 1 << 5,
 	ARM_SPE_BRANCH_MISS	= 1 << 6,
 	ARM_SPE_REMOTE_ACCESS	= 1 << 7,
+	ARM_SPE_ALIGNMENT	= 1 << 8,
+	ARM_SPE_PARTIAL_PREDICATE	= 1 << 9,
+	ARM_SPE_EMPTY_PREDICATE	= 1 << 10,
 };
 
 struct arm_spe_record {
diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index 3882a5360ada..e36d6eea269b 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -53,6 +53,8 @@ struct arm_spe {
 	u8				sample_tlb;
 	u8				sample_branch;
 	u8				sample_remote_access;
+	u8				sample_alignment;
+	u8				sample_sve;
 
 	u64				l1d_miss_id;
 	u64				l1d_access_id;
@@ -62,6 +64,9 @@ struct arm_spe {
 	u64				tlb_access_id;
 	u64				branch_miss_id;
 	u64				remote_access_id;
+	u64				alignment_id;
+	u64				epred_sve_id;
+	u64				ppred_sve_id;
 
 	u64				kernel_start;
 
@@ -344,6 +349,30 @@ static int arm_spe_sample(struct arm_spe_queue *speq)
 			return err;
 	}
 
+	if (spe->sample_alignment &&
+	    (record->type & ARM_SPE_ALIGNMENT)) {
+		err = arm_spe_synth_spe_events_sample(speq,
+						      spe->alignment_id);
+		if (err)
+			return err;
+	}
+
+	if (spe->sample_sve) {
+		if (record->type & ARM_SPE_EMPTY_PREDICATE) {
+			err = arm_spe_synth_spe_events_sample(
+					speq, spe->epred_sve_id);
+			if (err)
+				return err;
+		}
+
+		if (record->type & ARM_SPE_PARTIAL_PREDICATE) {
+			err = arm_spe_synth_spe_events_sample(
+					speq, spe->ppred_sve_id);
+			if (err)
+				return err;
+		}
+	}
+
 	return 0;
 }
 
@@ -907,6 +936,38 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
 		id += 1;
 	}
 
+	if (spe->synth_opts.alignment) {
+		spe->sample_alignment = true;
+
+		/* Alignment */
+		err = arm_spe_synth_event(session, &attr, id);
+		if (err)
+			return err;
+		spe->alignment_id = id;
+		arm_spe_set_event_name(evlist, id, "alignment");
+		id += 1;
+	}
+
+	if (spe->synth_opts.sve) {
+		spe->sample_sve = true;
+
+		/* Empty predicated SVE */
+		err = arm_spe_synth_event(session, &attr, id);
+		if (err)
+			return err;
+		spe->epred_sve_id = id;
+		arm_spe_set_event_name(evlist, id, "sve-pred-empty");
+		id += 1;
+
+		/* Partial predicated SVE */
+		err = arm_spe_synth_event(session, &attr, id);
+		if (err)
+			return err;
+		spe->ppred_sve_id = id;
+		arm_spe_set_event_name(evlist, id, "sve-pred-partial");
+		id += 1;
+	}
+
 	return 0;
 }
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ