[PATCH] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c -- Was: Re: [PATCH v5 27/34] perf pmu: Separate pmu and pmus

Ian Rogers irogers at google.com
Thu Jun 1 23:42:00 PDT 2023


On Thu, Jun 1, 2023 at 10:30 PM Ravi Bangoria <ravi.bangoria at amd.com> wrote:
>
> On 27-May-23 12:52 PM, Ian Rogers wrote:
> > Separate and hide the pmus list in pmus.[ch]. Move pmus functionality
> > out of pmu.[ch] into pmus.[ch] renaming pmus functions which were
> > prefixed perf_pmu__ to perf_pmus__.
>
> I'm seeing perf tool build failures on linux-next because a patch[1] went in
> via Peter's tree needed some changes done by this patch.
>
> [1]: https://lore.kernel.org/lkml/168372562075.404.10852387134590654382.tip-bot2@tip-bot2
>
> Below patch fixes the issue.
>
> From c041b94df00baea024b64d4b19e37ee827484e74 Mon Sep 17 00:00:00 2001
> From: Ravi Bangoria <ravi.bangoria at amd.com>
> Date: Thu, 1 Jun 2023 15:23:22 +0530
> Subject: [PATCH] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c
>
> Since amd-ibs-via-core-pmu.c was applied via Peter's tree, some of
> the changes came via Arnaldo's tree did not reflected in this file,
> which is causing build failures.
>
>   arch/x86/tests/amd-ibs-via-core-pmu.c:47:25: error: ‘pmus’ undeclared
>   (first use in this function)
>      47 |         if (list_empty(&pmus))
>         |                         ^~~~
>   arch/x86/tests/amd-ibs-via-core-pmu.c:48:17: error: implicit declaration
>   of function ‘perf_pmu__scan’; did you mean
>   perf_pmus__scan’? [-Werror=implicit-function-declaration]
>      48 |                 perf_pmu__scan(NULL);
>         |                 ^~~~~~~~~~~~~~
>         |                 perf_pmus__scan
>   arch/x86/tests/amd-ibs-via-core-pmu.c:50:19: error: implicit declaration
>   of function ‘perf_pmu__find’; did you mean
>   perf_pmus__find’? [-Werror=implicit-function-declaration]
>      50 |         ibs_pmu = perf_pmu__find("ibs_op");
>         |                   ^~~~~~~~~~~~~~
>         |                   perf_pmus__find
>
> Fix those.
>
> Fixes: 1eaf496ed386 ("perf pmu: Separate pmu and pmus")
> Signed-off-by: Ravi Bangoria <ravi.bangoria at amd.com>
> ---
>  tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c b/tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
> index 2902798ca5c1..1e08b2455725 100644
> --- a/tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
> +++ b/tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
> @@ -44,10 +44,10 @@ int test__amd_ibs_via_core_pmu(struct test_suite *test __maybe_unused,
>         int ret = TEST_OK;
>         int fd, i;
>
> -       if (list_empty(&pmus))
> -               perf_pmu__scan(NULL);
> +       /* No way to know whether pmus list is already populated or not. */
> +       perf_pmus__scan(NULL);

Thanks Ravi, you should be able to just remove the 2 lines above. The
code will check to make sure the list is populated for the find below:
https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/pmus.c?h=perf-tools-next#n79

Thanks,
Ian

> -       ibs_pmu = perf_pmu__find("ibs_op");
> +       ibs_pmu = perf_pmus__find("ibs_op");
>         if (!ibs_pmu)
>                 return TEST_SKIP;
>
> --
> 2.40.1



More information about the linux-arm-kernel mailing list