lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fVzFsgh6PC2EPJi8XpwTpdoSqqNnLgM-AYeHLzCWiQwZw@mail.gmail.com>
Date:   Tue, 4 Jul 2023 10:10:00 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     James Clark <james.clark@....com>
Cc:     linux-perf-users@...r.kernel.org,
        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>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] perf test: Fix event parsing test on Arm

On Tue, Jul 4, 2023 at 7:38 AM James Clark <james.clark@....com> wrote:
>
> The test looks for a PMU from sysfs with type = PERF_TYPE_RAW when
> opening a raw event. Arm doesn't have a real raw PMU, only core PMUs
> with unique types other than raw.
>
> Instead of looking for a matching PMU, just test that the event type
> was parsed as raw and skip the PMU search on Arm. The raw event type
> test should also apply to all platforms so add it outside of the ifdef.
>
> Fixes: aefde50a446b ("perf test: Fix parse-events tests for >1 core PMU")
> Signed-off-by: James Clark <james.clark@....com>

Acked-by: Ian Rogers <irogers@...gle.com>

Thanks,
Ian

> ---
>  tools/perf/tests/parse-events.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
> index 133218e51ab4..21f79aa31233 100644
> --- a/tools/perf/tests/parse-events.c
> +++ b/tools/perf/tests/parse-events.c
> @@ -108,10 +108,21 @@ static int test__checkevent_raw(struct evlist *evlist)
>         TEST_ASSERT_VAL("wrong number of entries", 0 != evlist->core.nr_entries);
>
>         perf_evlist__for_each_evsel(&evlist->core, evsel) {
> -               struct perf_pmu *pmu = NULL;
> +               struct perf_pmu *pmu __maybe_unused = NULL;
>                 bool type_matched = false;
>
>                 TEST_ASSERT_VAL("wrong config", test_perf_config(evsel, 0x1a));
> +               TEST_ASSERT_VAL("event not parsed as raw type",
> +                               evsel->attr.type == PERF_TYPE_RAW);
> +#if defined(__aarch64__)
> +               /*
> +                * Arm doesn't have a real raw type PMU in sysfs, so raw events
> +                * would never match any PMU. However, RAW events on Arm will
> +                * always successfully open on the first available core PMU
> +                * so no need to test for a matching type here.
> +                */
> +               type_matched = raw_type_match = true;
> +#else
>                 while ((pmu = perf_pmus__scan(pmu)) != NULL) {
>                         if (pmu->type == evsel->attr.type) {
>                                 TEST_ASSERT_VAL("PMU type expected once", !type_matched);
> @@ -120,6 +131,7 @@ static int test__checkevent_raw(struct evlist *evlist)
>                                         raw_type_match = true;
>                         }
>                 }
> +#endif
>                 TEST_ASSERT_VAL("No PMU found for type", type_matched);
>         }
>         TEST_ASSERT_VAL("Raw PMU not matched", raw_type_match);
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