linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tools/perf/tests: perf all metrics test fails when perf_event access is restricted
@ 2023-06-15  7:38 Athira Rajeev
  2023-06-15  7:38 ` [PATCH 2/2] tools/perf/tests: perf all metricgroups " Athira Rajeev
  2023-07-04  5:04 ` [PATCH 1/2] tools/perf/tests: perf all metrics " Athira Rajeev
  0 siblings, 2 replies; 7+ messages in thread
From: Athira Rajeev @ 2023-06-15  7:38 UTC (permalink / raw)
  To: acme, jolsa, irogers, namhyung
  Cc: atrajeev, kjain, linux-perf-users, maddy, disgoel, linuxppc-dev

Perf all metrics test fails as below when perf_event access
is restricted.

    ./perf test -v "perf all metrics test"
    Metric 'Memory_RD_BW_Chip' not printed in:
    Error:
    Access to performance monitoring and observability operations is limited.
    Enforced MAC policy settings (SELinux) can limit access to performance
    —
    access to performance monitoring and observability operations for processes
    without CAP_PERFMON, CAP_SYS_PTRACE or CAP_SYS_ADMIN Linux capability.
    —
    test child finished with -1
    ---- end ----
    perf all metrics test: FAILED!

The perf all metrics test picks the input events from
"perf list --raw-dump metrics" and runs "perf stat -M "$m""
for each of the metrics in the list. It fails here for some
of the metrics which needs access, since it collects system
wide resource details/statistics. Fix the testcase to skip
those metric events.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
 tools/perf/tests/shell/stat_all_metrics.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/stat_all_metrics.sh b/tools/perf/tests/shell/stat_all_metrics.sh
index 54774525e18a..14b96484a359 100755
--- a/tools/perf/tests/shell/stat_all_metrics.sh
+++ b/tools/perf/tests/shell/stat_all_metrics.sh
@@ -6,7 +6,9 @@ err=0
 for m in $(perf list --raw-dump metrics); do
   echo "Testing $m"
   result=$(perf stat -M "$m" true 2>&1)
-  if [[ "$result" =~ ${m:0:50} ]] || [[ "$result" =~ "<not supported>" ]]
+  # Skip if there is no access to perf_events monitoring
+  # and observability operations
+  if [[ "$result" =~ ${m:0:50} ]] || [[ "$result" =~ "<not supported>" ]] || [[ "$result" =~ "Access to performance monitoring and observability operations is limited" ]]
   then
     continue
   fi
-- 
2.31.1


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

end of thread, other threads:[~2023-08-04  5:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15  7:38 [PATCH 1/2] tools/perf/tests: perf all metrics test fails when perf_event access is restricted Athira Rajeev
2023-06-15  7:38 ` [PATCH 2/2] tools/perf/tests: perf all metricgroups " Athira Rajeev
2023-07-04  5:04   ` Athira Rajeev
2023-07-04  5:04 ` [PATCH 1/2] tools/perf/tests: perf all metrics " Athira Rajeev
2023-07-05 18:24   ` Namhyung Kim
2023-07-13 16:52     ` Athira Rajeev
2023-08-04  5:04     ` Athira Rajeev

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