linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] perf arm-spe: Add snapshot mode support
@ 2021-11-09 16:30 German Gomez
  2021-11-09 16:30 ` [PATCH v2 1/3] " German Gomez
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: German Gomez @ 2021-11-09 16:30 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: German Gomez, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-arm-kernel

This patchset adds snapshot mode support for arm-spe.

  - [PATCH 1/3] implements the minimal callbacks to support recording in
    snapshot mode.
  - [PATCH 2/3] implements the find_snapshot callback in order to handle
    wrap-arounds in the AUX buffer.
  - [PATCH 3/3] adds a test for spe snapshot mode.

---

Changes since v1:
  - Added acme@kernel.org to the recipients list as I forgot to include
    him in the original patchset [1].
  - Removed [PATCH 1/5] and [PATCH 2/5] in order to keep patches
    semantically relevant.
  - Updated test script test_arm_spe.sh because it wasn't working on
    distributions that use dash shell v0.5.10 (ubuntu 20) [2].

[1] https://lore.kernel.org/all/20210916154635.1525-1-german.gomez@arm.com/
[2] https://lore.kernel.org/all/fd65eb63-d4ca-2105-74cb-c717ad2eb7d3@arm.com/

German Gomez (3):
  perf arm-spe: Add snapshot mode support
  perf arm-spe: Implement find_snapshot callback
  perf arm-spe: Snapshot mode test

 tools/perf/arch/arm64/util/arm-spe.c   | 275 +++++++++++++++++++++++++
 tools/perf/tests/shell/test_arm_spe.sh |  89 ++++++++
 2 files changed, 364 insertions(+)
 create mode 100755 tools/perf/tests/shell/test_arm_spe.sh

-- 
2.25.1


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

* [PATCH v2 1/3] perf arm-spe: Add snapshot mode support
  2021-11-09 16:30 [PATCH v2 0/3] perf arm-spe: Add snapshot mode support German Gomez
@ 2021-11-09 16:30 ` German Gomez
  2021-11-09 16:30 ` [PATCH v2 2/3] perf arm-spe: Implement find_snapshot callback German Gomez
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: German Gomez @ 2021-11-09 16:30 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: German Gomez, James Clark, Leo Yan, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-arm-kernel

This patch enables support for snapshot mode of arm_spe events,
including the implementation of the necessary callbacks (excluding
find_snapshot, which is to be included in a followup commit).

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: German Gomez <german.gomez@arm.com>
Reviewed-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/arch/arm64/util/arm-spe.c | 130 +++++++++++++++++++++++++++
 1 file changed, 130 insertions(+)

diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index a4420d4df..f8b03d164 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -84,6 +84,55 @@ static int arm_spe_info_fill(struct auxtrace_record *itr,
 	return 0;
 }
 
+static void
+arm_spe_snapshot_resolve_auxtrace_defaults(struct record_opts *opts,
+					   bool privileged)
+{
+	/*
+	 * The default snapshot size is the auxtrace mmap size. If neither auxtrace mmap size nor
+	 * snapshot size is specified, then the default is 4MiB for privileged users, 128KiB for
+	 * unprivileged users.
+	 *
+	 * The default auxtrace mmap size is 4MiB/page_size for privileged users, 128KiB for
+	 * unprivileged users. If an unprivileged user does not specify mmap pages, the mmap pages
+	 * will be reduced from the default 512KiB/page_size to 256KiB/page_size, otherwise the
+	 * user is likely to get an error as they exceed their mlock limmit.
+	 */
+
+	/*
+	 * No size were given to '-S' or '-m,', so go with the default
+	 */
+	if (!opts->auxtrace_snapshot_size && !opts->auxtrace_mmap_pages) {
+		if (privileged) {
+			opts->auxtrace_mmap_pages = MiB(4) / page_size;
+		} else {
+			opts->auxtrace_mmap_pages = KiB(128) / page_size;
+			if (opts->mmap_pages == UINT_MAX)
+				opts->mmap_pages = KiB(256) / page_size;
+		}
+	} else if (!opts->auxtrace_mmap_pages && !privileged && opts->mmap_pages == UINT_MAX) {
+		opts->mmap_pages = KiB(256) / page_size;
+	}
+
+	/*
+	 * '-m,xyz' was specified but no snapshot size, so make the snapshot size as big as the
+	 * auxtrace mmap area.
+	 */
+	if (!opts->auxtrace_snapshot_size)
+		opts->auxtrace_snapshot_size = opts->auxtrace_mmap_pages * (size_t)page_size;
+
+	/*
+	 * '-Sxyz' was specified but no auxtrace mmap area, so make the auxtrace mmap area big
+	 * enough to fit the requested snapshot size.
+	 */
+	if (!opts->auxtrace_mmap_pages) {
+		size_t sz = opts->auxtrace_snapshot_size;
+
+		sz = round_up(sz, page_size) / page_size;
+		opts->auxtrace_mmap_pages = roundup_pow_of_two(sz);
+	}
+}
+
 static int arm_spe_recording_options(struct auxtrace_record *itr,
 				     struct evlist *evlist,
 				     struct record_opts *opts)
@@ -115,6 +164,36 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
 	if (!opts->full_auxtrace)
 		return 0;
 
+	/*
+	 * we are in snapshot mode.
+	 */
+	if (opts->auxtrace_snapshot_mode) {
+		/*
+		 * Command arguments '-Sxyz' and/or '-m,xyz' are missing, so fill those in with
+		 * default values.
+		 */
+		if (!opts->auxtrace_snapshot_size || !opts->auxtrace_mmap_pages)
+			arm_spe_snapshot_resolve_auxtrace_defaults(opts, privileged);
+
+		/*
+		 * Snapshot size can't be bigger than the auxtrace area.
+		 */
+		if (opts->auxtrace_snapshot_size > opts->auxtrace_mmap_pages * (size_t)page_size) {
+			pr_err("Snapshot size %zu must not be greater than AUX area tracing mmap size %zu\n",
+			       opts->auxtrace_snapshot_size,
+			       opts->auxtrace_mmap_pages * (size_t)page_size);
+			return -EINVAL;
+		}
+
+		/*
+		 * Something went wrong somewhere - this shouldn't happen.
+		 */
+		if (!opts->auxtrace_snapshot_size || !opts->auxtrace_mmap_pages) {
+			pr_err("Failed to calculate default snapshot size and/or AUX area tracing mmap pages\n");
+			return -EINVAL;
+		}
+	}
+
 	/* We are in full trace mode but '-m,xyz' wasn't specified */
 	if (!opts->auxtrace_mmap_pages) {
 		if (privileged) {
@@ -138,6 +217,9 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
 		}
 	}
 
+	if (opts->auxtrace_snapshot_mode)
+		pr_debug2("%sx snapshot size: %zu\n", ARM_SPE_PMU_NAME,
+			  opts->auxtrace_snapshot_size);
 
 	/*
 	 * To obtain the auxtrace buffer file descriptor, the auxtrace event
@@ -172,6 +254,51 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,
 	return 0;
 }
 
+static int arm_spe_parse_snapshot_options(struct auxtrace_record *itr __maybe_unused,
+					 struct record_opts *opts,
+					 const char *str)
+{
+	unsigned long long snapshot_size = 0;
+	char *endptr;
+
+	if (str) {
+		snapshot_size = strtoull(str, &endptr, 0);
+		if (*endptr || snapshot_size > SIZE_MAX)
+			return -1;
+	}
+
+	opts->auxtrace_snapshot_mode = true;
+	opts->auxtrace_snapshot_size = snapshot_size;
+
+	return 0;
+}
+
+static int arm_spe_snapshot_start(struct auxtrace_record *itr)
+{
+	struct arm_spe_recording *ptr =
+			container_of(itr, struct arm_spe_recording, itr);
+	struct evsel *evsel;
+
+	evlist__for_each_entry(ptr->evlist, evsel) {
+		if (evsel->core.attr.type == ptr->arm_spe_pmu->type)
+			return evsel__disable(evsel);
+	}
+	return -EINVAL;
+}
+
+static int arm_spe_snapshot_finish(struct auxtrace_record *itr)
+{
+	struct arm_spe_recording *ptr =
+			container_of(itr, struct arm_spe_recording, itr);
+	struct evsel *evsel;
+
+	evlist__for_each_entry(ptr->evlist, evsel) {
+		if (evsel->core.attr.type == ptr->arm_spe_pmu->type)
+			return evsel__enable(evsel);
+	}
+	return -EINVAL;
+}
+
 static u64 arm_spe_reference(struct auxtrace_record *itr __maybe_unused)
 {
 	struct timespec ts;
@@ -207,6 +334,9 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
 
 	sper->arm_spe_pmu = arm_spe_pmu;
 	sper->itr.pmu = arm_spe_pmu;
+	sper->itr.snapshot_start = arm_spe_snapshot_start;
+	sper->itr.snapshot_finish = arm_spe_snapshot_finish;
+	sper->itr.parse_snapshot_options = arm_spe_parse_snapshot_options;
 	sper->itr.recording_options = arm_spe_recording_options;
 	sper->itr.info_priv_size = arm_spe_info_priv_size;
 	sper->itr.info_fill = arm_spe_info_fill;
-- 
2.25.1


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

* [PATCH v2 2/3] perf arm-spe: Implement find_snapshot callback
  2021-11-09 16:30 [PATCH v2 0/3] perf arm-spe: Add snapshot mode support German Gomez
  2021-11-09 16:30 ` [PATCH v2 1/3] " German Gomez
