[PATCH v2] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c

Ravi Bangoria posted 1 patch 10 months, 3 weeks ago
tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
[PATCH v2] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c
Posted by Ravi Bangoria 10 months, 3 weeks ago
Since amd-ibs-via-core-pmu.c was applied via Peter's tree, some of
the changes came via Arnaldo's tree did not reflect 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@amd.com>
---
v1->v2:
  - Remove unnecessary perf_pmus__scan(NULL) as suggested by Ian.

 tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c | 5 +----
 1 file changed, 1 insertion(+), 4 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..78b1902f6f59 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,7 @@ 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);
-
-	ibs_pmu = perf_pmu__find("ibs_op");
+	ibs_pmu = perf_pmus__find("ibs_op");
 	if (!ibs_pmu)
 		return TEST_SKIP;
 
-- 
2.40.1

Re: [PATCH v2] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c
Posted by Arnaldo Carvalho de Melo 10 months, 2 weeks ago
Em Sat, Jun 03, 2023 at 10:16:50AM +0530, Ravi Bangoria escreveu:
> Since amd-ibs-via-core-pmu.c was applied via Peter's tree, some of
> the changes came via Arnaldo's tree did not reflect 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@amd.com>

I wonder how to solve the various merge issues here:

1. this clashes with:

commit ae4aa00a1a9358e0007f6edc71b018a0b0d21190
Author: Ian Rogers <irogers@google.com>
Date:   Tue May 2 15:38:27 2023 -0700

    perf test: Move x86 hybrid tests to arch/x86

--------------

I tried cherry-picking the cset that introduces amd-ibs-via-core-pmu.c,
moved the test__hybrid lines a bit and then tried test merging the
result with tip/master, it works.

But then I tried applying this fix as a follow up cset, perf-tools-next
would have bisection history broken, but nah, but then I hit:

⬢[acme@toolbox perf-tools-next]$ git merge tip/master
Auto-merging tools/perf/arch/x86/include/arch-tests.h
Auto-merging tools/perf/arch/x86/tests/Build
Auto-merging tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
CONFLICT (add/add): Merge conflict in tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
Auto-merging tools/perf/arch/x86/tests/arch-tests.c
Automatic merge failed; fix conflicts and then commit the result.
⬢[acme@toolbox perf-tools-next]$ git diff
diff --cc tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
index 78b1902f6f59d8ce,2902798ca5c1ed1c..0000000000000000
--- 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,7 -44,10 +44,14 @@@ int test__amd_ibs_via_core_pmu(struct t
        int ret = TEST_OK;
        int fd, i;
  
++<<<<<<< HEAD
 +      ibs_pmu = perf_pmus__find("ibs_op");
++=======
+       if (list_empty(&pmus))
+               perf_pmu__scan(NULL);
+ 
+       ibs_pmu = perf_pmu__find("ibs_op");
++>>>>>>> tip/master
        if (!ibs_pmu)
                return TEST_SKIP;
  

How are things like this resolved in linux-next?

Removing this test from tip/master and I carry a fixed up
tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c introduction patch?

Cheers,

- Arnaldo

> ---
> v1->v2:
>   - Remove unnecessary perf_pmus__scan(NULL) as suggested by Ian.
> 
>  tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c | 5 +----
>  1 file changed, 1 insertion(+), 4 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..78b1902f6f59 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,7 @@ 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);
> -
> -	ibs_pmu = perf_pmu__find("ibs_op");
> +	ibs_pmu = perf_pmus__find("ibs_op");
>  	if (!ibs_pmu)
>  		return TEST_SKIP;
>  
> -- 
> 2.40.1
> 

-- 

- Arnaldo
Re: [PATCH v2] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c
Posted by Stephen Rothwell 10 months, 2 weeks ago
Hi Arnaldo,

On Mon, 5 Jun 2023 11:27:57 -0300 Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> How are things like this resolved in linux-next?

Well, if it produces a conflict (or a build failure due to a semantic
conflict) I will fix it up (maybe using a separate patch such as this)
and report it so that the maintainers know that they need to let Linus
know about this when he merges their trees.

But since neither of those things has happened (it seems that an
allmodconfig build does not build the tests), I can still take this
patch and use it to fix up the tip tree merge (since that happens after
the perf tree merge) starting tomorrow and report it as above.  I will
then keep applying this patch to the merge until it is no longer needed.

Please send me the actual patch. (I am assuming that the patch applies
on top of a recent linux-next release?)

-- 
Cheers,
Stephen Rothwell
Re: [PATCH v2] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c
Posted by Stephen Rothwell 10 months, 2 weeks ago
Hi all,

On Tue, 6 Jun 2023 14:24:36 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> On Mon, 5 Jun 2023 11:27:57 -0300 Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >
> > How are things like this resolved in linux-next?  
> 
> Well, if it produces a conflict (or a build failure due to a semantic
> conflict) I will fix it up (maybe using a separate patch such as this)
> and report it so that the maintainers know that they need to let Linus
> know about this when he merges their trees.
> 
> But since neither of those things has happened (it seems that an
> allmodconfig build does not build the tests), I can still take this
> patch and use it to fix up the tip tree merge (since that happens after
> the perf tree merge) starting tomorrow and report it as above.  I will
> then keep applying this patch to the merge until it is no longer needed.
> 
> Please send me the actual patch. (I am assuming that the patch applies
> on top of a recent linux-next release?)

