Skip to contentSkip to conversation

tools/perf/tests: Add system wide check for perf bench workload in all metric test

PATCH Superseded Kajol Jain 4 participants 6 messages Feb 2, 2023 – Feb 15, 2023 perf events

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Kajol Jain

author
#0 lore raw

PATCH 1/1 tools/perf/tests: Add system wide check for perf bench workload in all metric test

Testcase stat_all_metrics.sh fails in powerpc:

92: perf all metrics test : FAILED!

Logs with verbose:

[command]# ./perf test 92 -vv
92: perf all metrics test :
--- start ---
test child forked, pid 13262
Testing BRU_STALL_CPI
Testing COMPLETION_STALL_CPI
----
Testing TOTAL_LOCAL_NODE_PUMPS_P23
Metric 'TOTAL_LOCAL_NODE_PUMPS_P23' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_LNS_PUMP23,chip=3/) in per-thread mode, enable system wide with '-a'. Testing TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01
Metric 'TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_RTY_LNS_PUMP01,chip=3/) in per-thread mode, enable system wide with '-a'.
----

Based on above logs, we could see some of the hv-24x7 metric events fails, and logs suggest to run the metric event with -a option.
This change happened after the commit a4b8cfcabb1d ("perf stat: Delay metric parsing"), which delayed the metric parsing phase and now before metric parsing phase perf tool identifies, whether target is system-wide or not. With this change, perf_event_open will fails with workload monitoring for uncore events as expected.

The perf all metric test case fails as some of the hv-24x7 metric events may need bigger workload to get the data. And the added perf bench workload in 'perf all metric test case' will not run for hv-24x7 without -a option.

Fix this issue by adding system wide check for perf bench workload.

Result with the patch changes in powerpc:

92: perf all metrics test : Ok

---
 tools/perf/tests/shell/stat_all_metrics.sh | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/tests/shell/stat_all_metrics.sh +7 -0
index 6e79349e42be..d49832a316d9 100755
@@ -23,6 +23,13 @@ for m in $(perf list --raw-dump metrics); do
   then
     continue
   fi
+  # Failed again, possibly the event is uncore pmu event which will need
+  # system wide monitoring with workload, so retry with -a option
+  result=$(perf stat -M "$m" -a perf bench internals synthesize 2>&1)
+  if [[ "$result" =~ "${m:0:50}" ]]
+  then
+    continue
+  fi
   echo "Metric '$m' not printed in:"
   echo "$result"
   if [[ "$err" != "1" ]]
Signature · 1 line
2.39.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 40 lines · Kajol Jain

Testcase stat_all_metrics.sh fails in powerpc:

92: perf all metrics test : FAILED!

Logs with verbose:

[command]# ./perf test 92 -vv
92: perf all metrics test :
--- start ---
test child forked, pid 13262
Testing BRU_STALL_CPI
Testing COMPLETION_STALL_CPI
----
Testing TOTAL_LOCAL_NODE_PUMPS_P23
Metric 'TOTAL_LOCAL_NODE_PUMPS_P23' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_LNS_PUMP23,chip=3/) in per-thread mode, enable system wide with '-a'. Testing TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01
Metric 'TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_RTY_LNS_PUMP01,chip=3/) in per-thread mode, enable system wide with '-a'.
----

Based on above logs, we could see some of the hv-24x7 metric events fails, and logs suggest to run the metric event with -a option.
This change happened after the commit a4b8cfcabb1d ("perf stat: Delay metric parsing"), which delayed the metric parsing phase and now before metric parsing phase perf tool identifies, whether target is system-wide or not. With this change, perf_event_open will fails with workload monitoring for uncore events as expected.

The perf all metric test case fails as some of the hv-24x7 metric events may need bigger workload to get the data. And the added perf bench workload in 'perf all metric test case' will not run for hv-24x7 without -a option.

Quoted 7 lines

Fix this issue by adding system wide check for perf bench workload.

Result with the patch changes in powerpc:

92: perf all metrics test : Ok

Looks good to me

Quoted 25 lines

---
tools/perf/tests/shell/stat_all_metrics.sh | 7 +++++++

