[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fWBDBHcsWOkVzC-r51grgTrbqJOHrZCpym6nHEUiFVV8g@mail.gmail.com>
Date: Tue, 17 May 2022 20:48:41 -0700
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>,
Riccardo Mancini <rickyman7@...il.com>,
Sohaib Mohamed <sohaib.amhmd@...il.com>,
Carsten Haitzler <carsten.haitzler@....com>,
Marco Elver <elver@...gle.com>,
John Garry <john.garry@...wei.com>,
Michael Petlan <mpetlan@...hat.com>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 4/7] perf test: Basic mmap use skip
On Mon, May 16, 2022 at 8:43 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Thu, May 12, 2022 at 9:05 PM Ian Rogers <irogers@...gle.com> wrote:
> >
> > If opening the first event fails for basic mmap it is more likely
> > permission related that a true error. Mark the test as skip in this
> > case and add a skip reason.
> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> > tools/perf/tests/mmap-basic.c | 22 ++++++++++++++++++++--
> > 1 file changed, 20 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/tests/mmap-basic.c b/tools/perf/tests/mmap-basic.c
> > index c3c17600f29c..32f0a63fa157 100644
> > --- a/tools/perf/tests/mmap-basic.c
> > +++ b/tools/perf/tests/mmap-basic.c
> > @@ -31,7 +31,7 @@
> > */
> > static int test__basic_mmap(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
> > {
> > - int err = -1;
> > + int err = TEST_FAIL;
> > union perf_event *event;
> > struct perf_thread_map *threads;
> > struct perf_cpu_map *cpus;
> > @@ -83,6 +83,14 @@ static int test__basic_mmap(struct test_suite *test __maybe_unused, int subtest
> > evsels[i] = evsel__newtp("syscalls", name);
> > if (IS_ERR(evsels[i])) {
> > pr_debug("evsel__new(%s)\n", name);
> > + if (i == 0) {
> > + /*
> > + * Failure to open first event is more likely
> > + * related to permissions so flag the failure as
> > + * a skip.
> > + */
> > + err = TEST_SKIP;
>
> This is not about perf_event_open() but it accesses
> tracefs to get the type number of the trace event.
>
> The evsel__newtp() seems to return the errno in a
> negative number. It'd be better to check if it's
> -EACCES actually.
Thanks, done in v2.
Ian
> Thanks,
> Namhyung
>
>
> > + }
> > goto out_delete_evlist;
> > }
> >
> > @@ -166,4 +174,14 @@ static int test__basic_mmap(struct test_suite *test __maybe_unused, int subtest
> > return err;
> > }
> >
> > -DEFINE_SUITE("Read samples using the mmap interface", basic_mmap);
> > +static struct test_case tests__basic_mmap[] = {
> > + TEST_CASE_REASON("Read samples using the mmap interface",
> > + basic_mmap,
> > + "permissions"),
> > + { .name = NULL, }
> > +};
> > +
> > +struct test_suite suite__basic_mmap = {
> > + .desc = "Read samples using the mmap interface",
> > + .test_cases = tests__basic_mmap,
> > +};
> > --
> > 2.36.0.550.gb090851708-goog
> >
Powered by blists - more mailing lists