All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] perf: arm-spe: Fix addresses of synthesized Arm SPE events
@ 2022-04-21 16:52 ` Timothy Hayes
  0 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: John Garry, Will Deacon, Mathieu Poirier, Leo Yan, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Martin KaFai Lau,
	Song Liu, Yonghong Song, John Fastabend, KP Singh,
	linux-arm-kernel, netdev, bpf

This patch set fixes problems related to address in synthesized events from SPE.

Committer testing:

perf record --no-bpf-event -e arm_spe_0/pa_enable=1/ -- sleep 1
perf inject -i perf.data -o perf-inj.data --itrace --strip
perf script -i perf-inj.data --fields hw:+addr,+phys_addr

Before:
	sleep 49337 [004] 20133.731889:          1             l1d-access:  ffffcbebcde1d5b8 [unknown] ([unknown])
	sleep 49337 [004] 20133.731889:          1             tlb-access:  ffffcbebcde1d5b8 [unknown] ([unknown])
	sleep 49337 [004] 20133.731889:          1                 memory:  ffffcbebcde1d5b8 [unknown] ([unknown])

After:
	sleep 49337 [004] 20133.731889:          1             l1d-access: ffff800034123970 ffffcbebcde1d5b8 [unknown] ([unknown])       153d19970
	sleep 49337 [004] 20133.731889:          1             tlb-access: ffff800034123970 ffffcbebcde1d5b8 [unknown] ([unknown])       153d19970
	sleep 49337 [004] 20133.731889:          1                 memory: ffff800034123970 ffffcbebcde1d5b8 [unknown] ([unknown])       153d19970

tools/perf/arch/arm64/util/arm-spe.c                   | 10 ++++++++++
tools/perf/tests/attr/README                           |  1 +
tools/perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
tools/perf/util/arm-spe.c                              |  5 +++--
4 files changed, 26 insertions(+), 2 deletions(-)


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 0/3] perf: arm-spe: Fix addresses of synthesized Arm SPE events
@ 2022-04-21 16:52 ` Timothy Hayes
  0 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: John Garry, Will Deacon, Mathieu Poirier, Leo Yan, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Martin KaFai Lau,
	Song Liu, Yonghong Song, John Fastabend, KP Singh,
	linux-arm-kernel, netdev, bpf

This patch set fixes problems related to address in synthesized events from SPE.

Committer testing:

perf record --no-bpf-event -e arm_spe_0/pa_enable=1/ -- sleep 1
perf inject -i perf.data -o perf-inj.data --itrace --strip
perf script -i perf-inj.data --fields hw:+addr,+phys_addr

Before:
	sleep 49337 [004] 20133.731889:          1             l1d-access:  ffffcbebcde1d5b8 [unknown] ([unknown])
	sleep 49337 [004] 20133.731889:          1             tlb-access:  ffffcbebcde1d5b8 [unknown] ([unknown])
	sleep 49337 [004] 20133.731889:          1                 memory:  ffffcbebcde1d5b8 [unknown] ([unknown])

After:
	sleep 49337 [004] 20133.731889:          1             l1d-access: ffff800034123970 ffffcbebcde1d5b8 [unknown] ([unknown])       153d19970
	sleep 49337 [004] 20133.731889:          1             tlb-access: ffff800034123970 ffffcbebcde1d5b8 [unknown] ([unknown])       153d19970
	sleep 49337 [004] 20133.731889:          1                 memory: ffff800034123970 ffffcbebcde1d5b8 [unknown] ([unknown])       153d19970

tools/perf/arch/arm64/util/arm-spe.c                   | 10 ++++++++++
tools/perf/tests/attr/README                           |  1 +
tools/perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
tools/perf/util/arm-spe.c                              |  5 +++--
4 files changed, 26 insertions(+), 2 deletions(-)


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/3] perf: arm-spe: Fix addresses of synthesized SPE events
  2022-04-21 16:52 ` Timothy Hayes
@ 2022-04-21 16:52   ` Timothy Hayes
  -1 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: Timothy Hayes, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, linux-arm-kernel, netdev, bpf

This patch corrects a bug whereby synthesized events from SPE
samples are missing virtual addresses.

Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
---
 tools/perf/util/arm-spe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index d2b64e3f588b..151cc38a171c 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -1036,7 +1036,7 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
 	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
 	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
 			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
-			    PERF_SAMPLE_WEIGHT;
+			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
 	if (spe->timeless_decoding)
 		attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
 	else
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 1/3] perf: arm-spe: Fix addresses of synthesized SPE events
@ 2022-04-21 16:52   ` Timothy Hayes
  0 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: Timothy Hayes, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, linux-arm-kernel, netdev, bpf

This patch corrects a bug whereby synthesized events from SPE
samples are missing virtual addresses.

Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
---
 tools/perf/util/arm-spe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index d2b64e3f588b..151cc38a171c 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -1036,7 +1036,7 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
 	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
 	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
 			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
-			    PERF_SAMPLE_WEIGHT;
+			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
 	if (spe->timeless_decoding)
 		attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
 	else
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
  2022-04-21 16:52 ` Timothy Hayes
@ 2022-04-21 16:52   ` Timothy Hayes
  -1 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: Timothy Hayes, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, linux-arm-kernel, netdev, bpf

This patch corrects a bug whereby SPE collection is invoked with
pa_enable=1 but synthesized events fail to show physical addresses.

Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
---
 tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++
 tools/perf/util/arm-spe.c            |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index af4d63af8072..e8b577d33e53 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
 	bool privileged = perf_event_paranoid_check(-1);
 	struct evsel *tracking_evsel;
 	int err;
+	u64 bit;
 
 	sper->evlist = evlist;
 
@@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
 	 */
 	evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
 
+	/*
+	 * The PHYS_ADDR flag does not affect the driver behaviour, it is used to
+	 * inform that the resulting output's SPE samples contain physical addresses
+	 * where applicable.
+	 */
+	bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
+	if (arm_spe_evsel->core.attr.config & bit)
+		evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
+
 	/* Add dummy event to keep tracking */
 	err = parse_events(evlist, "dummy:u", NULL);
 	if (err)
diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index 151cc38a171c..1a80151baed9 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
 	memset(&attr, 0, sizeof(struct perf_event_attr));
 	attr.size = sizeof(struct perf_event_attr);
 	attr.type = PERF_TYPE_HARDWARE;
-	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
+	attr.sample_type = evsel->core.attr.sample_type &
+				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
 	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
 			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
 			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
@ 2022-04-21 16:52   ` Timothy Hayes
  0 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: Timothy Hayes, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, linux-arm-kernel, netdev, bpf