@ 2021-11-09 16:30 ` German Gomez
  2021-11-09 16:30 ` [PATCH v2 3/3] perf arm-spe: Snapshot mode test German Gomez
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: German Gomez @ 2021-11-09 16:30 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: German Gomez, James Clark, Leo Yan, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-arm-kernel

The head pointer of the AUX buffer managed by the arm_spe_pmu.c driver
is not monotonically increasing, therefore the find_snapshot callback is
needed in order to find the trace data within the AUX buffer and avoid
wasting space in the perf.data file.

The pointer is assumed to have wrapped if the buffer contains non-zero
data at the end. If it has wrapped, the entire contents of the AUX
buffer are stored in the perf.data file. Otherwise only the data up to
the head pointer is stored.

Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: German Gomez <german.gomez@arm.com>
Reviewed-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/arch/arm64/util/arm-spe.c | 145 +++++++++++++++++++++++++++
 1 file changed, 145 insertions(+)

diff --git a/tools/perf/arch/arm64/util/arm-spe.c b/tools/perf/arch/arm64/util/arm-spe.c
index f8b03d164..56785034f 100644
--- a/tools/perf/arch/arm64/util/arm-spe.c
+++ b/tools/perf/arch/arm64/util/arm-spe.c
@@ -23,6 +23,7 @@
 #include "../../../util/auxtrace.h"
 #include "../../../util/record.h"
 #include "../../../util/arm-spe.h"