1 file changed, 7 insertions(+)
tools/perf/tests/shell/stat_all_metrics.sh +7 -0
index 6e79349e42be..d49832a316d9 100755
@@ -23,6 +23,13 @@ for m in $(perf list --raw-dump metrics); do
  then
    continue
  fi
+  # Failed again, possibly the event is uncore pmu event which will need
+  # system wide monitoring with workload, so retry with -a option
+  result=$(perf stat -M "$m" -a perf bench internals synthesize 2>&1)
+  if [[ "$result" =~ "${m:0:50}" ]]
+  then
+    continue
+  fi
  echo "Metric '$m' not printed in:"
  echo "$result"
  if [[ "$err" != "1" ]]
Signature · 1 line
2.39.0
Tested-by on v1 1/1
#5 lore raw
In reply to Kajol Jain
Quoted 36 lines · Kajol Jain

Testcase stat_all_metrics.sh fails in powerpc:

92: perf all metrics test : FAILED!

Logs with verbose:

[command]# ./perf test 92 -vv
92: perf all metrics test :
--- start ---
test child forked, pid 13262
Testing BRU_STALL_CPI
Testing COMPLETION_STALL_CPI
----
Testing TOTAL_LOCAL_NODE_PUMPS_P23
Metric 'TOTAL_LOCAL_NODE_PUMPS_P23' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_LNS_PUMP23,chip=3/) in per-thread mode, enable system wide with '-a'. Testing TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01
Metric 'TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_RTY_LNS_PUMP01,chip=3/) in per-thread mode, enable system wide with '-a'.
----

Based on above logs, we could see some of the hv-24x7 metric events fails, and logs suggest to run the metric event with -a option.
This change happened after the commit a4b8cfcabb1d ("perf stat: Delay metric parsing"), which delayed the metric parsing phase and now before metric parsing phase perf tool identifies, whether target is system-wide or not. With this change, perf_event_open will fails with workload monitoring for uncore events as expected.

The perf all metric test case fails as some of the hv-24x7 metric events may need bigger workload to get the data. And the added perf bench workload in 'perf all metric test case' will not run for hv-24x7 without -a option.

Quoted 7 lines

Fix this issue by adding system wide check for perf bench workload.

Result with the patch changes in powerpc:

92: perf all metrics test : Ok

Tested the patch on powerpc machine, perf metrics test works fine.

 91: perf all metrics test                                           : Ok

Quoted 22 lines
---
  tools/perf/tests/shell/stat_all_metrics.sh | 7 +++++++
  1 file changed, 7 insertions(+)
tools/perf/tests/shell/stat_all_metrics.sh +7 -0
index 6e79349e42be..d49832a316d9 100755
@@ -23,6 +23,13 @@ for m in $(perf list --raw-dump metrics); do
    then
      continue
    fi
+  # Failed again, possibly the event is uncore pmu event which will need
+  # system wide monitoring with workload, so retry with -a option
+  result=$(perf stat -M "$m" -a perf bench internals synthesize 2>&1)
+  if [[ "$result" =~ "${m:0:50}" ]]
+  then
+    continue
+  fi
    echo "Metric '$m' not printed in:"
    echo "$result"
    if [[ "$err" != "1" ]]
author
#2 lore raw
In reply to Athira Rajeev
Quoted 44 lines · Athira Rajeev
Quoted 44 lines · Kajol Jain

Testcase stat_all_metrics.sh fails in powerpc:

92: perf all metrics test : FAILED!

Logs with verbose:

[command]# ./perf test 92 -vv
92: perf all metrics test :
--- start ---
test child forked, pid 13262
Testing BRU_STALL_CPI
Testing COMPLETION_STALL_CPI
----
Testing TOTAL_LOCAL_NODE_PUMPS_P23
Metric 'TOTAL_LOCAL_NODE_PUMPS_P23' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_LNS_PUMP23,chip=3/) in per-thread mode, enable system wide with '-a'. Testing TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01
Metric 'TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_RTY_LNS_PUMP01,chip=3/) in per-thread mode, enable system wide with '-a'.
----

Based on above logs, we could see some of the hv-24x7 metric events fails, and logs suggest to run the metric event with -a option.
This change happened after the commit a4b8cfcabb1d ("perf stat: Delay metric parsing"), which delayed the metric parsing phase and now before metric parsing phase perf tool identifies, whether target is system-wide or not. With this change, perf_event_open will fails with workload monitoring for uncore events as expected.