This patch corrects a bug whereby SPE collection is invoked with
pa_enable=1 but synthesized events fail to show physical addresses.

Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
---
 tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++
 tools/perf/util/arm-spe.c            |  3 ++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index af4d63af8072..e8b577d33e53 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
 	bool privileged = perf_event_paranoid_check(-1);
 	struct evsel *tracking_evsel;
 	int err;
+	u64 bit;
 
 	sper->evlist = evlist;
 
@@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
 	 */
 	evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
 
+	/*
+	 * The PHYS_ADDR flag does not affect the driver behaviour, it is used to
+	 * inform that the resulting output's SPE samples contain physical addresses
+	 * where applicable.
+	 */
+	bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
+	if (arm_spe_evsel->core.attr.config & bit)
+		evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
+
 	/* Add dummy event to keep tracking */
 	err = parse_events(evlist, "dummy:u", NULL);
 	if (err)
diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
index 151cc38a171c..1a80151baed9 100644
--- a/tools/perf/util/arm-spe.c
+++ b/tools/perf/util/arm-spe.c
@@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
 	memset(&attr, 0, sizeof(struct perf_event_attr));
 	attr.size = sizeof(struct perf_event_attr);
 	attr.type = PERF_TYPE_HARDWARE;
-	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
+	attr.sample_type = evsel->core.attr.sample_type &
+				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
 	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
 			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
 			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/3] perf test: Add perf_event_attr test for Arm SPE
  2022-04-21 16:52 ` Timothy Hayes
@ 2022-04-21 16:52   ` Timothy Hayes
  -1 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: Timothy Hayes, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, linux-arm-kernel, netdev, bpf

Adds a perf_event_attr test for Arm SPE in which the presence of
physical addresses are checked when SPE unit is run with pa_enable=1.

Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
---
 tools/perf/tests/attr/README                         |  1 +
 .../perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-spe-physical-address

diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
index 454505d343fa..eb3f7d4bb324 100644
--- a/tools/perf/tests/attr/README
+++ b/tools/perf/tests/attr/README
@@ -60,6 +60,7 @@ Following tests are defined (with perf commands):
   perf record -R kill                           (test-record-raw)
   perf record -c 2 -e arm_spe_0// -- kill       (test-record-spe-period)
   perf record -e arm_spe_0/period=3/ -- kill    (test-record-spe-period-term)
+  perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
   perf stat -e cycles kill                      (test-stat-basic)
   perf stat kill                                (test-stat-default)
   perf stat -d kill                             (test-stat-detailed-1)
diff --git a/tools/perf/tests/attr/test-record-spe-physical-address b/tools/perf/tests/attr/test-record-spe-physical-address
new file mode 100644
index 000000000000..7ebcf5012ce3
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-spe-physical-address
@@ -0,0 +1,12 @@
+[config]
+command = record
+args    = --no-bpf-event -e arm_spe_0/pa_enable=1/ -- kill >/dev/null 2>&1
+ret     = 1
+arch    = aarch64
+
+[event-10:base-record-spe]
+# 622727 is the decimal of IP|TID|TIME|CPU|IDENTIFIER|DATA_SRC|PHYS_ADDR
+sample_type=622727
+
+# dummy event
+[event-1:base-record-spe]
\ No newline at end of file
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/3] perf test: Add perf_event_attr test for Arm SPE
@ 2022-04-21 16:52   ` Timothy Hayes
  0 siblings, 0 replies; 22+ messages in thread
From: Timothy Hayes @ 2022-04-21 16:52 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: Timothy Hayes, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, linux-arm-kernel, netdev, bpf

Adds a perf_event_attr test for Arm SPE in which the presence of
physical addresses are checked when SPE unit is run with pa_enable=1.

Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
---
 tools/perf/tests/attr/README                         |  1 +
 .../perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 tools/perf/tests/attr/test-record-spe-physical-address

diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
index 454505d343fa..eb3f7d4bb324 100644
--- a/tools/perf/tests/attr/README
+++ b/tools/perf/tests/attr/README
@@ -60,6 +60,7 @@ Following tests are defined (with perf commands):
   perf record -R kill                           (test-record-raw)
   perf record -c 2 -e arm_spe_0// -- kill       (test-record-spe-period)
   perf record -e arm_spe_0/period=3/ -- kill    (test-record-spe-period-term)
+  perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
   perf stat -e cycles kill                      (test-stat-basic)
   perf stat kill                                (test-stat-default)
   perf stat -d kill                             (test-stat-detailed-1)
diff --git a/tools/perf/tests/attr/test-record-spe-physical-address b/tools/perf/tests/attr/test-record-spe-physical-address
new file mode 100644
index 000000000000..7ebcf5012ce3
--- /dev/null
+++ b/tools/perf/tests/attr/test-record-spe-physical-address
@@ -0,0 +1,12 @@
+[config]
+command = record
+args    = --no-bpf-event -e arm_spe_0/pa_enable=1/ -- kill >/dev/null 2>&1
+ret     = 1
+arch    = aarch64
+
+[event-10:base-record-spe]
+# 622727 is the decimal of IP|TID|TIME|CPU|IDENTIFIER|DATA_SRC|PHYS_ADDR
+sample_type=622727
+
+# dummy event
+[event-1:base-record-spe]
\ No newline at end of file
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/3] perf: arm-spe: Fix addresses of synthesized SPE events
  2022-04-21 16:52   ` Timothy Hayes
