From: Namhyung Kim <namhyung@kernel.org>
To: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: irogers@google.com, maddy@linux.ibm.com, kjain@linux.ibm.com,
Arnaldo Carvalho de Melo <acme@kernel.org>,
linux-perf-users@vger.kernel.org, jolsa@kernel.org,
disgoel@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/2] tools/perf/tests: perf all metrics test fails when perf_event access is restricted
Date: Wed, 5 Jul 2023 11:24:50 -0700 [thread overview]
Message-ID: <CAM9d7chEpdJkpWuxZD2-w89SFBm9CU28MpLA40LV+=GaLJXS1w@mail.gmail.com> (raw)
In-Reply-To: <AEE7B55C-BA6B-4E0E-A2E9-4E7EE09B4D50@linux.vnet.ibm.com>
On Mon, Jul 3, 2023 at 10:04 PM Athira Rajeev
<atrajeev@linux.vnet.ibm.com> wrote:
>
>
>
> > On 15-Jun-2023, at 1:08 PM, Athira Rajeev <atrajeev@linux.vnet.ibm.com> wrote:
> >
> > 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!
In my system, it fails like below:
$ ./perf test -v 101
101: perf all metrics test :
--- start ---
test child forked, pid 398458
Testing branch_misprediction_ratio
Testing all_remote_links_outbound
Metric 'all_remote_links_outbound' not printed in:
Error:
Invalid event (remote_outbound_data_controller_3:u) in per-thread
mode, enable system wide with '-a'.
Testing nps1_die_to_dram
...
Thanks,
Namhyung
>
>
> Hi,
>
> Looking for review comments on this patch.
>
> Thanks
> >
> > 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
> >
>
next prev parent reply other threads:[~2023-07-05 18:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2023-07-13 16:52 ` Athira Rajeev
2023-08-04 5:04 ` Athira Rajeev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM9d7chEpdJkpWuxZD2-w89SFBm9CU28MpLA40LV+=GaLJXS1w@mail.gmail.com' \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).