+#include <tools/libc_compat.h> // reallocarray
 
 #define KiB(x) ((x) * 1024)
 #define MiB(x) ((x) * 1024 * 1024)
@@ -31,6 +32,8 @@ struct arm_spe_recording {
 	struct auxtrace_record		itr;
 	struct perf_pmu			*arm_spe_pmu;
 	struct evlist		*evlist;
+	int			wrapped_cnt;
+	bool			*wrapped;
 };
 
 static void arm_spe_set_timestamp(struct auxtrace_record *itr,
@@ -299,6 +302,146 @@ static int arm_spe_snapshot_finish(struct auxtrace_record *itr)
 	return -EINVAL;
 }
 
+static int arm_spe_alloc_wrapped_array(struct arm_spe_recording *ptr, int idx)
+{
+	bool *wrapped;
+	int cnt = ptr->wrapped_cnt, new_cnt, i;
+
+	/*
+	 * No need to allocate, so return early.
+	 */
+	if (idx < cnt)
+		return 0;
+
+	/*
+	 * Make ptr->wrapped as big as idx.
+	 */
+	new_cnt = idx + 1;
+
+	/*
+	 * Free'ed in arm_spe_recording_free().
+	 */
+	wrapped = reallocarray(ptr->wrapped, new_cnt, sizeof(bool));
+	if (!wrapped)
+		return -ENOMEM;
+
+	/*
+	 * init new allocated values.
+	 */
+	for (i = cnt; i < new_cnt; i++)
+		wrapped[i] = false;
+
+	ptr->wrapped_cnt = new_cnt;
+	ptr->wrapped = wrapped;
+
+	return 0;
+}
+
+static bool arm_spe_buffer_has_wrapped(unsigned char *buffer,
+				      size_t buffer_size, u64 head)
+{
+	u64 i, watermark;
+	u64 *buf = (u64 *)buffer;
+	size_t buf_size = buffer_size;
+
+	/*
+	 * Defensively handle the case where head might be continually increasing - if its value is
+	 * equal or greater than the size of the ring buffer, then we can safely determine it has
+	 * wrapped around. Otherwise, continue to detect if head might have wrapped.
+	 */
+	if (head >= buffer_size)
+		return true;
+
+	/*
+	 * We want to look the very last 512 byte (chosen arbitrarily) in the ring buffer.
+	 */
+	watermark = buf_size - 512;
+
+	/*
+	 * The value of head is somewhere within the size of the ring buffer. This can be that there
+	 * hasn't been enough data to fill the ring buffer yet or the trace time was so long that
+	 * head has numerically wrapped around.  To find we need to check if we have data at the
+	 * very end of the ring buffer.  We can reliably do this because mmap'ed pages are zeroed
+	 * out and there is a fresh mapping with every new session.
+	 */
+
+	/*
+	 * head is less than 512 byte from the end of the ring buffer.
+	 */
+	if (head > watermark)
+		watermark = head;
+
+	/*
+	 * Speed things up by using 64 bit transactions (see "u64 *buf" above)
+	 */
+	watermark /= sizeof(u64);
+	buf_size /= sizeof(u64);
+
+	/*
+	 * If we find trace data at the end of the ring buffer, head has been there and has
+	 * numerically wrapped around at least once.
+	 */
+	for (i = watermark; i < buf_size; i++)
+		if (buf[i])
+			return true;
+
+	return false;
+}
+
+static int arm_spe_find_snapshot(struct auxtrace_record *itr, int idx,
+				  struct auxtrace_mmap *mm, unsigned char *data,
+				  u64 *head, u64 *old)
+{
+	int err;
+	bool wrapped;
+	struct arm_spe_recording *ptr =
+			container_of(itr, struct arm_spe_recording, itr);
+
+	/*
+	 * Allocate memory to keep track of wrapping if this is the first
+	 * time we deal with this *mm.
+	 */
+	if (idx >= ptr->wrapped_cnt) {
+		err = arm_spe_alloc_wrapped_array(ptr, idx);
+		if (err)
+			return err;
+	}
+
+	/*
+	 * Check to see if *head has wrapped around.  If it hasn't only the
+	 * amount of data between *head and *old is snapshot'ed to avoid
+	 * bloating the perf.data file with zeros.  But as soon as *head has
+	 * wrapped around the entire size of the AUX ring buffer it taken.
+	 */
+	wrapped = ptr->wrapped[idx];
+	if (!wrapped && arm_spe_buffer_has_wrapped(data, mm->len, *head)) {
+		wrapped = true;
+		ptr->wrapped[idx] = true;
+	}
+
+	pr_debug3("%s: mmap index %d old head %zu new head %zu size %zu\n",
+		  __func__, idx, (size_t)*old, (size_t)*head, mm->len);
+
+	/*
+	 * No wrap has occurred, we can just use *head and *old.
+	 */
+	if (!wrapped)
+		return 0;
+
+	/*
+	 * *head has wrapped around - adjust *head and *old to pickup the
+	 * entire content of the AUX buffer.
+	 */
+	if (*head >= mm->len) {
+		*old = *head - mm->len;
+	} else {
+		*head += mm->len;
+		*old = *head - mm->len;
+	}
+
+	return 0;
+}
+
 static u64 arm_spe_reference(struct auxtrace_record *itr __maybe_unused)
 {
 	struct timespec ts;
@@ -313,6 +456,7 @@ static void arm_spe_recording_free(struct auxtrace_record *itr)
 	struct arm_spe_recording *sper =
 			container_of(itr, struct arm_spe_recording, itr);
 
+	free(sper->wrapped);
 	free(sper);
 }
 