@ 2022-04-24 12:28     ` Leo Yan
  -1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 12:28 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

On Thu, Apr 21, 2022 at 05:52:03PM +0100, Timothy Hayes wrote:
> This patch corrects a bug whereby synthesized events from SPE
> samples are missing virtual addresses.
> 
> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>

Reviewed-by: Leo Yan <leo.yan@linaro.org>

> ---
>  tools/perf/util/arm-spe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index d2b64e3f588b..151cc38a171c 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -1036,7 +1036,7 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
>  	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
> -			    PERF_SAMPLE_WEIGHT;
> +			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
>  	if (spe->timeless_decoding)
>  		attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
>  	else
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/3] perf: arm-spe: Fix addresses of synthesized SPE events
@ 2022-04-24 12:28     ` Leo Yan
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 12:28 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

On Thu, Apr 21, 2022 at 05:52:03PM +0100, Timothy Hayes wrote:
> This patch corrects a bug whereby synthesized events from SPE
> samples are missing virtual addresses.
> 
> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>

Reviewed-by: Leo Yan <leo.yan@linaro.org>

> ---
>  tools/perf/util/arm-spe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index d2b64e3f588b..151cc38a171c 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -1036,7 +1036,7 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
>  	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
> -			    PERF_SAMPLE_WEIGHT;
> +			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
>  	if (spe->timeless_decoding)
>  		attr.sample_type &= ~(u64)PERF_SAMPLE_TIME;
>  	else
> -- 
> 2.25.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
  2022-04-21 16:52   ` Timothy Hayes
@ 2022-04-24 12:59     ` Leo Yan
  -1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 12:59 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

Hi Timothy,

On Thu, Apr 21, 2022 at 05:52:04PM +0100, Timothy Hayes wrote:
> This patch corrects a bug whereby SPE collection is invoked with
> pa_enable=1 but synthesized events fail to show physical addresses.
> 
> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
> ---
>  tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++
>  tools/perf/util/arm-spe.c            |  3 ++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
> index af4d63af8072..e8b577d33e53 100644
> --- a/tools/perf/arch/arm64/util/arm-spe.c
> +++ b/tools/perf/arch/arm64/util/arm-spe.c
> @@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>  	bool privileged = perf_event_paranoid_check(-1);
>  	struct evsel *tracking_evsel;
>  	int err;
> +	u64 bit;
>  
>  	sper->evlist = evlist;
>  
> @@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>  	 */
>  	evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
>  
> +	/*
> +	 * The PHYS_ADDR flag does not affect the driver behaviour, it is used to
> +	 * inform that the resulting output's SPE samples contain physical addresses
> +	 * where applicable.
> +	 */
> +	bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
> +	if (arm_spe_evsel->core.attr.config & bit)
> +		evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
> +
>  	/* Add dummy event to keep tracking */
>  	err = parse_events(evlist, "dummy:u", NULL);
>  	if (err)
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index 151cc38a171c..1a80151baed9 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
>  	memset(&attr, 0, sizeof(struct perf_event_attr));
>  	attr.size = sizeof(struct perf_event_attr);
>  	attr.type = PERF_TYPE_HARDWARE;
> -	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
> +	attr.sample_type = evsel->core.attr.sample_type &
> +				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);

I verified this patch and I can confirm the physical address can be
dumped successfully.

I have a more general question, seems to me, we need to change the
macro PERF_SAMPLE_MASK in the file util/event.h as below, so
here doesn't need to 'or' the flag PERF_SAMPLE_PHYS_ADDR anymore.

@Arnaldo, @Jiri, could you confirm if this is the right way to move
forward?  I am not sure why PERF_SAMPLE_MASK doesn't contain the bit
PERF_SAMPLE_PHYS_ADDR in current code.

diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index cdd72e05fd28..c905ac32ebad 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -39,7 +39,7 @@ struct perf_event_attr;
         PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |          \
        PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |        \
         PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |         \
-        PERF_SAMPLE_IDENTIFIER)
+        PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_PHYS_ADDR)

Thanks,
Leo

>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
>  			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
> -- 
> 2.25.1
> 

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
@ 2022-04-24 12:59     ` Leo Yan
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 12:59 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

Hi Timothy,

On Thu, Apr 21, 2022 at 05:52:04PM +0100, Timothy Hayes wrote:
> This patch corrects a bug whereby SPE collection is invoked with
> pa_enable=1 but synthesized events fail to show physical addresses.
> 
> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
> ---
>  tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++
>  tools/perf/util/arm-spe.c            |  3 ++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
> index af4d63af8072..e8b577d33e53 100644
> --- a/tools/perf/arch/arm64/util/arm-spe.c
> +++ b/tools/perf/arch/arm64/util/arm-spe.c
> @@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>  	bool privileged = perf_event_paranoid_check(-1);
>  	struct evsel *tracking_evsel;
>  	int err;
> +	u64 bit;
>  
>  	sper->evlist = evlist;
>  
> @@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>  	 */
>  	evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
>  
> +	/*
> +	 * The PHYS_ADDR flag does not affect the driver behaviour, it is used to
> +	 * inform that the resulting output's SPE samples contain physical addresses
> +	 * where applicable.
> +	 */
> +	bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
> +	if (arm_spe_evsel->core.attr.config & bit)
> +		evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
> +
>  	/* Add dummy event to keep tracking */
>  	err = parse_events(evlist, "dummy:u", NULL);
>  	if (err)
> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> index 151cc38a171c..1a80151baed9 100644
> --- a/tools/perf/util/arm-spe.c
> +++ b/tools/perf/util/arm-spe.c
> @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
>  	memset(&attr, 0, sizeof(struct perf_event_attr));
>  	attr.size = sizeof(struct perf_event_attr);
>  	attr.type = PERF_TYPE_HARDWARE;
> -	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
> +	attr.sample_type = evsel->core.attr.sample_type &
> +				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);

I verified this patch and I can confirm the physical address can be
dumped successfully.

I have a more general question, seems to me, we need to change the
macro PERF_SAMPLE_MASK in the file util/event.h as below, so
here doesn't need to 'or' the flag PERF_SAMPLE_PHYS_ADDR anymore.

@Arnaldo, @Jiri, could you confirm if this is the right way to move
forward?  I am not sure why PERF_SAMPLE_MASK doesn't contain the bit
PERF_SAMPLE_PHYS_ADDR in current code.

diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index cdd72e05fd28..c905ac32ebad 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -39,7 +39,7 @@ struct perf_event_attr;
         PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |          \
        PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |        \
         PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |         \
-        PERF_SAMPLE_IDENTIFIER)
+        PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_PHYS_ADDR)

Thanks,
Leo

>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
>  			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
> -- 
> 2.25.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/3] perf test: Add perf_event_attr test for Arm SPE
  2022-04-21 16:52   ` Timothy Hayes
