linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf test: Add ARM SPE system wide test
@ 2022-06-15 19:07 Namhyung Kim
  2022-06-16 10:12 ` German Gomez
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2022-06-15 19:07 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ingo Molnar, Peter Zijlstra, LKML, Ian Rogers, linux-perf-users,
	John Garry, Will Deacon, James Clark, Mike Leach, German Gomez,
	Leo Yan

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 <german.gomez@arm.com>
Cc: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/tests/shell/test_arm_spe.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
index e59044edc406..b9c588ae393b 100755
--- a/tools/perf/tests/shell/test_arm_spe.sh
+++ b/tools/perf/tests/shell/test_arm_spe.sh
@@ -23,6 +23,7 @@ glb_err=0
 cleanup_files()
 {
 	rm -f ${perfdata}
+	rm -f ${perfdata}.old
 	exit $glb_err
 }
 
@@ -85,5 +86,19 @@ 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 ${perfdata} -e arm_spe// -a \
+		-- 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.36.1.476.g0c4daa206d-goog


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

* Re: [PATCH] perf test: Add ARM SPE system wide test
  2022-06-15 19:07 [PATCH] perf test: Add ARM SPE system wide test Namhyung Kim
@ 2022-06-16 10:12 ` German Gomez
  2022-06-16 16:43   ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: German Gomez @ 2022-06-16 10:12 UTC (permalink / raw)
  To: Namhyung Kim, Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ingo Molnar, Peter Zijlstra, LKML, Ian Rogers, linux-perf-users,
	John Garry, Will Deacon, James Clark, Mike Leach, Leo Yan

[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]

Thanks for the patch, Namhyung

On 15/06/2022 20:07, 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 <german.gomez@arm.com>
> Cc: Leo Yan <leo.yan@linaro.org>
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/tests/shell/test_arm_spe.sh | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
> index e59044edc406..b9c588ae393b 100755
> --- a/tools/perf/tests/shell/test_arm_spe.sh
> +++ b/tools/perf/tests/shell/test_arm_spe.sh
> @@ -23,6 +23,7 @@ glb_err=0
>  cleanup_files()
>  {
>  	rm -f ${perfdata}
> +	rm -f ${perfdata}.old
>  	exit $glb_err
>  }
>  
> @@ -85,5 +86,19 @@ 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 ${perfdata} -e arm_spe// -a \
> +		-- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
> +

Should we skip if we don't have privileges for CPU tracing? (attached diff)

German

> +	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

[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 798 bytes --]

diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
index b9c588ae3..962841a51 100755
--- a/tools/perf/tests/shell/test_arm_spe.sh
+++ b/tools/perf/tests/shell/test_arm_spe.sh
@@ -30,11 +30,13 @@ cleanup_files()
 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
 }
 
@@ -91,6 +93,11 @@ arm_spe_system_wide_test() {
 	perf record -o ${perfdata} -e arm_spe// -a \
 		-- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
 
+	if [ $? != 0 ]; then
+		arm_spe_report "SPE system-wide testing" 2
+		return
+	fi
+
 	perf_script_samples dd &&
 	perf_report_samples dd
 

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

* Re: [PATCH] perf test: Add ARM SPE system wide test
  2022-06-16 10:12 ` German Gomez
@ 2022-06-16 16:43   ` Namhyung Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Namhyung Kim @ 2022-06-16 16:43 UTC (permalink / raw)
  To: German Gomez
  Cc: Arnaldo Carvalho de Melo, Jiri Olsa, Ingo Molnar, Peter Zijlstra,
	LKML, Ian Rogers, linux-perf-users, John Garry, Will Deacon,
	James Clark, Mike Leach, Leo Yan

Hello,

On Thu, Jun 16, 2022 at 3:12 AM German Gomez <german.gomez@arm.com> wrote:
>
> Thanks for the patch, Namhyung
>
> On 15/06/2022 20:07, 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 <german.gomez@arm.com>
> > Cc: Leo Yan <leo.yan@linaro.org>
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/tests/shell/test_arm_spe.sh | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/tools/perf/tests/shell/test_arm_spe.sh b/tools/perf/tests/shell/test_arm_spe.sh
> > index e59044edc406..b9c588ae393b 100755
> > --- a/tools/perf/tests/shell/test_arm_spe.sh
> > +++ b/tools/perf/tests/shell/test_arm_spe.sh
> > @@ -23,6 +23,7 @@ glb_err=0
> >  cleanup_files()
> >  {
> >       rm -f ${perfdata}
> > +     rm -f ${perfdata}.old
> >       exit $glb_err
> >  }
> >
> > @@ -85,5 +86,19 @@ 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 ${perfdata} -e arm_spe// -a \
> > +             -- dd if=/dev/zero of=/dev/null count=100000 > /dev/null 2>&1
> > +
>
> Should we skip if we don't have privileges for CPU tracing? (attached diff)

Oh, you're right.  I'll squash it to the patch.

Thanks,
Namhyung


>
> > +     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

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

end of thread, other threads:[~2022-06-16 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 19:07 [PATCH] perf test: Add ARM SPE system wide test Namhyung Kim
2022-06-16 10:12 ` German Gomez
2022-06-16 16:43   ` Namhyung Kim

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).