@@ -336,6 +480,7 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
 	sper->itr.pmu = arm_spe_pmu;
 	sper->itr.snapshot_start = arm_spe_snapshot_start;
 	sper->itr.snapshot_finish = arm_spe_snapshot_finish;
+	sper->itr.find_snapshot = arm_spe_find_snapshot;
 	sper->itr.parse_snapshot_options = arm_spe_parse_snapshot_options;
 	sper->itr.recording_options = arm_spe_recording_options;
 	sper->itr.info_priv_size = arm_spe_info_priv_size;
-- 
2.25.1


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

* [PATCH v2 3/3] perf arm-spe: Snapshot mode test
  2021-11-09 16:30 [PATCH v2 0/3] perf arm-spe: Add snapshot mode support German Gomez
  2021-11-09 16:30 ` [PATCH v2 1/3] " German Gomez
  2021-11-09 16:30 ` [PATCH v2 2/3] perf arm-spe: Implement find_snapshot callback German Gomez
@ 2021-11-09 16:30 ` German Gomez
  2021-11-11  8:32   ` Leo Yan
  2021-11-10 23:52 ` [PATCH v2 0/3] perf arm-spe: Add snapshot mode support Namhyung Kim
  2021-11-11  8:46 ` Leo Yan
  4 siblings, 1 reply; 8+ messages in thread