@ 2022-04-24 14:53     ` Leo Yan
  -1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 14:53 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

On Thu, Apr 21, 2022 at 05:52:05PM +0100, Timothy Hayes wrote:
> Adds a perf_event_attr test for Arm SPE in which the presence of
> physical addresses are checked when SPE unit is run with pa_enable=1.
> 
> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>

Reviewed-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>

> ---
>  tools/perf/tests/attr/README                         |  1 +
>  .../perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>  create mode 100644 tools/perf/tests/attr/test-record-spe-physical-address
> 
> diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
> index 454505d343fa..eb3f7d4bb324 100644
> --- a/tools/perf/tests/attr/README
> +++ b/tools/perf/tests/attr/README
> @@ -60,6 +60,7 @@ Following tests are defined (with perf commands):
>    perf record -R kill                           (test-record-raw)
>    perf record -c 2 -e arm_spe_0// -- kill       (test-record-spe-period)
>    perf record -e arm_spe_0/period=3/ -- kill    (test-record-spe-period-term)
> +  perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
>    perf stat -e cycles kill                      (test-stat-basic)
>    perf stat kill                                (test-stat-default)
>    perf stat -d kill                             (test-stat-detailed-1)
> diff --git a/tools/perf/tests/attr/test-record-spe-physical-address b/tools/perf/tests/attr/test-record-spe-physical-address
> new file mode 100644
> index 000000000000..7ebcf5012ce3
> --- /dev/null
> +++ b/tools/perf/tests/attr/test-record-spe-physical-address
> @@ -0,0 +1,12 @@
> +[config]
> +command = record
> +args    = --no-bpf-event -e arm_spe_0/pa_enable=1/ -- kill >/dev/null 2>&1
> +ret     = 1
> +arch    = aarch64
> +
> +[event-10:base-record-spe]
> +# 622727 is the decimal of IP|TID|TIME|CPU|IDENTIFIER|DATA_SRC|PHYS_ADDR
> +sample_type=622727
> +
> +# dummy event
> +[event-1:base-record-spe]
> \ No newline at end of file
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/3] perf test: Add perf_event_attr test for Arm SPE
@ 2022-04-24 14:53     ` Leo Yan
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 14:53 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

On Thu, Apr 21, 2022 at 05:52:05PM +0100, Timothy Hayes wrote:
> Adds a perf_event_attr test for Arm SPE in which the presence of
> physical addresses are checked when SPE unit is run with pa_enable=1.
> 
> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>

Reviewed-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>

> ---
>  tools/perf/tests/attr/README                         |  1 +
>  .../perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
>  2 files changed, 13 insertions(+)
>  create mode 100644 tools/perf/tests/attr/test-record-spe-physical-address
> 
> diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
> index 454505d343fa..eb3f7d4bb324 100644
> --- a/tools/perf/tests/attr/README
> +++ b/tools/perf/tests/attr/README
> @@ -60,6 +60,7 @@ Following tests are defined (with perf commands):
>    perf record -R kill                           (test-record-raw)
>    perf record -c 2 -e arm_spe_0// -- kill       (test-record-spe-period)
>    perf record -e arm_spe_0/period=3/ -- kill    (test-record-spe-period-term)
> +  perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
>    perf stat -e cycles kill                      (test-stat-basic)
>    perf stat kill                                (test-stat-default)
>    perf stat -d kill                             (test-stat-detailed-1)
> diff --git a/tools/perf/tests/attr/test-record-spe-physical-address b/tools/perf/tests/attr/test-record-spe-physical-address
> new file mode 100644
> index 000000000000..7ebcf5012ce3
> --- /dev/null
> +++ b/tools/perf/tests/attr/test-record-spe-physical-address
> @@ -0,0 +1,12 @@
> +[config]
> +command = record
> +args    = --no-bpf-event -e arm_spe_0/pa_enable=1/ -- kill >/dev/null 2>&1
> +ret     = 1
> +arch    = aarch64
> +
> +[event-10:base-record-spe]
> +# 622727 is the decimal of IP|TID|TIME|CPU|IDENTIFIER|DATA_SRC|PHYS_ADDR
> +sample_type=622727
> +
> +# dummy event
> +[event-1:base-record-spe]
> \ No newline at end of file
> -- 
> 2.25.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/3] perf: arm-spe: Fix addresses of synthesized SPE events
  2022-04-24 12:28     ` Leo Yan
@ 2022-04-24 15:22       ` Leo Yan
  -1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 15:22 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

On Sun, Apr 24, 2022 at 08:28:31PM +0800, Leo Yan wrote:
> On Thu, Apr 21, 2022 at 05:52:03PM +0100, Timothy Hayes wrote:
> > This patch corrects a bug whereby synthesized events from SPE
> > samples are missing virtual addresses.
> > 
> > Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
> 
> Reviewed-by: Leo Yan <leo.yan@linaro.org>

Supplement for fixed tag:

Since patches 01, 02 are fixing bugs, please add fixed tag [1]:

Fixes: 54f7815efef7 ("perf arm-spe: Fill address info for samples")

