Skip to contentSkip to conversation

perf/tests: Fix test case 95 Check branch stack sampling on s390

PATCH In review Thomas Richter 2 participants 3 messages Jul 27, 2022 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/tests: Fix test case 95 Check branch stack sampling on s390

On linux-next tree perf test 95 was added recently. s390 does not support branch sampling at all. Therefore omit this test on s390 platform.

Output before:

 # ./perf test -Fv 95
 95: Check branch stack sampling                                     :
 --- start ---
 Testing user branch stack sampling
 ---- end ----
 Check branch stack sampling: FAILED!
 #

Output after:

 # ./perf test -Fv 95
 95: Check branch stack sampling                                     :
 --- start ---
 ---- end ----
 Check branch stack sampling: Skip
 #
---
 tools/perf/tests/shell/test_brstack.sh | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/tests/shell/test_brstack.sh +3 -0
index 113ccd17bf03..dedaf74164dc 100755
@@ -4,6 +4,9 @@
 # SPDX-License-Identifier: GPL-2.0
 # German Gomez <[email protected]>, 2022
 
+# s390 does not support branch sampling, omit
+[ $(uname -m) = "s390" -o $(uname -m) = "s390x" ] && exit 2
+
 # we need a C compiler to build the test programs
 # so bail if none is found
 if ! [ -x "$(command -v cc)" ]; then
Signature · 1 line
2.36.1
#1 lore raw
Quoted 31 lines · Thomas Richter

On linux-next tree perf test 95 was added recently. s390 does not support branch sampling at all. Therefore omit this test on s390 platform.

Output before:

 # ./perf test -Fv 95
 95: Check branch stack sampling                                     :
 --- start ---
 Testing user branch stack sampling
 ---- end ----
 Check branch stack sampling: FAILED!
 #

Output after:

 # ./perf test -Fv 95
 95: Check branch stack sampling                                     :
 --- start ---
 ---- end ----
 Check branch stack sampling: Skip
 #
---
 tools/perf/tests/shell/test_brstack.sh | 3 +++
 1 file changed, 3 insertions(+)
tools/perf/tests/shell/test_brstack.sh +0 -0
index 113ccd17bf03..dedaf74164dc 100755

tools/perf/tests/shell/test_brstack.sh line 9

Quoted 6 lines
tools/perf/tests/shell/test_brstack.sh +3 -0
@@ -4,6 +4,9 @@
 # SPDX-License-Identifier: GPL-2.0
 # German Gomez <[email protected]>, 2022
 
+# s390 does not support branch sampling, omit
+[ $(uname -m) = "s390" -o $(uname -m) = "s390x" ] && exit 2
+

Hi Thomas,

Do you know why the below check doesn't cover this scenario? It seems like it would be best to check if it's available wherever it's running rather than enumerate every platform where it's not supported:

  # skip the test if the hardware doesn't support branch stack sampling
  perf record -b -o- -e dummy -B true > /dev/null 2>&1 || exit 2

Thanks
James

Quoted 3 lines
tools/perf/tests/shell/test_brstack.sh +0 -0
 # we need a C compiler to build the test programs
 # so bail if none is found
 if ! [ -x "$(command -v cc)" ]; then
#2 lore raw
Quoted 1 line · James Clark

perf record -b -o- -e dummy -B true

I think you refer to the attr member branch_sample_type which should be non-zero for branches, will look into this. Thanks

Signature · 5 lines
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzender des Aufsichtsrats: Gregor Pillen
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294