From: German Gomez @ 2021-11-09 16:30 UTC (permalink / raw)
  To: linux-kernel, linux-perf-users, acme
  Cc: German Gomez, John Garry, Will Deacon, Mathieu Poirier, Leo Yan,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-arm-kernel

Shell script test_arm_spe.sh has been added to test the recording of SPE
tracing events in snapshot mode.

Signed-off-by: German Gomez <german.gomez@arm.com>
---
 tools/perf/tests/shell/test_arm_spe.sh | 89 ++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100755 tools/perf/tests/shell/test_arm_spe.sh

diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
new file mode 100755
index 000000000..e59044edc
--- /dev/null
+++ b/tools/perf/tests/shell/test_arm_spe.sh
@@ -0,0 +1,89 @@
+#!/bin/sh
+# Check Arm SPE trace data recording and synthesized samples
+
+# Uses the 'perf record' to record trace data of Arm SPE events;
+# then verify if any SPE event samples are generated by SPE with
+# 'perf script' and 'perf report' commands.
+
+# SPDX-License-Identifier: GPL-2.0
+# German Gomez <german.gomez@arm.com>, 2021
+
+skip_if_no_arm_spe_event() {
+	perf list | egrep -q 'arm_spe_[0-9]+//' && return 0
+
+	# arm_spe event doesn't exist
+	return 2
+}
+
+skip_if_no_arm_spe_event || exit 2
+
+perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
+glb_err=0
+
+cleanup_files()
+{
+	rm -f ${perfdata}
+	exit $glb_err
+}
+
+trap cleanup_files exit term int
+
+arm_spe_report() {
+	if [ $2 != 0 ]; then
+		echo "$1: FAIL"
+		glb_err=$2
+	else
+		echo "$1: PASS"
+	fi
+}
+
+perf_script_samples() {
+	echo "Looking at perf.data file for dumping samples:"
+
+	# from arm-spe.c/arm_spe_synth_events()
+	events="(ld1-miss|ld1-access|llc-miss|lld-access|tlb-miss|tlb-access|branch-miss|remote-access|memory)"
+
+	# Below is an example of the samples dumping:
+	#	dd  3048 [002]          1    l1d-access:      ffffaa64999c __GI___libc_write+0x3c (/lib/aarch64-linux-gnu/libc-2.27.so)
+	#	dd  3048 [002]          1    tlb-access:      ffffaa64999c __GI___libc_write+0x3c (/lib/aarch64-linux-gnu/libc-2.27.so)
+	#	dd  3048 [002]          1        memory:      ffffaa64999c __GI___libc_write+0x3c (/lib/aarch64-linux-gnu/libc-2.27.so)
+	perf script -F,-time -i ${perfdata} 2>&1 | \
+		egrep " +$1 +[0-9]+ .* +${events}:(.*:)? +" > /dev/null 2>&1
+}
+
+perf_report_samples() {
+	echo "Looking at perf.data file for reporting samples:"
+
+	# Below is an example of the samples reporting:
+	#   73.04%    73.04%  dd    libc-2.27.so      [.] _dl_addr
+	#    7.71%     7.71%  dd    libc-2.27.so      [.] getenv
+	#    2.59%     2.59%  dd    ld-2.27.so        [.] strcmp
+	perf report --stdio -i ${perfdata} 2>&1 | \
+		egrep " +[0-9]+\.[0-9]+% +[0-9]+\.[0-9]+% +$1 " > /dev/null 2>&1
+}
+
+arm_spe_snapshot_test() {
+	echo "Recording trace with snapshot mode $perfdata"
+	perf record -o ${perfdata} -e arm_spe// -S \
+		-- dd if=/dev/zero of=/dev/null > /dev/null 2>&1 &
+	PERFPID=$!
+
+	# Wait for perf program
+	sleep 1
+
+	# Send signal to snapshot trace data
+	kill -USR2 $PERFPID
+
+	# Stop perf program
+	kill $PERFPID
+	wait $PERFPID
+
+	perf_script_samples dd &&
+	perf_report_samples dd
+
+	err=$?
+	arm_spe_report "SPE snapshot testing" $err
+}
+
+arm_spe_snapshot_test
+exit $glb_err
-- 
2.25.1


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