Thanks,
Leo

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n138

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/3] perf: arm-spe: Fix addresses of synthesized SPE events
@ 2022-04-24 15:22       ` Leo Yan
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-24 15:22 UTC (permalink / raw)
  To: Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf

On Sun, Apr 24, 2022 at 08:28:31PM +0800, Leo Yan wrote:
> On Thu, Apr 21, 2022 at 05:52:03PM +0100, Timothy Hayes wrote:
> > This patch corrects a bug whereby synthesized events from SPE
> > samples are missing virtual addresses.
> > 
> > Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
> 
> Reviewed-by: Leo Yan <leo.yan@linaro.org>

Supplement for fixed tag:

Since patches 01, 02 are fixing bugs, please add fixed tag [1]:

Fixes: 54f7815efef7 ("perf arm-spe: Fill address info for samples")

Thanks,
Leo

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst#n138

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
  2022-04-24 12:59     ` Leo Yan
@ 2022-04-25  9:12       ` James Clark
  -1 siblings, 0 replies; 22+ messages in thread
From: James Clark @ 2022-04-25  9:12 UTC (permalink / raw)
  To: Leo Yan, Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf



On 24/04/2022 13:59, Leo Yan wrote:
> Hi Timothy,
> 
> On Thu, Apr 21, 2022 at 05:52:04PM +0100, Timothy Hayes wrote:
>> This patch corrects a bug whereby SPE collection is invoked with
>> pa_enable=1 but synthesized events fail to show physical addresses.
>>
>> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
>> ---
>>  tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++
>>  tools/perf/util/arm-spe.c            |  3 ++-
>>  2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
>> index af4d63af8072..e8b577d33e53 100644
>> --- a/tools/perf/arch/arm64/util/arm-spe.c
>> +++ b/tools/perf/arch/arm64/util/arm-spe.c
>> @@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>>  	bool privileged = perf_event_paranoid_check(-1);
>>  	struct evsel *tracking_evsel;
>>  	int err;
>> +	u64 bit;
>>  
>>  	sper->evlist = evlist;
>>  
>> @@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>>  	 */
>>  	evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
>>  
>> +	/*
>> +	 * The PHYS_ADDR flag does not affect the driver behaviour, it is used to
>> +	 * inform that the resulting output's SPE samples contain physical addresses
>> +	 * where applicable.
>> +	 */
>> +	bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
>> +	if (arm_spe_evsel->core.attr.config & bit)
>> +		evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
>> +
>>  	/* Add dummy event to keep tracking */
>>  	err = parse_events(evlist, "dummy:u", NULL);
>>  	if (err)
>> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
>> index 151cc38a171c..1a80151baed9 100644
>> --- a/tools/perf/util/arm-spe.c
>> +++ b/tools/perf/util/arm-spe.c
>> @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
>>  	memset(&attr, 0, sizeof(struct perf_event_attr));
>>  	attr.size = sizeof(struct perf_event_attr);
>>  	attr.type = PERF_TYPE_HARDWARE;
>> -	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
>> +	attr.sample_type = evsel->core.attr.sample_type &
>> +				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
> 
> I verified this patch and I can confirm the physical address can be
> dumped successfully.
> 
> I have a more general question, seems to me, we need to change the
> macro PERF_SAMPLE_MASK in the file util/event.h as below, so
> here doesn't need to 'or' the flag PERF_SAMPLE_PHYS_ADDR anymore.
> 
> @Arnaldo, @Jiri, could you confirm if this is the right way to move
> forward?  I am not sure why PERF_SAMPLE_MASK doesn't contain the bit
> PERF_SAMPLE_PHYS_ADDR in current code.

I think there is a reason that PERF_SAMPLE_MASK is a subset of all the
bits. This comment below suggests it. Is it so the mask only includes fields
that are 64bits? That makes the __evsel__sample_size() function a simple
multiplication of a count of all the fields that are 64bits.

  static int
  perf_event__check_size(union perf_event *event, unsigned int sample_size)
  {
	/*
	 * The evsel's sample_size is based on PERF_SAMPLE_MASK which includes
	 * up to PERF_SAMPLE_PERIOD.  After that overflow() must be used to
	 * check the format does not go past the end of the event.
	 */
	if (sample_size + sizeof(event->header) > event->header.size)
		return -EFAULT;

	return 0;
  }

Having said that, the mask was updated once to add PERF_SAMPLE_IDENTIFIER to
it, so that comment is slightly out of date now.


> 
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index cdd72e05fd28..c905ac32ebad 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -39,7 +39,7 @@ struct perf_event_attr;
>          PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |          \
>         PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |        \
>          PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |         \
> -        PERF_SAMPLE_IDENTIFIER)
> +        PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_PHYS_ADDR)
> 
> Thanks,
> Leo
> 
>>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
>>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
>>  			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
>> -- 
>> 2.25.1
>>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
@ 2022-04-25  9:12       ` James Clark
  0 siblings, 0 replies; 22+ messages in thread
From: James Clark @ 2022-04-25  9:12 UTC (permalink / raw)
  To: Leo Yan, Timothy Hayes
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, linux-arm-kernel, netdev, bpf