The perf all metric test case fails as some of the hv-24x7 metric events may need bigger workload to get the data. And the added perf bench workload in 'perf all metric test case' will not run for hv-24x7 without -a option.

Fix this issue by adding system wide check for perf bench workload.

Result with the patch changes in powerpc:

Quoted 7 lines
Quoted 3 lines

92: perf all metrics test : Ok

Looks good to me

Hi Arnaldo,
Let me know if patch looks fine to you.

Thanks,
Kajol Jain

Quoted 27 lines
Quoted 26 lines

---
tools/perf/tests/shell/stat_all_metrics.sh | 7 +++++++

1 file changed, 7 insertions(+)
tools/perf/tests/shell/stat_all_metrics.sh +7 -0
index 6e79349e42be..d49832a316d9 100755
@@ -23,6 +23,13 @@ for m in $(perf list --raw-dump metrics); do
  then
    continue
  fi
+  # Failed again, possibly the event is uncore pmu event which will need
+  # system wide monitoring with workload, so retry with -a option
+  result=$(perf stat -M "$m" -a perf bench internals synthesize 2>&1)
+  if [[ "$result" =~ "${m:0:50}" ]]
+  then
+    continue
+  fi
  echo "Metric '$m' not printed in:"
  echo "$result"
  if [[ "$err" != "1" ]]
Signature · 1 line
2.39.0
reviewer
#3 lore raw
Quoted 54 lines · kajoljain
Quoted 50 lines · Athira Rajeev
Quoted 40 lines · Kajol Jain

Testcase stat_all_metrics.sh fails in powerpc:

92: perf all metrics test : FAILED!

Logs with verbose:

[command]# ./perf test 92 -vv
92: perf all metrics test :
--- start ---
test child forked, pid 13262
Testing BRU_STALL_CPI
Testing COMPLETION_STALL_CPI
----
Testing TOTAL_LOCAL_NODE_PUMPS_P23
Metric 'TOTAL_LOCAL_NODE_PUMPS_P23' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_LNS_PUMP23,chip=3/) in per-thread mode, enable system wide with '-a'. Testing TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01
Metric 'TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_RTY_LNS_PUMP01,chip=3/) in per-thread mode, enable system wide with '-a'.
----

Based on above logs, we could see some of the hv-24x7 metric events fails, and logs suggest to run the metric event with -a option.
This change happened after the commit a4b8cfcabb1d ("perf stat: Delay metric parsing"), which delayed the metric parsing phase and now before metric parsing phase perf tool identifies, whether target is system-wide or not. With this change, perf_event_open will fails with workload monitoring for uncore events as expected.

The perf all metric test case fails as some of the hv-24x7 metric events may need bigger workload to get the data. And the added perf bench workload in 'perf all metric test case' will not run for hv-24x7 without -a option.

Quoted 7 lines

Fix this issue by adding system wide check for perf bench workload.

Result with the patch changes in powerpc:

92: perf all metrics test : Ok

Looks good to me

Quoted 7 lines
Quoted 1 line

Hi Arnaldo,
Let me know if patch looks fine to you.

Thanks,
Kajol Jain

I ran into a similar issue but worked around it with:

```
--- a/tools/perf/tests/shell/stat_all_metrics.sh
+++ b/tools/perf/tests/shell/stat_all_metrics.sh
@@ -11,7 +11,7 @@ for m in $(perf list --raw-dump metrics); do
    continue
  fi
  # Failed so try system wide.
-  result=$(perf stat -M "$m" -a true 2>&1)
+  result=$(perf stat -M "$m" -a sleep 0.01 2>&1)
  if [[ "$result" =~ "${m:0:50}" ]]
  then
    continue
```

Running the synthesize benchmark is potentially slow, wdyt of the change above?

Thanks,
Ian

Quoted 27 lines
Quoted 27 lines
Quoted 26 lines

---
tools/perf/tests/shell/stat_all_metrics.sh | 7 +++++++

1 file changed, 7 insertions(+)
tools/perf/tests/shell/stat_all_metrics.sh +7 -1
index 6e79349e42be..d49832a316d9 100755
@@ -23,6 +23,13 @@ for m in $(perf list --raw-dump metrics); do
  then
    continue
  fi
