perf test stat: Avoid hybrid assumption when virtualized
Ian Rogers
reviewerPATCH v2 1/1 perf test stat: Avoid hybrid assumption when virtualized
The cycles event will fallback to task-clock in the hybrid test when running virtualized. Change the test to not fail for this.
--- tools/perf/tests/shell/stat.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/perf/tests/shell/stat.sh +5 -1
@@ -163,7 +163,11 @@ test_hybrid() { # Run default Perf stat cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/| cycles " | wc -l) - if [ "$pmus" -ne "$cycles_events" ] + # The expectation is that default output will have a cycles events on each + # hybrid PMU. In situations with no cycles PMU events, like virtualized, this + # can fall back to task-clock and so the end count may be 0. Fail if neither + # condition holds. + if [ "$pmus" -ne "$cycles_events" ] && [ "0" -ne "$cycles_events" ] then echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]" err=1
Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
Quoted 4 lines · Ian Rogers
The cycles event will fallback to task-clock in the hybrid test when running virtualized. Change the test to not fail for this.
Fixes a6b8bb2addd0 ("perf test: Add a test for default perf stat command")
I cannot find this commit.
Quoted 1 line
Signed-off-by Ian Rogers <[email protected]>
Other than that,
Thanks,
Namhyung
Quoted 24 lines
--- tools/perf/tests/shell/stat.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/tests/shell/stat.sh +5
-1@@ -163,7 +163,11 @@ test_hybrid() { # Run default Perf stat cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/| cycles " | wc -l) - if [ "$pmus" -ne "$cycles_events" ] + # The expectation is that default output will have a cycles events on each + # hybrid PMU. In situations with no cycles PMU events, like virtualized, this + # can fall back to task-clock and so the end count may be 0. Fail if neither + # condition holds. + if [ "$pmus" -ne "$cycles_events" ] && [ "0" -ne "$cycles_events" ] then echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]" err=1Signature · 1 line
2.47.1.613.gc27f4b7a9f-goog
Ian Rogers
reviewerQuoted 8 lines · Namhyung Kim
Quoted 4 lines · Ian Rogers
The cycles event will fallback to task-clock in the hybrid test when running virtualized. Change the test to not fail for this.
Fixes a6b8bb2addd0 ("perf test: Add a test for default perf stat command")I cannot find this commit.
Sorry, should have been:
Thanks,
Ian
Quoted 33 lines
Quoted 1 line
Signed-off-by Ian Rogers <[email protected]>Other than that,
Acked-by Namhyung Kim <[email protected]>Thanks,
NamhyungQuoted 24 lines
--- tools/perf/tests/shell/stat.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/tests/shell/stat.sh +5
-2@@ -163,7 +163,11 @@ test_hybrid() { # Run default Perf stat cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/| cycles " | wc -l) - if [ "$pmus" -ne "$cycles_events" ] + # The expectation is that default output will have a cycles events on each + # hybrid PMU. In situations with no cycles PMU events, like virtualized, this + # can fall back to task-clock and so the end count may be 0. Fail if neither + # condition holds. + if [ "$pmus" -ne "$cycles_events" ] && [ "0" -ne "$cycles_events" ] then echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]" err=1 --2.47.1.613.gc27f4b7a9f-goog
Quoted 11 lines · Ian Rogers
Quoted 7 lines · Namhyung Kim
Quoted 4 lines · Ian Rogers
The cycles event will fallback to task-clock in the hybrid test when running virtualized. Change the test to not fail for this.
Fixes a6b8bb2addd0 ("perf test: Add a test for default perf stat command")I cannot find this commit.
Sorry, should have been:
Fixes 65d11821910b ("perf test: Add a test for default perf stat command")
Thanks, applied to perf-tools-next, there was a minimal fuzz but I fixed it up:
⬢ [acme@toolbox perf-tools-next]$ patch -p1 < ./v2_20241212_irogers_perf_test_stat_avoid_hybrid_assumption_when_virtualized.mbx patching file tools/perf/tests/shell/stat.sh
Hunk #1 succeeded at 187 with fuzz 2 (offset 24 lines).
- Arnaldo
Quoted 36 lines
Thanks,
IanQuoted 33 lines
Quoted 1 line
Signed-off-by Ian Rogers <[email protected]>Other than that,
Acked-by Namhyung Kim <[email protected]>Thanks,
NamhyungQuoted 24 lines
--- tools/perf/tests/shell/stat.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/tests/shell/stat.sh +5
-2@@ -163,7 +163,11 @@ test_hybrid() { # Run default Perf stat cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/| cycles " | wc -l) - if [ "$pmus" -ne "$cycles_events" ] + # The expectation is that default output will have a cycles events on each + # hybrid PMU. In situations with no cycles PMU events, like virtualized, this + # can fall back to task-clock and so the end count may be 0. Fail if neither + # condition holds. + if [ "$pmus" -ne "$cycles_events" ] && [ "0" -ne "$cycles_events" ] then echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]" err=1 --2.47.1.613.gc27f4b7a9f-goog
Quoted 16 lines · Ian Rogers
The cycles event will fallback to task-clock in the hybrid test when running virtualized. Change the test to not fail for this.
Fixes a6b8bb2addd0 ("perf test: Add a test for default perf stat command")Signed-off-by Ian Rogers <[email protected]>--- tools/perf/tests/shell/stat.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)tools/perf/tests/shell/stat.sh +0
-0@@ -163,7 +163,11 @@ test_hybrid() { # Run default Perf stat cycles_events=$(perf stat -- true 2>&1 | grep -E "/cycles/| cycles " | wc -l)
tools/perf/tests/shell/stat.sh test_hybrid() { · line 173
Quoted 10 lines
tools/perf/tests/shell/stat.sh +5
-1- if [ "$pmus" -ne "$cycles_events" ] + # The expectation is that default output will have a cycles events on each + # hybrid PMU. In situations with no cycles PMU events, like virtualized, this + # can fall back to task-clock and so the end count may be 0. Fail if neither + # condition holds. + if [ "$pmus" -ne "$cycles_events" ] && [ "0" -ne "$cycles_events" ] then echo "hybrid test [Found $pmus PMUs but $cycles_events cycles events. Failed]" err=1