On 24/04/2022 13:59, Leo Yan wrote:
> Hi Timothy,
> 
> On Thu, Apr 21, 2022 at 05:52:04PM +0100, Timothy Hayes wrote:
>> This patch corrects a bug whereby SPE collection is invoked with
>> pa_enable=1 but synthesized events fail to show physical addresses.
>>
>> Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
>> ---
>>  tools/perf/arch/arm64/util/arm-spe.c | 10 ++++++++++
>>  tools/perf/util/arm-spe.c            |  3 ++-
>>  2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
>> index af4d63af8072..e8b577d33e53 100644
>> --- a/tools/perf/arch/arm64/util/arm-spe.c
>> +++ b/tools/perf/arch/arm64/util/arm-spe.c
>> @@ -148,6 +148,7 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>>  	bool privileged = perf_event_paranoid_check(-1);
>>  	struct evsel *tracking_evsel;
>>  	int err;
>> +	u64 bit;
>>  
>>  	sper->evlist = evlist;
>>  
>> @@ -245,6 +246,15 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
>>  	 */
>>  	evsel__set_sample_bit(arm_spe_evsel, DATA_SRC);
>>  
>> +	/*
>> +	 * The PHYS_ADDR flag does not affect the driver behaviour, it is used to
>> +	 * inform that the resulting output's SPE samples contain physical addresses
>> +	 * where applicable.
>> +	 */
>> +	bit = perf_pmu__format_bits(&arm_spe_pmu->format, "pa_enable");
>> +	if (arm_spe_evsel->core.attr.config & bit)
>> +		evsel__set_sample_bit(arm_spe_evsel, PHYS_ADDR);
>> +
>>  	/* Add dummy event to keep tracking */
>>  	err = parse_events(evlist, "dummy:u", NULL);
>>  	if (err)
>> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
>> index 151cc38a171c..1a80151baed9 100644
>> --- a/tools/perf/util/arm-spe.c
>> +++ b/tools/perf/util/arm-spe.c
>> @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
>>  	memset(&attr, 0, sizeof(struct perf_event_attr));
>>  	attr.size = sizeof(struct perf_event_attr);
>>  	attr.type = PERF_TYPE_HARDWARE;
>> -	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
>> +	attr.sample_type = evsel->core.attr.sample_type &
>> +				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
> 
> I verified this patch and I can confirm the physical address can be
> dumped successfully.
> 
> I have a more general question, seems to me, we need to change the
> macro PERF_SAMPLE_MASK in the file util/event.h as below, so
> here doesn't need to 'or' the flag PERF_SAMPLE_PHYS_ADDR anymore.
> 
> @Arnaldo, @Jiri, could you confirm if this is the right way to move
> forward?  I am not sure why PERF_SAMPLE_MASK doesn't contain the bit
> PERF_SAMPLE_PHYS_ADDR in current code.

I think there is a reason that PERF_SAMPLE_MASK is a subset of all the
bits. This comment below suggests it. Is it so the mask only includes fields
that are 64bits? That makes the __evsel__sample_size() function a simple
multiplication of a count of all the fields that are 64bits.

  static int
  perf_event__check_size(union perf_event *event, unsigned int sample_size)
  {
	/*
	 * The evsel's sample_size is based on PERF_SAMPLE_MASK which includes
	 * up to PERF_SAMPLE_PERIOD.  After that overflow() must be used to
	 * check the format does not go past the end of the event.
	 */
	if (sample_size + sizeof(event->header) > event->header.size)
		return -EFAULT;

	return 0;
  }

Having said that, the mask was updated once to add PERF_SAMPLE_IDENTIFIER to
it, so that comment is slightly out of date now.


> 
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index cdd72e05fd28..c905ac32ebad 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -39,7 +39,7 @@ struct perf_event_attr;
>          PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |          \
>         PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |        \
>          PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |         \
> -        PERF_SAMPLE_IDENTIFIER)
> +        PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_PHYS_ADDR)
> 
> Thanks,
> Leo
> 
>>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
>>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
>>  			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
>> -- 
>> 2.25.1
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
  2022-04-25  9:12       ` James Clark
@ 2022-04-26 13:19         ` Leo Yan
  -1 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-26 13:19 UTC (permalink / raw)
  To: James Clark
  Cc: Timothy Hayes, linux-kernel, linux-perf-users, acme, John Garry,
	Will Deacon, Mathieu Poirier, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, linux-arm-kernel,
	netdev, bpf

On Mon, Apr 25, 2022 at 10:12:36AM +0100, James Clark wrote:

[...]

> >> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> >> index 151cc38a171c..1a80151baed9 100644
> >> --- a/tools/perf/util/arm-spe.c
> >> +++ b/tools/perf/util/arm-spe.c
> >> @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
> >>  	memset(&attr, 0, sizeof(struct perf_event_attr));
> >>  	attr.size = sizeof(struct perf_event_attr);
> >>  	attr.type = PERF_TYPE_HARDWARE;
> >> -	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
> >> +	attr.sample_type = evsel->core.attr.sample_type &
> >> +				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
> > 
> > I verified this patch and I can confirm the physical address can be
> > dumped successfully.
> > 
> > I have a more general question, seems to me, we need to change the
> > macro PERF_SAMPLE_MASK in the file util/event.h as below, so
> > here doesn't need to 'or' the flag PERF_SAMPLE_PHYS_ADDR anymore.
> > 
> > @Arnaldo, @Jiri, could you confirm if this is the right way to move
> > forward?  I am not sure why PERF_SAMPLE_MASK doesn't contain the bit
> > PERF_SAMPLE_PHYS_ADDR in current code.
> 
> I think there is a reason that PERF_SAMPLE_MASK is a subset of all the
> bits. This comment below suggests it. Is it so the mask only includes fields
> that are 64bits? That makes the __evsel__sample_size() function a simple
> multiplication of a count of all the fields that are 64bits.

After reading code, seems the conclusion "a count of all the fields
that are 64bits" is not valid.  PERF_SAMPLE_MASK contains bits
PERF_SAMPLE_IP and PERF_SAMPLE_TID, the corresponding fields 'pid'
and 'tid' in the structure perf_sample are u32 type.