I fetched the patch from lore and have applied it to the tip tree merge
from today.  So the tip and perf folks need to remember to tell Linus
about this fix up patch when they send their pull requests during the
merge window.  I have included the patch here just to be sure.

From:   Ravi Bangoria <ravi.bangoria@amd.com>
To:     <irogers@google.com>, <acme@kernel.org>, <sfr@canb.auug.org.au>
CC:     <ravi.bangoria@amd.com>, <suzuki.poulose@arm.com>,
        <mike.leach@linaro.org>, <leo.yan@linaro.org>,
        <john.g.garry@oracle.com>, <will@kernel.org>,
        <james.clark@arm.com>, <peterz@infradead.org>, <mingo@redhat.com>,
        <mark.rutland@arm.com>, <alexander.shishkin@linux.intel.com>,
        <jolsa@kernel.org>, <namhyung@kernel.org>,
        <adrian.hunter@intel.com>, <kjain@linux.ibm.com>,
        <renyu.zj@linux.alibaba.com>, <kan.liang@linux.intel.com>,
        <zhengjun.xing@linux.intel.com>, <maddy@linux.ibm.com>,
        <atrajeev@linux.vnet.ibm.com>, <wangming01@loongson.cn>,
        <chenhuacai@kernel.org>, <sandipan.das@amd.com>,
        <9erthalion6@gmail.com>, <seanjc@google.com>, <robh@kernel.org>,
        <tmricht@linux.ibm.com>, <tegongkang@gmail.com>,
        <linux-kernel@vger.kernel.org>, <coresight@lists.linaro.org>,
        <linux-arm-kernel@lists.infradead.org>,
        <linux-perf-users@vger.kernel.org>
Subject: [PATCH v2] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c
Date:   Sat, 3 Jun 2023 10:16:50 +0530
Message-ID: <20230603044650.286-1-ravi.bangoria@amd.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit

Since amd-ibs-via-core-pmu.c was applied via Peter's tree, some of
the changes came via Arnaldo's tree did not reflect 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@amd.com>
---
v1->v2:
  - Remove unnecessary perf_pmus__scan(NULL) as suggested by Ian.

 tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c | 5 +----
 1 file changed, 1 insertion(+), 4 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..78b1902f6f59 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,7 @@ 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);
-
-	ibs_pmu = perf_pmu__find("ibs_op");
+	ibs_pmu = perf_pmus__find("ibs_op");
 	if (!ibs_pmu)
 		return TEST_SKIP;
 
-- 
2.40.1

-- 
Cheers,
Stephen Rothwell
Re: [PATCH v2] perf test amd: Fix build failure with amd-ibs-via-core-pmu.c
Posted by Ravi Bangoria 10 months, 2 weeks ago
On 05-Jun-23 7:57 PM, Arnaldo Carvalho de Melo wrote:
> Em Sat, Jun 03, 2023 at 10:16:50AM +0530, Ravi Bangoria escreveu:
>> Since amd-ibs-via-core-pmu.c was applied via Peter's tree, some of
>> the changes came via Arnaldo's tree did not reflect 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@amd.com>
> 
> I wonder how to solve the various merge issues here:
> 
> 1. this clashes with:
> 
> commit ae4aa00a1a9358e0007f6edc71b018a0b0d21190
> Author: Ian Rogers <irogers@google.com>
> Date:   Tue May 2 15:38:27 2023 -0700
> 
>     perf test: Move x86 hybrid tests to arch/x86
> 
> --------------
> 
> I tried cherry-picking the cset that introduces amd-ibs-via-core-pmu.c,
> moved the test__hybrid lines a bit and then tried test merging the
> result with tip/master, it works.
> 
> But then I tried applying this fix as a follow up cset, perf-tools-next
> would have bisection history broken, but nah, but then I hit:
> 
> ⬢[acme@toolbox perf-tools-next]$ git merge tip/master
> Auto-merging tools/perf/arch/x86/include/arch-tests.h
> Auto-merging tools/perf/arch/x86/tests/Build
> Auto-merging tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
> CONFLICT (add/add): Merge conflict in tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
> Auto-merging tools/perf/arch/x86/tests/arch-tests.c
> Automatic merge failed; fix conflicts and then commit the result.
> ⬢[acme@toolbox perf-tools-next]$ git diff
> diff --cc tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c
> index 78b1902f6f59d8ce,2902798ca5c1ed1c..0000000000000000
> --- 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,7 -44,10 +44,14 @@@ int test__amd_ibs_via_core_pmu(struct t
>         int ret = TEST_OK;
>         int fd, i;
>   
> ++<<<<<<< HEAD
>  +      ibs_pmu = perf_pmus__find("ibs_op");
> ++=======
> +       if (list_empty(&pmus))
> +               perf_pmu__scan(NULL);
> + 
> +       ibs_pmu = perf_pmu__find("ibs_op");
> ++>>>>>>> tip/master
>         if (!ibs_pmu)
>                 return TEST_SKIP;
>   
> 
> How are things like this resolved in linux-next?
> 
> Removing this test from tip/master and I carry a fixed up
> tools/perf/arch/x86/tests/amd-ibs-via-core-pmu.c introduction patch?

I'm hoping Stephen will reply on merge question. But if you want me to resend
the patch rebased on a specific branch, I would be happy to do that.

Thanks,
Ravi