* [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree
@ 2025-10-20 16:08 James Clark
2025-10-20 16:08 ` [PATCH 1/3] " James Clark
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: James Clark @ 2025-10-20 16:08 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, leo.yan
Cc: linux-perf-users, linux-kernel, James Clark
I hit this issue because I'm using clangd with a json compile database.
Not sure if anyone else will actually hit this, but it's not impossible
and the fix is trivial anyway. The first commit is the fix so has a tag.
The other two commits are minor related cleanups.
Signed-off-by: James Clark <james.clark@linaro.org>
---
James Clark (3):
perf jevents: Fix build when there are other json files in the tree
perf jevents: Remove unused makefile variable
perf jevents: Suppress circular dependency warnings
tools/perf/pmu-events/Build | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
base-commit: ad83f3b7155db28e82de24dbaa1af2b8f5d972a3
change-id: 20251020-james-perf-fix-json-find-9ffed1e52693
Best regards,
--
James Clark <james.clark@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] perf jevents: Fix build when there are other json files in the tree
2025-10-20 16:08 [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree James Clark
@ 2025-10-20 16:08 ` James Clark
2025-10-20 16:38 ` Leo Yan
2025-10-20 16:08 ` [PATCH 2/3] perf jevents: Remove unused makefile variable James Clark
` (3 subsequent siblings)
4 siblings, 1 reply; 9+ messages in thread
From: James Clark @ 2025-10-20 16:08 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, leo.yan
Cc: linux-perf-users, linux-kernel, James Clark
The unquoted glob *.json will expand to a real file if, for example,
there is any file in the Perf source ending in .json. This can happen
when using tools like Bear and clangd which generate a
compile_commands.json file. With the glob already expanded by the shell,
the find command will fail to wildcard any real json events files.
Fix it by wrapping the star in quotes so it's passed to find rather than
the shell.
This fixes the following build error (most of the diff output omitted):
$ make V=1 -C tools/perf O=/tmp/perf_build_with_json
TEST /tmp/perf_build_with_json/pmu-events/empty-pmu-events.log
...
/* offset=121053 */ "node-access\000legacy cache\000Local memory read accesses\000legacy-cache-config=6\000\00010\000\000\000\000\000"
/* offset=121135 */ "node-misses\000legacy cache\000Local memory read misses\000legacy-cache-config=0x10006\000\00010\000\000\000\000\000"
/* offset=121221 */ "node-miss\000legacy cache\000Local memory read misses\000legacy-cache-config=0x10006\000\00010\000\000\000\000\000"
...
- {
.event_table = { 0, 0 },
.metric_table = { 0, 0 },
},
make[3]: *** [pmu-events/Build:54: /tmp/perf_build_with_json/pmu-events/empty-pmu-events.log] Error 1
Fixes: 4bb55de4ff03 ("perf jevents: Support copying the source json files to OUTPUT")
Signed-off-by: James Clark <james.clark@linaro.org>
---
tools/perf/pmu-events/Build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index 4ebf37c14978..ee8ba74f82de 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -1,6 +1,6 @@
pmu-events-y += pmu-events.o
JDIR = pmu-events/arch/$(SRCARCH)
-JSON = $(shell find pmu-events/arch -name *.json -o -name *.csv)
+JSON = $(shell find pmu-events/arch -name '*.json' -o -name '*.csv')
JDIR_TEST = pmu-events/arch/test
JSON_TEST = $(shell [ -d $(JDIR_TEST) ] && \
find $(JDIR_TEST) -name '*.json')
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] perf jevents: Remove unused makefile variable
2025-10-20 16:08 [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree James Clark
2025-10-20 16:08 ` [PATCH 1/3] " James Clark
@ 2025-10-20 16:08 ` James Clark
2025-10-20 16:08 ` [PATCH 3/3] perf jevents: Suppress circular dependency warnings James Clark
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: James Clark @ 2025-10-20 16:08 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, leo.yan
Cc: linux-perf-users, linux-kernel, James Clark
JDIR is unused since commit 4bb55de4ff03 ("perf jevents: Support copying
the source json files to OUTPUT"), remove it.
Signed-off-by: James Clark <james.clark@linaro.org>
---
tools/perf/pmu-events/Build | 1 -
1 file changed, 1 deletion(-)
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index ee8ba74f82de..c5e2d5f13766 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -1,5 +1,4 @@
pmu-events-y += pmu-events.o
-JDIR = pmu-events/arch/$(SRCARCH)
JSON = $(shell find pmu-events/arch -name '*.json' -o -name '*.csv')
JDIR_TEST = pmu-events/arch/test
JSON_TEST = $(shell [ -d $(JDIR_TEST) ] && \
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] perf jevents: Suppress circular dependency warnings
2025-10-20 16:08 [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree James Clark
2025-10-20 16:08 ` [PATCH 1/3] " James Clark
2025-10-20 16:08 ` [PATCH 2/3] perf jevents: Remove unused makefile variable James Clark
@ 2025-10-20 16:08 ` James Clark
2025-10-21 4:09 ` Namhyung Kim
2025-10-20 16:48 ` [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree Leo Yan
2025-10-22 0:39 ` Namhyung Kim
4 siblings, 1 reply; 9+ messages in thread
From: James Clark @ 2025-10-20 16:08 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, leo.yan
Cc: linux-perf-users, linux-kernel, James Clark
When doing an in source build, $(OUTPUT) is empty so the rule has the
same input and output file. Suppress the warning by only adding the rule
when doing an out of source build. The same condition already exists for
the clean rule for json files.
This fixes the following warnings:
make[3]: Circular pmu-events/arch/nds32/mapfile.csv <- pmu-events/arch/nds32/mapfile.csv dependency dropped.
make[3]: Circular pmu-events/arch/powerpc/mapfile.csv <- pmu-events/arch/powerpc/mapfile.csv dependency dropped.
...
Signed-off-by: James Clark <james.clark@linaro.org>
---
tools/perf/pmu-events/Build | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index c5e2d5f13766..a46ab7b612df 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -29,10 +29,12 @@ $(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C)
$(call rule_mkdir)
$(Q)$(call echo-cmd,gen)cp $< $@
else
-# Copy checked-in json for generation.
+# Copy checked-in json to OUTPUT for generation if it's an out of source build
+ifneq ($(OUTPUT),)
$(OUTPUT)pmu-events/arch/%: pmu-events/arch/%
$(call rule_mkdir)
$(Q)$(call echo-cmd,gen)cp $< $@
+endif
$(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY)
$(call rule_mkdir)
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] perf jevents: Fix build when there are other json files in the tree
2025-10-20 16:08 ` [PATCH 1/3] " James Clark
@ 2025-10-20 16:38 ` Leo Yan
2025-10-21 8:28 ` James Clark
0 siblings, 1 reply; 9+ messages in thread
From: Leo Yan @ 2025-10-20 16:38 UTC (permalink / raw)
To: James Clark
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, linux-perf-users, linux-kernel
On Mon, Oct 20, 2025 at 05:08:26PM +0100, James Clark wrote:
> The unquoted glob *.json will expand to a real file if, for example,
> there is any file in the Perf source ending in .json. This can happen
> when using tools like Bear and clangd which generate a
> compile_commands.json file. With the glob already expanded by the shell,
> the find command will fail to wildcard any real json events files.
>
> Fix it by wrapping the star in quotes so it's passed to find rather than
> the shell.
>
> This fixes the following build error (most of the diff output omitted):
>
> $ make V=1 -C tools/perf O=/tmp/perf_build_with_json
>
> TEST /tmp/perf_build_with_json/pmu-events/empty-pmu-events.log
> ...
> /* offset=121053 */ "node-access\000legacy cache\000Local memory read accesses\000legacy-cache-config=6\000\00010\000\000\000\000\000"
> /* offset=121135 */ "node-misses\000legacy cache\000Local memory read misses\000legacy-cache-config=0x10006\000\00010\000\000\000\000\000"
> /* offset=121221 */ "node-miss\000legacy cache\000Local memory read misses\000legacy-cache-config=0x10006\000\00010\000\000\000\000\000"
> ...
> - {
> .event_table = { 0, 0 },
> .metric_table = { 0, 0 },
> },
> make[3]: *** [pmu-events/Build:54: /tmp/perf_build_with_json/pmu-events/empty-pmu-events.log] Error 1
>
> Fixes: 4bb55de4ff03 ("perf jevents: Support copying the source json files to OUTPUT")
> Signed-off-by: James Clark <james.clark@linaro.org>
Searched a bit, if without quotes, the wildcard will be expanded by make
but not by shell. It makes sense for me to fix it with quotes.
Reviewed-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree
2025-10-20 16:08 [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree James Clark
` (2 preceding siblings ...)
2025-10-20 16:08 ` [PATCH 3/3] perf jevents: Suppress circular dependency warnings James Clark
@ 2025-10-20 16:48 ` Leo Yan
2025-10-22 0:39 ` Namhyung Kim
4 siblings, 0 replies; 9+ messages in thread
From: Leo Yan @ 2025-10-20 16:48 UTC (permalink / raw)
To: James Clark
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, linux-perf-users, linux-kernel
On Mon, Oct 20, 2025 at 05:08:25PM +0100, James Clark wrote:
> I hit this issue because I'm using clangd with a json compile database.
> Not sure if anyone else will actually hit this, but it's not impossible
> and the fix is trivial anyway. The first commit is the fix so has a tag.
> The other two commits are minor related cleanups.
I can reproduce the issue and the redundant warning, and confirmed
the series can fix them:
Tested-by: Leo Yan <leo.yan@arm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] perf jevents: Suppress circular dependency warnings
2025-10-20 16:08 ` [PATCH 3/3] perf jevents: Suppress circular dependency warnings James Clark
@ 2025-10-21 4:09 ` Namhyung Kim
0 siblings, 0 replies; 9+ messages in thread
From: Namhyung Kim @ 2025-10-21 4:09 UTC (permalink / raw)
To: James Clark
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, leo.yan, linux-perf-users, linux-kernel
On Mon, Oct 20, 2025 at 05:08:28PM +0100, James Clark wrote:
> When doing an in source build, $(OUTPUT) is empty so the rule has the
> same input and output file. Suppress the warning by only adding the rule
> when doing an out of source build. The same condition already exists for
> the clean rule for json files.
>
> This fixes the following warnings:
>
> make[3]: Circular pmu-events/arch/nds32/mapfile.csv <- pmu-events/arch/nds32/mapfile.csv dependency dropped.
> make[3]: Circular pmu-events/arch/powerpc/mapfile.csv <- pmu-events/arch/powerpc/mapfile.csv dependency dropped.
> ...
I noticed this too and confirm it's fixed by this change.
Tested-by: Namhyung Kim <namhyung@kernel.org>
Thanks,
Namhyung
>
> Signed-off-by: James Clark <james.clark@linaro.org>
> ---
> tools/perf/pmu-events/Build | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
> index c5e2d5f13766..a46ab7b612df 100644
> --- a/tools/perf/pmu-events/Build
> +++ b/tools/perf/pmu-events/Build
> @@ -29,10 +29,12 @@ $(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C)
> $(call rule_mkdir)
> $(Q)$(call echo-cmd,gen)cp $< $@
> else
> -# Copy checked-in json for generation.
> +# Copy checked-in json to OUTPUT for generation if it's an out of source build
> +ifneq ($(OUTPUT),)
> $(OUTPUT)pmu-events/arch/%: pmu-events/arch/%
> $(call rule_mkdir)
> $(Q)$(call echo-cmd,gen)cp $< $@
> +endif
>
> $(LEGACY_CACHE_JSON): $(LEGACY_CACHE_PY)
> $(call rule_mkdir)
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] perf jevents: Fix build when there are other json files in the tree
2025-10-20 16:38 ` Leo Yan
@ 2025-10-21 8:28 ` James Clark
0 siblings, 0 replies; 9+ messages in thread
From: James Clark @ 2025-10-21 8:28 UTC (permalink / raw)
To: Leo Yan
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, linux-perf-users, linux-kernel
On 20/10/2025 5:38 pm, Leo Yan wrote:
> On Mon, Oct 20, 2025 at 05:08:26PM +0100, James Clark wrote:
>> The unquoted glob *.json will expand to a real file if, for example,
>> there is any file in the Perf source ending in .json. This can happen
>> when using tools like Bear and clangd which generate a
>> compile_commands.json file. With the glob already expanded by the shell,
>> the find command will fail to wildcard any real json events files.
>>
>> Fix it by wrapping the star in quotes so it's passed to find rather than
>> the shell.
>>
>> This fixes the following build error (most of the diff output omitted):
>>
>> $ make V=1 -C tools/perf O=/tmp/perf_build_with_json
>>
>> TEST /tmp/perf_build_with_json/pmu-events/empty-pmu-events.log
>> ...
>> /* offset=121053 */ "node-access\000legacy cache\000Local memory read accesses\000legacy-cache-config=6\000\00010\000\000\000\000\000"
>> /* offset=121135 */ "node-misses\000legacy cache\000Local memory read misses\000legacy-cache-config=0x10006\000\00010\000\000\000\000\000"
>> /* offset=121221 */ "node-miss\000legacy cache\000Local memory read misses\000legacy-cache-config=0x10006\000\00010\000\000\000\000\000"
>> ...
>> - {
>> .event_table = { 0, 0 },
>> .metric_table = { 0, 0 },
>> },
>> make[3]: *** [pmu-events/Build:54: /tmp/perf_build_with_json/pmu-events/empty-pmu-events.log] Error 1
>>
>> Fixes: 4bb55de4ff03 ("perf jevents: Support copying the source json files to OUTPUT")
>> Signed-off-by: James Clark <james.clark@linaro.org>
>
> Searched a bit, if without quotes, the wildcard will be expanded by make
> but not by shell. It makes sense for me to fix it with quotes.
>
I think it is the shell. The only * expanded by make is file names on
the right hand side of rules. Either way it only makes a difference to
the commit message.
> Reviewed-by: Leo Yan <leo.yan@arm.com>
Thanks for the review.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree
2025-10-20 16:08 [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree James Clark
` (3 preceding siblings ...)
2025-10-20 16:48 ` [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree Leo Yan
@ 2025-10-22 0:39 ` Namhyung Kim
4 siblings, 0 replies; 9+ messages in thread
From: Namhyung Kim @ 2025-10-22 0:39 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
Adrian Hunter, leo.yan, James Clark
Cc: linux-perf-users, linux-kernel
On Mon, 20 Oct 2025 17:08:25 +0100, James Clark wrote:
> I hit this issue because I'm using clangd with a json compile database.
> Not sure if anyone else will actually hit this, but it's not impossible
> and the fix is trivial anyway. The first commit is the fix so has a tag.
> The other two commits are minor related cleanups.
>
>
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-10-22 0:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-20 16:08 [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree James Clark
2025-10-20 16:08 ` [PATCH 1/3] " James Clark
2025-10-20 16:38 ` Leo Yan
2025-10-21 8:28 ` James Clark
2025-10-20 16:08 ` [PATCH 2/3] perf jevents: Remove unused makefile variable James Clark
2025-10-20 16:08 ` [PATCH 3/3] perf jevents: Suppress circular dependency warnings James Clark
2025-10-21 4:09 ` Namhyung Kim
2025-10-20 16:48 ` [PATCH 0/3] perf jevents: Fix build when there are other json files in the tree Leo Yan
2025-10-22 0:39 ` Namhyung Kim
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).