>   static int
>   perf_event__check_size(union perf_event *event, unsigned int sample_size)
>   {
> 	/*
> 	 * The evsel's sample_size is based on PERF_SAMPLE_MASK which includes
> 	 * up to PERF_SAMPLE_PERIOD.  After that overflow() must be used to
> 	 * check the format does not go past the end of the event.
> 	 */
> 	if (sample_size + sizeof(event->header) > event->header.size)
> 		return -EFAULT;

Okay, thanks for sharing the info, it does show that it's deliberately to
not contain all fields in PERF_SAMPLE_MASK.  If so, this patch is fine
for me:

Reviewed-by: Leo Yan <leo.yan@linaro.org>


> 	return 0;
>   }
> 
> Having said that, the mask was updated once to add PERF_SAMPLE_IDENTIFIER to
> it, so that comment is slightly out of date now.
> 
> 
> > 
> > diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> > index cdd72e05fd28..c905ac32ebad 100644
> > --- a/tools/perf/util/event.h
> > +++ b/tools/perf/util/event.h
> > @@ -39,7 +39,7 @@ struct perf_event_attr;
> >          PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |          \
> >         PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |        \
> >          PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |         \
> > -        PERF_SAMPLE_IDENTIFIER)
> > +        PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_PHYS_ADDR)
> > 
> > Thanks,
> > Leo
> > 
> >>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
> >>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
> >>  			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
> >> -- 
> >> 2.25.1
> >>

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses
@ 2022-04-26 13:19         ` Leo Yan
  0 siblings, 0 replies; 22+ messages in thread
From: Leo Yan @ 2022-04-26 13:19 UTC (permalink / raw)
  To: James Clark
  Cc: Timothy Hayes, linux-kernel, linux-perf-users, acme, John Garry,
	Will Deacon, Mathieu Poirier, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, linux-arm-kernel,
	netdev, bpf

On Mon, Apr 25, 2022 at 10:12:36AM +0100, James Clark wrote:

[...]

> >> diff --git a/tools/perf/util/arm-spe.c b/tools/perf/util/arm-spe.c
> >> index 151cc38a171c..1a80151baed9 100644
> >> --- a/tools/perf/util/arm-spe.c
> >> +++ b/tools/perf/util/arm-spe.c
> >> @@ -1033,7 +1033,8 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
> >>  	memset(&attr, 0, sizeof(struct perf_event_attr));
> >>  	attr.size = sizeof(struct perf_event_attr);
> >>  	attr.type = PERF_TYPE_HARDWARE;
> >> -	attr.sample_type = evsel->core.attr.sample_type & PERF_SAMPLE_MASK;
> >> +	attr.sample_type = evsel->core.attr.sample_type &
> >> +				(PERF_SAMPLE_MASK | PERF_SAMPLE_PHYS_ADDR);
> > 
> > I verified this patch and I can confirm the physical address can be
> > dumped successfully.
> > 
> > I have a more general question, seems to me, we need to change the
> > macro PERF_SAMPLE_MASK in the file util/event.h as below, so
> > here doesn't need to 'or' the flag PERF_SAMPLE_PHYS_ADDR anymore.
> > 
> > @Arnaldo, @Jiri, could you confirm if this is the right way to move
> > forward?  I am not sure why PERF_SAMPLE_MASK doesn't contain the bit
> > PERF_SAMPLE_PHYS_ADDR in current code.
> 
> I think there is a reason that PERF_SAMPLE_MASK is a subset of all the
> bits. This comment below suggests it. Is it so the mask only includes fields
> that are 64bits? That makes the __evsel__sample_size() function a simple
> multiplication of a count of all the fields that are 64bits.

After reading code, seems the conclusion "a count of all the fields
that are 64bits" is not valid.  PERF_SAMPLE_MASK contains bits
PERF_SAMPLE_IP and PERF_SAMPLE_TID, the corresponding fields 'pid'
and 'tid' in the structure perf_sample are u32 type.

>   static int
>   perf_event__check_size(union perf_event *event, unsigned int sample_size)
>   {
> 	/*
> 	 * The evsel's sample_size is based on PERF_SAMPLE_MASK which includes
> 	 * up to PERF_SAMPLE_PERIOD.  After that overflow() must be used to
> 	 * check the format does not go past the end of the event.
> 	 */
> 	if (sample_size + sizeof(event->header) > event->header.size)
> 		return -EFAULT;

Okay, thanks for sharing the info, it does show that it's deliberately to
not contain all fields in PERF_SAMPLE_MASK.  If so, this patch is fine
for me:

Reviewed-by: Leo Yan <leo.yan@linaro.org>


> 	return 0;
>   }
> 
> Having said that, the mask was updated once to add PERF_SAMPLE_IDENTIFIER to
> it, so that comment is slightly out of date now.
> 
> 
> > 
> > diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> > index cdd72e05fd28..c905ac32ebad 100644
> > --- a/tools/perf/util/event.h
> > +++ b/tools/perf/util/event.h
> > @@ -39,7 +39,7 @@ struct perf_event_attr;
> >          PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR |          \
> >         PERF_SAMPLE_ID | PERF_SAMPLE_STREAM_ID |        \
> >          PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD |         \
> > -        PERF_SAMPLE_IDENTIFIER)
> > +        PERF_SAMPLE_IDENTIFIER | PERF_SAMPLE_PHYS_ADDR)
> > 
> > Thanks,
> > Leo
> > 
> >>  	attr.sample_type |= PERF_SAMPLE_IP | PERF_SAMPLE_TID |
> >>  			    PERF_SAMPLE_PERIOD | PERF_SAMPLE_DATA_SRC |
> >>  			    PERF_SAMPLE_WEIGHT | PERF_SAMPLE_ADDR;
> >> -- 
> >> 2.25.1
> >>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/3] perf test: Add perf_event_attr test for Arm SPE
  2022-04-24 14:53     ` Leo Yan