* Re: [PATCH v2 0/3] perf arm-spe: Add snapshot mode support
  2021-11-09 16:30 [PATCH v2 0/3] perf arm-spe: Add snapshot mode support German Gomez
                   ` (2 preceding siblings ...)
  2021-11-09 16:30 ` [PATCH v2 3/3] perf arm-spe: Snapshot mode test German Gomez
@ 2021-11-10 23:52 ` Namhyung Kim
  2021-11-11  8:46 ` Leo Yan
  4 siblings, 0 replies; 8+ messages in thread
From: Namhyung Kim @ 2021-11-10 23:52 UTC (permalink / raw)
  To: German Gomez
  Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
	John Garry, Will Deacon, Mathieu Poirier, Leo Yan, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, linux-arm-kernel

Hello,

On Tue, Nov 9, 2021 at 8:30 AM German Gomez <german.gomez@arm.com> wrote:
>
> This patchset adds snapshot mode support for arm-spe.
>
>   - [PATCH 1/3] implements the minimal callbacks to support recording in
>     snapshot mode.
>   - [PATCH 2/3] implements the find_snapshot callback in order to handle
>     wrap-arounds in the AUX buffer.
>   - [PATCH 3/3] adds a test for spe snapshot mode.
>
> ---
>
> Changes since v1:
>   - Added acme@kernel.org to the recipients list as I forgot to include
>     him in the original patchset [1].
>   - Removed [PATCH 1/5] and [PATCH 2/5] in order to keep patches
>     semantically relevant.
>   - Updated test script test_arm_spe.sh because it wasn't working on
>     distributions that use dash shell v0.5.10 (ubuntu 20) [2].
>
> [1] https://lore.kernel.org/all/20210916154635.1525-1-german.gomez@arm.com/
> [2] https://lore.kernel.org/all/fd65eb63-d4ca-2105-74cb-c717ad2eb7d3@arm.com/
>
> German Gomez (3):
>   perf arm-spe: Add snapshot mode support
>   perf arm-spe: Implement find_snapshot callback
>   perf arm-spe: Snapshot mode test

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

>
>  tools/perf/arch/arm64/util/arm-spe.c   | 275 +++++++++++++++++++++++++
>  tools/perf/tests/shell/test_arm_spe.sh |  89 ++++++++
>  2 files changed, 364 insertions(+)
>  create mode 100755 tools/perf/tests/shell/test_arm_spe.sh
>
> --
> 2.25.1
>

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

* Re: [PATCH v2 3/3] perf arm-spe: Snapshot mode test
  2021-11-09 16:30 ` [PATCH v2 3/3] perf arm-spe: Snapshot mode test German Gomez
@ 2021-11-11  8:32   ` Leo Yan
  0 siblings, 0 replies; 8+ messages in thread
From: Leo Yan @ 2021-11-11  8:32 UTC (permalink / raw)
  To: German Gomez
  Cc: linux-kernel, linux-perf-users, acme, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-arm-kernel

On Tue, Nov 09, 2021 at 04:30:09PM +0000, German Gomez wrote:
> Shell script test_arm_spe.sh has been added to test the recording of SPE
> tracing events in snapshot mode.
> 
> Signed-off-by: German Gomez <german.gomez@arm.com>

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

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

* Re: [PATCH v2 0/3] perf arm-spe: Add snapshot mode support
  2021-11-09 16:30 [PATCH v2 0/3] perf arm-spe: Add snapshot mode support German Gomez
                   ` (3 preceding siblings ...)
  2021-11-10 23:52 ` [PATCH v2 0/3] perf arm-spe: Add snapshot mode support Namhyung Kim
@ 2021-11-11  8:46 ` Leo Yan
  2021-11-11 14:54   ` Arnaldo Carvalho de Melo
  4 siblings, 1 reply; 8+ messages in thread
From: Leo Yan @ 2021-11-11  8:46 UTC (permalink / raw)
  To: German Gomez, Arnaldo Carvalho de Melo
  Cc: linux-kernel, linux-perf-users, John Garry, Will Deacon,
	Mathieu Poirier, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-arm-kernel

Hi Arnaldo,

