2022-07-01 23:38:12

by Namhyung Kim

[permalink] [raw]
Subject: [PATCH v3] perf test: Add ARM SPE system wide test

In the past it had a problem not setting the pid/tid on the sample
correctly when system-wide mode is used. Although it's fixed now it'd
be nice if we have a test case for it.

Cc: German Gomez <[email protected]>
Cc: Leo Yan <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
---
* skip if system-wide record was failed
* use dummy event for testing

tools/perf/tests/shell/test_arm_spe.sh | 30 +++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
index e59044edc406..0d47479adba8 100755
--- a/tools/perf/tests/shell/test_arm_spe.sh
+++ b/tools/perf/tests/shell/test_arm_spe.sh
@@ -23,17 +23,20 @@ glb_err=0
cleanup_files()
{
rm -f ${perfdata}
+ rm -f ${perfdata}.old
exit $glb_err
}

trap cleanup_files exit term int

arm_spe_report() {
- if [ $2 != 0 ]; then
+ if [ $2 = 0 ]; then
+ echo "$1: PASS"
+ elif [ $2 = 2 ]; then
+ echo "$1: SKIPPED"
+ else
echo "$1: FAIL"
glb_err=$2
- else
- echo "$1: PASS"
fi
}

@@ -85,5 +88,26 @@ arm_spe_snapshot_test() {
arm_spe_report "SPE snapshot testing" $err
}

+arm_spe_system_wide_test() {
+ echo "Recording trace with system-wide mode $perfdata"
+
+ perf record -o - -e dummy -a -B true > /dev/null 2>&1
+ if [ $? != 0 ]; then
+ arm_spe_report "SPE system-wide testing" 2
+ return
+ fi
+
+ perf record -o ${perfdata} -e arm_spe// -a --no-bpf-event \
+ -- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
+
+ perf_script_samples dd &&
+ perf_report_samples dd
+
+ err=$?
+ arm_spe_report "SPE system-wide testing" $err
+}
+
arm_spe_snapshot_test
+arm_spe_system_wide_test
+
exit $glb_err
--
2.37.0.rc0.161.g10f37bed90-goog


2022-07-04 10:29:18

by German Gomez

[permalink] [raw]
Subject: Re: [PATCH v3] perf test: Add ARM SPE system wide test


On 02/07/2022 00:09, Namhyung Kim wrote:
> In the past it had a problem not setting the pid/tid on the sample
> correctly when system-wide mode is used. Although it's fixed now it'd
> be nice if we have a test case for it.
>
> Cc: German Gomez <[email protected]>
> Cc: Leo Yan <[email protected]>
> Signed-off-by: Namhyung Kim <[email protected]>

Reviewed-by: German Gomez <[email protected]>

> ---
> * skip if system-wide record was failed
> * use dummy event for testing

Thanks,
German

2022-07-07 04:15:16

by Leo Yan

[permalink] [raw]
Subject: Re: [PATCH v3] perf test: Add ARM SPE system wide test

On Fri, Jul 01, 2022 at 04:09:32PM -0700, Namhyung Kim wrote:
> In the past it had a problem not setting the pid/tid on the sample
> correctly when system-wide mode is used. Although it's fixed now it'd
> be nice if we have a test case for it.
>
> Cc: German Gomez <[email protected]>
> Cc: Leo Yan <[email protected]>
> Signed-off-by: Namhyung Kim <[email protected]>

Tested for both root user and non-privileged user, both works as
expected:

Tested-by: Leo Yan <[email protected]>

2022-08-01 18:14:18

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v3] perf test: Add ARM SPE system wide test

Em Thu, Jul 07, 2022 at 11:13:52AM +0800, Leo Yan escreveu:
> On Fri, Jul 01, 2022 at 04:09:32PM -0700, Namhyung Kim wrote:
> > In the past it had a problem not setting the pid/tid on the sample
> > correctly when system-wide mode is used. Although it's fixed now it'd
> > be nice if we have a test case for it.
> >
> > Cc: German Gomez <[email protected]>
> > Cc: Leo Yan <[email protected]>
> > Signed-off-by: Namhyung Kim <[email protected]>
>
> Tested for both root user and non-privileged user, both works as
> expected:
>
> Tested-by: Leo Yan <[email protected]>

Thanks, applied.

- Arnaldo