@ 2022-04-28 13:41       ` Arnaldo Carvalho de Melo
  -1 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-28 13:41 UTC (permalink / raw)
  To: Leo Yan
  Cc: Timothy Hayes, linux-kernel, linux-perf-users, John Garry,
	Will Deacon, Mathieu Poirier, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, linux-arm-kernel,
	netdev, bpf

Em Sun, Apr 24, 2022 at 10:53:07PM +0800, Leo Yan escreveu:
> On Thu, Apr 21, 2022 at 05:52:05PM +0100, Timothy Hayes wrote:
> > Adds a perf_event_attr test for Arm SPE in which the presence of
> > physical addresses are checked when SPE unit is run with pa_enable=1.
> > 
> > Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
> 
> Reviewed-by: Leo Yan <leo.yan@linaro.org>
> Tested-by: Leo Yan <leo.yan@linaro.org>

Thanks, applied the set to perf/urgent.

- Arnaldo
 
> > ---
> >  tools/perf/tests/attr/README                         |  1 +
> >  .../perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
> >  2 files changed, 13 insertions(+)
> >  create mode 100644 tools/perf/tests/attr/test-record-spe-physical-address
> > 
> > diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
> > index 454505d343fa..eb3f7d4bb324 100644
> > --- a/tools/perf/tests/attr/README
> > +++ b/tools/perf/tests/attr/README
> > @@ -60,6 +60,7 @@ Following tests are defined (with perf commands):
> >    perf record -R kill                           (test-record-raw)
> >    perf record -c 2 -e arm_spe_0// -- kill       (test-record-spe-period)
> >    perf record -e arm_spe_0/period=3/ -- kill    (test-record-spe-period-term)
> > +  perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
> >    perf stat -e cycles kill                      (test-stat-basic)
> >    perf stat kill                                (test-stat-default)
> >    perf stat -d kill                             (test-stat-detailed-1)
> > diff --git a/tools/perf/tests/attr/test-record-spe-physical-address b/tools/perf/tests/attr/test-record-spe-physical-address
> > new file mode 100644
> > index 000000000000..7ebcf5012ce3
> > --- /dev/null
> > +++ b/tools/perf/tests/attr/test-record-spe-physical-address
> > @@ -0,0 +1,12 @@
> > +[config]
> > +command = record
> > +args    = --no-bpf-event -e arm_spe_0/pa_enable=1/ -- kill >/dev/null 2>&1
> > +ret     = 1
> > +arch    = aarch64
> > +
> > +[event-10:base-record-spe]
> > +# 622727 is the decimal of IP|TID|TIME|CPU|IDENTIFIER|DATA_SRC|PHYS_ADDR
> > +sample_type=622727
> > +
> > +# dummy event
> > +[event-1:base-record-spe]
> > \ No newline at end of file
> > -- 
> > 2.25.1
> > 

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/3] perf test: Add perf_event_attr test for Arm SPE
@ 2022-04-28 13:41       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 22+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-04-28 13:41 UTC (permalink / raw)
  To: Leo Yan
  Cc: Timothy Hayes, linux-kernel, linux-perf-users, John Garry,
	Will Deacon, Mathieu Poirier, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, linux-arm-kernel,
	netdev, bpf

Em Sun, Apr 24, 2022 at 10:53:07PM +0800, Leo Yan escreveu:
> On Thu, Apr 21, 2022 at 05:52:05PM +0100, Timothy Hayes wrote:
> > Adds a perf_event_attr test for Arm SPE in which the presence of
> > physical addresses are checked when SPE unit is run with pa_enable=1.
> > 
> > Signed-off-by: Timothy Hayes <timothy.hayes@arm.com>
> 
> Reviewed-by: Leo Yan <leo.yan@linaro.org>
> Tested-by: Leo Yan <leo.yan@linaro.org>

Thanks, applied the set to perf/urgent.

- Arnaldo
 
> > ---
> >  tools/perf/tests/attr/README                         |  1 +
> >  .../perf/tests/attr/test-record-spe-physical-address | 12 ++++++++++++
> >  2 files changed, 13 insertions(+)
> >  create mode 100644 tools/perf/tests/attr/test-record-spe-physical-address
> > 
> > diff --git a/tools/perf/tests/attr/README b/tools/perf/tests/attr/README
> > index 454505d343fa..eb3f7d4bb324 100644
> > --- a/tools/perf/tests/attr/README
> > +++ b/tools/perf/tests/attr/README
> > @@ -60,6 +60,7 @@ Following tests are defined (with perf commands):
> >    perf record -R kill                           (test-record-raw)
> >    perf record -c 2 -e arm_spe_0// -- kill       (test-record-spe-period)
> >    perf record -e arm_spe_0/period=3/ -- kill    (test-record-spe-period-term)
> > +  perf record -e arm_spe_0/pa_enable=1/ -- kill (test-record-spe-physical-address)
> >    perf stat -e cycles kill                      (test-stat-basic)
> >    perf stat kill                                (test-stat-default)
> >    perf stat -d kill                             (test-stat-detailed-1)
> > diff --git a/tools/perf/tests/attr/test-record-spe-physical-address b/tools/perf/tests/attr/test-record-spe-physical-address
> > new file mode 100644
> > index 000000000000..7ebcf5012ce3
> > --- /dev/null
> > +++ b/tools/perf/tests/attr/test-record-spe-physical-address
> > @@ -0,0 +1,12 @@
> > +[config]
> > +command = record
> > +args    = --no-bpf-event -e arm_spe_0/pa_enable=1/ -- kill >/dev/null 2>&1
> > +ret     = 1
> > +arch    = aarch64
> > +
> > +[event-10:base-record-spe]
> > +# 622727 is the decimal of IP|TID|TIME|CPU|IDENTIFIER|DATA_SRC|PHYS_ADDR
> > +sample_type=622727
> > +
> > +# dummy event
> > +[event-1:base-record-spe]
> > \ No newline at end of file
> > -- 
> > 2.25.1
> > 

-- 

- Arnaldo

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2022-04-28 13:53 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 16:52 [PATCH 0/3] perf: arm-spe: Fix addresses of synthesized Arm SPE events Timothy Hayes
2022-04-21 16:52 ` Timothy Hayes
2022-04-21 16:52 ` [PATCH 1/3] perf: arm-spe: Fix addresses of synthesized " Timothy Hayes
2022-04-21 16:52   ` Timothy Hayes
2022-04-24 12:28   ` Leo Yan
2022-04-24 12:28     ` Leo Yan
2022-04-24 15:22     ` Leo Yan
2022-04-24 15:22       ` Leo Yan
2022-04-21 16:52 ` [PATCH 2/3] perf: arm-spe: Fix SPE events with phys addresses Timothy Hayes
2022-04-21 16:52   ` Timothy Hayes
2022-04-24 12:59   ` Leo Yan
2022-04-24 12:59     ` Leo Yan
2022-04-25  9:12     ` James Clark
2022-04-25  9:12       ` James Clark
2022-04-26 13:19       ` Leo Yan
2022-04-26 13:19         ` Leo Yan
2022-04-21 16:52 ` [PATCH 3/3] perf test: Add perf_event_attr test for Arm SPE Timothy Hayes
2022-04-21 16:52   ` Timothy Hayes
2022-04-24 14:53   ` Leo Yan
2022-04-24 14:53     ` Leo Yan
2022-04-28 13:41     ` Arnaldo Carvalho de Melo
2022-04-28 13:41       ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.