+  # Failed again, possibly the event is uncore pmu event which will need
+  # system wide monitoring with workload, so retry with -a option
+  result=$(perf stat -M "$m" -a perf bench internals synthesize 2>&1)
+  if [[ "$result" =~ "${m:0:50}" ]]
+  then
+    continue
+  fi
  echo "Metric '$m' not printed in:"
  echo "$result"
  if [[ "$err" != "1" ]]
--

2.39.0

author
#4 lore raw
Quoted 79 lines · Ian Rogers
Quoted 54 lines · kajoljain
Quoted 50 lines · Athira Rajeev
Quoted 40 lines · Kajol Jain

Testcase stat_all_metrics.sh fails in powerpc:

92: perf all metrics test : FAILED!

Logs with verbose:

[command]# ./perf test 92 -vv
92: perf all metrics test :
--- start ---
test child forked, pid 13262
Testing BRU_STALL_CPI
Testing COMPLETION_STALL_CPI
----
Testing TOTAL_LOCAL_NODE_PUMPS_P23
Metric 'TOTAL_LOCAL_NODE_PUMPS_P23' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_LNS_PUMP23,chip=3/) in per-thread mode, enable system wide with '-a'. Testing TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01
Metric 'TOTAL_LOCAL_NODE_PUMPS_RETRIES_P01' not printed in:
Error:
Invalid event (hv_24x7/PM_PB_RTY_LNS_PUMP01,chip=3/) in per-thread mode, enable system wide with '-a'.
----

Based on above logs, we could see some of the hv-24x7 metric events fails, and logs suggest to run the metric event with -a option.
This change happened after the commit a4b8cfcabb1d ("perf stat: Delay metric parsing"), which delayed the metric parsing phase and now before metric parsing phase perf tool identifies, whether target is system-wide or not. With this change, perf_event_open will fails with workload monitoring for uncore events as expected.

The perf all metric test case fails as some of the hv-24x7 metric events may need bigger workload to get the data. And the added perf bench workload in 'perf all metric test case' will not run for hv-24x7 without -a option.

Quoted 7 lines

Fix this issue by adding system wide check for perf bench workload.

Result with the patch changes in powerpc:

92: perf all metrics test : Ok

Looks good to me

Quoted 7 lines
Quoted 1 line

Hi Arnaldo,
Let me know if patch looks fine to you.

Thanks,
Kajol Jain

I ran into a similar issue but worked around it with:

```

tools/perf/tests/shell/stat_all_metrics.sh +1 -1
@@ -11,7 +11,7 @@ for m in $(perf list --raw-dump metrics); do
    continue
  fi
  # Failed so try system wide.
-  result=$(perf stat -M "$m" -a true 2>&1)
+  result=$(perf stat -M "$m" -a sleep 0.01 2>&1)
  if [[ "$result" =~ "${m:0:50}" ]]
  then
    continue

```

Quoted 1 line

Running the synthesize benchmark is potentially slow, wdyt of the change above?

Hi Ian,
Thanks for reviewing the patch. Yes we can change workload true to
sleep 0.01 as we need bigger workload for 24x7 and sleep 0.01 will also work for 24x7 metric events.

I will send v2 patch with this change.

Thanks,
Kajol Jain

Quoted 32 lines

Thanks,
Ian

Quoted 27 lines
Quoted 27 lines
Quoted 26 lines

---
tools/perf/tests/shell/stat_all_metrics.sh | 7 +++++++

1 file changed, 7 insertions(+)
tools/perf/tests/shell/stat_all_metrics.sh +7 -1
index 6e79349e42be..d49832a316d9 100755
@@ -23,6 +23,13 @@ for m in $(perf list --raw-dump metrics); do
  then
    continue
  fi
+  # Failed again, possibly the event is uncore pmu event which will need
+  # system wide monitoring with workload, so retry with -a option
+  result=$(perf stat -M "$m" -a perf bench internals synthesize 2>&1)
+  if [[ "$result" =~ "${m:0:50}" ]]
+  then
+    continue
+  fi
  echo "Metric '$m' not printed in:"
  echo "$result"
  if [[ "$err" != "1" ]]
--

2.39.0