linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@arm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org, irogers@google.com,
	John Garry <john.g.garry@oracle.com>,
	Will Deacon <will@kernel.org>, Mike Leach <mike.leach@linaro.org>,
	Leo Yan <leo.yan@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Jing Zhang <renyu.zj@linux.alibaba.com>,
	Haixin Yu <yuhaixin.yhx@linux.alibaba.com>,
	Kajol Jain <kjain@linux.ibm.com>,
	Ravi Bangoria <ravi.bangoria@amd.com>,
	Yang Jihong <yangjihong1@huawei.com>,
	Eduard Zingerman <eddyz87@gmail.com>,
	Chen Zhongjin <chenzhongjin@huawei.com>,
	Miguel Ojeda <ojeda@kernel.org>,
	Liam Howlett <liam.howlett@oracle.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 5/7] perf pmu: Move pmu__find_core_pmu() to pmus.c
Date: Wed, 13 Sep 2023 11:20:07 +0100	[thread overview]
Message-ID: <c122cf68-6ceb-5441-960e-fc754b0dfdb0@arm.com> (raw)
In-Reply-To: <ZQC7da2AM9ih8RMz@kernel.org>



On 12/09/2023 20:26, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 31, 2023 at 04:16:16PM +0100, James Clark escreveu:
>> pmu__find_core_pmu() more logically belongs in pmus.c because it
>> iterates over all PMUs, so move it to pmus.c
>>
>> At the same time rename it to perf_pmus__find_core_pmu() to match the
>> naming convention in this file.
>>
>> Signed-off-by: James Clark <james.clark@arm.com>
> 
> So, this one is hitting this:
> 
>   CC      /tmp/build/perf-tools-next/util/expr.o
> In file included from /var/home/acme/git/perf-tools-next/tools/include/linux/list.h:7,
>                  from util/pmus.c:2:
> In function ‘perf_pmus__scan_core’,
>     inlined from ‘perf_pmus__find_core_pmu’ at util/pmus.c:601:16:
> /var/home/acme/git/perf-tools-next/tools/include/linux/kernel.h:36:45: error: array subscript 0 is outside array bounds of ‘struct list_head[1]’ [-Werror=array-bounds]
>    36 |         const typeof(((type *)0)->member) * __mptr = (ptr);     \
>       |                                             ^~~~~~
> /var/home/acme/git/perf-tools-next/tools/include/linux/list.h:352:9: note: in expansion of macro ‘container_of’
>   352 |         container_of(ptr, type, member)
>       |         ^~~~~~~~~~~~
> /var/home/acme/git/perf-tools-next/tools/include/linux/list.h:404:9: note: in expansion of macro ‘list_entry’
>   404 |         list_entry((pos)->member.next, typeof(*(pos)), member)
>       |         ^~~~~~~~~~
> /var/home/acme/git/perf-tools-next/tools/include/linux/list.h:494:20: note: in expansion of macro ‘list_next_entry’
>   494 |         for (pos = list_next_entry(pos, member);                        \
>       |                    ^~~~~~~~~~~~~~~
> util/pmus.c:274:9: note: in expansion of macro ‘list_for_each_entry_continue’
>   274 |         list_for_each_entry_continue(pmu, &core_pmus, list)
>       |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> util/pmus.c: In function ‘perf_pmus__find_core_pmu’:
> util/pmus.c:35:18: note: at offset -128 into object ‘core_pmus’ of size 16
>    35 | static LIST_HEAD(core_pmus);
>       |                  ^~~~~~~~~
> /var/home/acme/git/perf-tools-next/tools/include/linux/list.h:23:26: note: in definition of macro ‘LIST_HEAD’
>    23 |         struct list_head name = LIST_HEAD_INIT(name)
>       |                          ^~~~
> cc1: all warnings being treated as errors
> make[4]: *** [/var/home/acme/git/perf-tools-next/tools/build/Makefile.build:97: /tmp/build/perf-tools-next/util/pmus.o] Error 1
> make[4]: *** Waiting for unfinished jobs....
>   LD      /tmp/build/perf-tools-next/ui/browsers/perf-in.o
> 
> 
> So I applied up to 4/7
> 
> Please continue from what will be in tmp.perf-tools-next in some
> jiffies.
> 
> - Arnaldo

I wasn't able to reproduce this on x86 or Arm, with either Clang or GCC.

That was with this patch applied onto 999b81b907e on tmp.perf-tools-next
and a pretty normal "make WERROR=1" command.

It seems like the 0 here is just to get the type rather than access
anything, if that's the 0 that the "array subscript 0" error is about,
so something seems a bit strange:

> /var/home/acme/git/perf-tools-next/tools/include/linux/kernel.h:36:45:
error: array subscript 0 is outside array bounds of ‘struct
list_head[1]’ [-Werror=array-bounds]
>    36 |         const typeof(((type *)0)->member) * __mptr = (ptr);     \

  reply	other threads:[~2023-09-13 10:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 15:16 [PATCH 0/7] perf: strcmp_cpuid_str() expression fixups James Clark
2023-08-31 15:16 ` [PATCH 1/7] perf test: Check result of has_event(cycles) test James Clark
2023-08-31 15:16 ` [PATCH 2/7] perf jevents: Remove unused keyword James Clark
2023-08-31 15:16 ` [PATCH 3/7] perf util: Add a function for replacing characters in a string James Clark
2023-09-02  2:48   ` Ian Rogers
2023-08-31 15:16 ` [PATCH 4/7] perf test: Add a test for strcmp_cpuid_str() expression James Clark
2023-08-31 15:16 ` [PATCH 5/7] perf pmu: Move pmu__find_core_pmu() to pmus.c James Clark
2023-09-12 19:26   ` Arnaldo Carvalho de Melo
2023-09-13 10:20     ` James Clark [this message]
2023-09-13 10:32       ` James Clark
2023-09-13 15:37         ` James Clark
2023-08-31 15:16 ` [PATCH 6/7] perf pmus: Simplify perf_pmus__find_core_pmu() James Clark
2023-08-31 15:16 ` [PATCH 7/7] perf pmu: Remove unused function James Clark
2023-09-02  2:53 ` [PATCH 0/7] perf: strcmp_cpuid_str() expression fixups Ian Rogers

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=c122cf68-6ceb-5441-960e-fc754b0dfdb0@arm.com \
    --to=james.clark@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=chenzhongjin@huawei.com \
    --cc=eddyz87@gmail.com \
    --cc=irogers@google.com \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=kjain@linux.ibm.com \
    --cc=leo.yan@linaro.org \
    --cc=liam.howlett@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=renyu.zj@linux.alibaba.com \
    --cc=will@kernel.org \
    --cc=yangjihong1@huawei.com \
    --cc=yuhaixin.yhx@linux.alibaba.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).