linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Xu Yang <xu.yang_2@nxp.com>,
	Thomas Falcon <thomas.falcon@intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Atish Patra <atishp@rivosinc.com>,
	Beeman Strong <beeman@rivosinc.com>, Leo Yan <leo.yan@arm.com>,
	Vince Weaver <vincent.weaver@maine.edu>
Subject: Re: [PATCH v7 00/27] Legacy hardware/cache events as json
Date: Thu, 16 Oct 2025 11:29:49 +0100	[thread overview]
Message-ID: <b1a461b4-4358-4556-80ef-e7abd686f2e5@linaro.org> (raw)
In-Reply-To: <CAP-5=fX8ZV6WTmKcrrfPo0MUFiruJoWhYeUk3JrToEP=9-aPCA@mail.gmail.com>



On 15/10/2025 10:24 pm, Ian Rogers wrote:
> On Wed, Oct 15, 2025 at 10:39 AM James Clark <james.clark@linaro.org> wrote:
>>
>>
>>
>> On 15/10/2025 4:53 pm, Namhyung Kim wrote:
>>> On Sun, 05 Oct 2025 11:24:03 -0700, Ian Rogers wrote:
>>>
>>>> Mirroring similar work for software events in commit 6e9fa4131abb
>>>> ("perf parse-events: Remove non-json software events"). These changes
>>>> migrate the legacy hardware and cache events to json.  With no hard
>>>> coded legacy hardware or cache events the wild card, case
>>>> insensitivity, etc. is consistent for events. This does, however, mean
>>>> events like cycles will wild card against all PMUs. A change doing the
>>>> same was originally posted and merged from:
>>>> https://lore.kernel.org/r/20240416061533.921723-10-irogers@google.com
>>>> and reverted by Linus in commit 4f1b067359ac ("Revert "perf
>>>> parse-events: Prefer sysfs/JSON hardware events over legacy"") due to
>>>> his dislike for the cycles behavior on ARM with perf record. Earlier
>>>> patches in this series make perf record event opening failures
>>>> non-fatal and hide the cycles event's failure to open on ARM in perf
>>>> record, so it is expected the behavior will now be transparent in perf
>>>> record on ARM. perf stat with a cycles event will wildcard open the
>>>> event on all PMUs, however, with default events the cycles event will
>>>> only be opened on core PMUs.
>>>>
>>>> [...]
>>>
>>> Applied to perf-tools-next, thanks!
>>>
>>> Best regards,
>>> Namhyung
>>>
>>
>> Hi Namhyung,
>>
>> I'm still getting the build failure that I mentioned on patch 5. This
>> only seems to happen with out of source builds:
>>
>>     $ make -C tools/perf O=../build/local/ V=1
>>
>>
>>     static const struct pmu_sys_events pmu_sys_event_tables[] = {
>>           {
>> -               .event_table = {
>> -                       .pmus = pmu_events__test_soc_sys,
>> -                       .num_pmus = ARRAY_SIZE(pmu_events__test_soc_sys)
>> -               },
>> -               .name = "pmu_events__test_soc_sys",
>> -       },
>> -       {
>>                   .event_table = { 0, 0 },
>>                   .metric_table = { 0, 0 },
>>           },
>> make[3]: *** [pmu-events/Build:54:
>> /home/james/workspace/linux/build/local/pmu-events/empty-pmu-events.log]
>> Error 1
> 
> Sorry for the issue. Is this happening when you don't do a clean
> first? I tried recreating your output path, but I can't reproduce the
> issue on a clean build. The diff above indicates some issue with the

The clean issue was separate to the build failure. I meant that the 
build failure was sticky when I was bisecting. So after commit 5 the 
build breaks on a clean build but then it stayed broken even on builds 
before commit 5 unless I cleaned. I think we can ignore this for now.

> Makefile processing tools/perf/pmu-events/arch/test/test_soc/. This
> directory should be copied to
> ../build/local/pmu-events/arch/test/test_soc/ and so I wonder if the
> copy failed for some reason.
> 
> The copy rule is:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n33
> ```
> # Copy checked-in json for generation.
> $(OUTPUT)pmu-events/arch/%: pmu-events/arch/%
> $(call rule_mkdir)
> $(Q)$(call echo-cmd,gen)cp $< $@
> ```
> 
> The mapping of file names happens in the patsubst in:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n42
> ```
> GEN_JSON = $(patsubst %,$(OUTPUT)%,$(JSON)) $(LEGACY_CACHE_JSON)
> ```
> 
> Those files are dependencies for the empty-pmu-events.c test so I'm
> not sure how this can be failing for you.
> 
> Thanks,
> Ian

If I apply this patchset to commit 2a67955de136 ("perf bpf_counter: Fix 
opening of "any"(-1) CPU events"), then:

   $ rm -r ../build/local ; mkdir ../build/local
   $ git clean -xfd
   $ make -C tools/perf O=../build/local/ -j1 V=1

I get no copy of the test jsons:

   $ ls ../build/local/pmu-events/arch/test/test_soc/

   ls: cannot access '../build/local/pmu-events/arch/test/test_soc/': No
   such file or directory

Looking at the dependencies of the rule for $(PMU_EVENTS_C), it's 
$(JSON_TEST), but JSON_TEST is the in-source version without the 
$(OUTPUT) prefix. That's already satisfied so it skips the copy.

If I modify the generator for JSON_TEST to include the OUTPUT prefix:

JSON_TEST	=  $(shell [ -d $(JDIR_TEST) ] &   \
	find $(JDIR_TEST) -name '*.json' | sed -e 's|^|$(OUTPUT)|g')

Now I get the copy:

   $ ls ../build/local/pmu-events/arch/test/test_soc/

   total 0
   drwxrwxr-x 1 james  56 Oct 16 11:13 ..
   drwxrwxr-x 1 james 108 Oct 16 11:13 cpu
   drwxrwxr-x 1 james  12 Oct 16 11:13 .
   drwxrwxr-x 1 james  22 Oct 16 11:13 sys

Now the diff check is slightly different/better, but the build still 
fails. Weirdly I don't see this failure on my Arm machine which is where 
I tested the whole set, I only see this failure on x86. Maybe some 
difference in the version of make?


  reply	other threads:[~2025-10-16 10:29 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-05 18:24 [PATCH v7 00/27] Legacy hardware/cache events as json Ian Rogers
2025-10-05 18:24 ` [PATCH v7 01/27] perf parse-events: Fix legacy cache events if event is duplicated in a PMU Ian Rogers
2025-10-05 18:24 ` [PATCH v7 02/27] perf perf_api_probe: Avoid scanning all PMUs, try software PMU first Ian Rogers
2025-10-05 18:24 ` [PATCH v7 03/27] perf stat: Avoid wildcarding PMUs for default events Ian Rogers
2025-10-05 18:24 ` [PATCH v7 04/27] perf record: Skip don't fail for events that don't open Ian Rogers
2025-10-05 18:24 ` [PATCH v7 05/27] perf jevents: Support copying the source json files to OUTPUT Ian Rogers
2025-10-08 11:10   ` James Clark
2025-10-08 14:58     ` Ian Rogers
2025-10-08 15:14       ` James Clark
2025-10-08 21:43         ` Ian Rogers
2025-10-05 18:24 ` [PATCH v7 06/27] perf pmu: Don't eagerly parse event terms Ian Rogers
2025-10-05 18:24 ` [PATCH v7 07/27] perf parse-events: Remove unused FILE input argument to scanner Ian Rogers
2025-10-05 18:24 ` [PATCH v7 08/27] perf pmu: Use fd rather than FILE from new_alias Ian Rogers
2025-10-05 18:24 ` [PATCH v7 09/27] perf pmu: Factor term parsing into a perf_event_attr into a helper Ian Rogers
2025-10-05 18:24 ` [PATCH v7 10/27] perf parse-events: Add terms for legacy hardware and cache config values Ian Rogers
2025-10-05 18:24 ` [PATCH v7 11/27] perf jevents: Add legacy json terms and default_core event table helper Ian Rogers
2025-10-05 18:24 ` [PATCH v7 12/27] perf pmu: Add and use legacy_terms in alias information Ian Rogers
2025-10-05 18:24 ` [PATCH v7 13/27] perf jevents: Add legacy-hardware and legacy-cache json Ian Rogers
2025-10-05 18:24 ` [PATCH v7 14/27] perf print-events: Remove print_hwcache_events Ian Rogers
2025-10-05 18:24 ` [PATCH v7 15/27] perf print-events: Remove print_symbol_events Ian Rogers
2025-10-05 18:24 ` [PATCH v7 16/27] perf parse-events: Remove hard coded legacy hardware and cache parsing Ian Rogers
2025-10-05 18:24 ` [PATCH v7 17/27] perf record: Use evlist__new_default when no events specified Ian Rogers
2025-10-05 18:24 ` [PATCH v7 18/27] perf top: " Ian Rogers
2025-10-05 18:24 ` [PATCH v7 19/27] perf evlist: Avoid scanning all PMUs for evlist__new_default Ian Rogers
2025-10-05 18:24 ` [PATCH v7 20/27] perf evsel: Improvements to __evsel__match Ian Rogers
2025-10-05 18:24 ` [PATCH v7 21/27] perf test parse-events: Use evsel__match for legacy events Ian Rogers
2025-10-05 18:24 ` [PATCH v7 22/27] perf test parse-events: Without a PMU use cpu-cycles rather than cycles Ian Rogers
2025-10-05 18:24 ` [PATCH v7 23/27] perf test parse-events: Remove cpu PMU requirement Ian Rogers
2025-10-05 18:24 ` [PATCH v7 24/27] perf test: Switch cycles event to cpu-cycles Ian Rogers
2025-10-05 18:24 ` [PATCH v7 25/27] perf test: Clean up test_..config helpers Ian Rogers
2025-10-05 18:24 ` [PATCH v7 26/27] perf test parse-events: Add evlist test helper Ian Rogers
2025-10-05 18:24 ` [PATCH v7 27/27] perf test parse-events: Add evsel " Ian Rogers
2025-10-08 11:06 ` [PATCH v7 00/27] Legacy hardware/cache events as json James Clark
2025-10-08 14:53   ` Ian Rogers
2025-10-15 15:53 ` Namhyung Kim
2025-10-15 17:39   ` James Clark
2025-10-15 21:24     ` Ian Rogers
2025-10-16 10:29       ` James Clark [this message]
2025-10-20 16:10         ` James Clark

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=b1a461b4-4358-4556-80ef-e7abd686f2e5@linaro.org \
    --to=james.clark@linaro.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=atishp@rivosinc.com \
    --cc=beeman@rivosinc.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=thomas.falcon@intel.com \
    --cc=vincent.weaver@maine.edu \
    --cc=xu.yang_2@nxp.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).