On Tue, Nov 09, 2021 at 04:30:06PM +0000, German Gomez wrote:
> This patchset adds snapshot mode support for arm-spe.
> 
>   - [PATCH 1/3] implements the minimal callbacks to support recording in
>     snapshot mode.
>   - [PATCH 2/3] implements the find_snapshot callback in order to handle
>     wrap-arounds in the AUX buffer.
>   - [PATCH 3/3] adds a test for spe snapshot mode.

I have verified this patch set on Hisilicon D06 board, please consider
to pick up:

root@ubuntu:/home/leoy/linux/tools/perf# ./perf test -v 85
85: Check Arm SPE trace data recording and synthesized samples      :
--- start ---
test child forked, pid 17083
Recording trace with snapshot mode /tmp/__perf_test.perf.data.MI2iX
Looking at perf.data file for dumping samples:
Looking at perf.data file for reporting samples:
SPE snapshot testing: PASS
test child finished with 0
---- end ----
Check Arm SPE trace data recording and synthesized samples: Ok

BTW, you could see German has another patch set for enabling pid/tid
for Arm SPE tracing [1].  I confirmed that the pid/tid patch set and
current patch set have no conflit, and don't need worry the dependency
between these two patch sets (so you could apply two patch sets in any
ordering).

Thanks,
Leo

[1] https://lore.kernel.org/lkml/20211111072714.GB102075@leoy-ThinkPad-X240s/T/#m932fd26d54278208331d4e3c32597cf63b6d4341

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

* Re: [PATCH v2 0/3] perf arm-spe: Add snapshot mode support
  2021-11-11  8:46 ` Leo Yan
@ 2021-11-11 14:54   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 8+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-11-11 14:54 UTC (permalink / raw)
  To: Leo Yan
  Cc: German Gomez, linux-kernel, linux-perf-users, John Garry,
	Will Deacon, Mathieu Poirier, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-arm-kernel

Em Thu, Nov 11, 2021 at 04:46:21PM +0800, Leo Yan escreveu:
> Hi Arnaldo,
> 
> On Tue, Nov 09, 2021 at 04:30:06PM +0000, German Gomez wrote:
> > This patchset adds snapshot mode support for arm-spe.
> > 
> >   - [PATCH 1/3] implements the minimal callbacks to support recording in
> >     snapshot mode.
> >   - [PATCH 2/3] implements the find_snapshot callback in order to handle
> >     wrap-arounds in the AUX buffer.
> >   - [PATCH 3/3] adds a test for spe snapshot mode.
> 
> I have verified this patch set on Hisilicon D06 board, please consider
> to pick up:
> 
> root@ubuntu:/home/leoy/linux/tools/perf# ./perf test -v 85
> 85: Check Arm SPE trace data recording and synthesized samples      :
> --- start ---
> test child forked, pid 17083
> Recording trace with snapshot mode /tmp/__perf_test.perf.data.MI2iX
> Looking at perf.data file for dumping samples:
> Looking at perf.data file for reporting samples:
> SPE snapshot testing: PASS
> test child finished with 0
> ---- end ----
> Check Arm SPE trace data recording and synthesized samples: Ok
> 
> BTW, you could see German has another patch set for enabling pid/tid
> for Arm SPE tracing [1].  I confirmed that the pid/tid patch set and
> current patch set have no conflit, and don't need worry the dependency
> between these two patch sets (so you could apply two patch sets in any
> ordering).

Thanks for the clarifications, applied, its out in my tmp.perf/core
branch, that still needs some fixes for buiding on arm related to a
recent patchset for 'perf test' from Ian Rogers, as soon as that is
fixed it will be set in stone in perf/core.

- Arnaldo

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

end of thread, other threads:[~2021-11-11 14:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-09 16:30 [PATCH v2 0/3] perf arm-spe: Add snapshot mode support German Gomez
2021-11-09 16:30 ` [PATCH v2 1/3] " German Gomez
2021-11-09 16:30 ` [PATCH v2 2/3] perf arm-spe: Implement find_snapshot callback German Gomez
2021-11-09 16:30 ` [PATCH v2 3/3] perf arm-spe: Snapshot mode test German Gomez
2021-11-11  8:32   ` Leo Yan
2021-11-10 23:52 ` [PATCH v2 0/3] perf arm-spe: Add snapshot mode support Namhyung Kim
2021-11-11  8:46 ` Leo Yan
2021-11-11 14:54   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).