* [PATCH] perf build: prevent "argument list too long" error
@ 2026-03-03 21:15 Markus Mayer
2026-03-03 22:35 ` Ian Rogers
2026-03-04 14:23 ` Arnaldo Carvalho de Melo
0 siblings, 2 replies; 5+ messages in thread
From: Markus Mayer @ 2026-03-03 21:15 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark
Cc: Markus Mayer, Perf Mailing List, Linux Kernel Mailing List
Due to a recent change, building perf may result in a build error when
it is trying to "prune orphans". The file list passed to "rm" may exceed
what the shell can handle. The build will then abort with an error like
this:
TEST [...]/arm64/build/linux-custom/tools/perf/pmu-events/metric_test.log
make[5]: /bin/sh: Argument list too long
make[5]: *** [pmu-events/Build:217: prune_orphans] Error 127
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile.perf:773: [...]/tools/perf/pmu-events/pmu-events-in.o] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [Makefile.perf:289: sub-make] Error 2
Processing the arguments via "xargs", instead of passing the list of
files directly to "rm" via the shell, prevents this issue.
Fixes: 36a1b0061a5 (perf build: Reduce pmu-events related copying and mkdirs)
Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
tools/perf/pmu-events/Build | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index 63c65788d442..dc5f94862a3b 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -214,7 +214,8 @@ ifneq ($(strip $(ORPHAN_FILES)),)
quiet_cmd_rm = RM $^
prune_orphans: $(ORPHAN_FILES)
- $(Q)$(call echo-cmd,rm)rm -f $^
+ # The list of files can be long. Use xargs to prevent issues.
+ $(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f
JEVENTS_DEPS += prune_orphans
endif
--
2.52.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] perf build: prevent "argument list too long" error
2026-03-03 21:15 [PATCH] perf build: prevent "argument list too long" error Markus Mayer
@ 2026-03-03 22:35 ` Ian Rogers
2026-03-03 22:47 ` Markus Mayer
2026-03-04 14:23 ` Arnaldo Carvalho de Melo
1 sibling, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2026-03-03 22:35 UTC (permalink / raw)
To: Markus Mayer
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, James Clark, Perf Mailing List,
Linux Kernel Mailing List
On Tue, Mar 3, 2026 at 1:16 PM Markus Mayer <mmayer@broadcom.com> wrote:
>
> Due to a recent change, building perf may result in a build error when
> it is trying to "prune orphans". The file list passed to "rm" may exceed
> what the shell can handle. The build will then abort with an error like
> this:
>
> TEST [...]/arm64/build/linux-custom/tools/perf/pmu-events/metric_test.log
> make[5]: /bin/sh: Argument list too long
> make[5]: *** [pmu-events/Build:217: prune_orphans] Error 127
> make[5]: *** Waiting for unfinished jobs....
> make[4]: *** [Makefile.perf:773: [...]/tools/perf/pmu-events/pmu-events-in.o] Error 2
> make[4]: *** Waiting for unfinished jobs....
> make[3]: *** [Makefile.perf:289: sub-make] Error 2
>
> Processing the arguments via "xargs", instead of passing the list of
> files directly to "rm" via the shell, prevents this issue.
>
> Fixes: 36a1b0061a5 (perf build: Reduce pmu-events related copying and mkdirs)
> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
As with:
https://lore.kernel.org/lkml/20250728093153.2330009-1-changqing.li@windriver.com/
I'm not able to reproduce the problem but the change makes sense.
Reviewed-by: Ian Rogers <irogers@google.com>
Thanks,
Ian
> ---
> tools/perf/pmu-events/Build | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
> index 63c65788d442..dc5f94862a3b 100644
> --- a/tools/perf/pmu-events/Build
> +++ b/tools/perf/pmu-events/Build
> @@ -214,7 +214,8 @@ ifneq ($(strip $(ORPHAN_FILES)),)
> quiet_cmd_rm = RM $^
>
> prune_orphans: $(ORPHAN_FILES)
> - $(Q)$(call echo-cmd,rm)rm -f $^
> + # The list of files can be long. Use xargs to prevent issues.
> + $(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f
>
> JEVENTS_DEPS += prune_orphans
> endif
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf build: prevent "argument list too long" error
2026-03-03 22:35 ` Ian Rogers
@ 2026-03-03 22:47 ` Markus Mayer
2026-03-03 22:59 ` Ian Rogers
0 siblings, 1 reply; 5+ messages in thread
From: Markus Mayer @ 2026-03-03 22:47 UTC (permalink / raw)
To: Ian Rogers
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, James Clark, Perf Mailing List,
Linux Kernel Mailing List
On Tue, 3 Mar 2026 at 14:35, Ian Rogers <irogers@google.com> wrote:
>
> On Tue, Mar 3, 2026 at 1:16 PM Markus Mayer <mmayer@broadcom.com> wrote:
> >
> > TEST [...]/arm64/build/linux-custom/tools/perf/pmu-events/metric_test.log
> > make[5]: /bin/sh: Argument list too long
> > make[5]: *** [pmu-events/Build:217: prune_orphans] Error 127
> > make[5]: *** Waiting for unfinished jobs....
> > make[4]: *** [Makefile.perf:773: [...]/tools/perf/pmu-events/pmu-events-in.o] Error 2
> > make[4]: *** Waiting for unfinished jobs....
> > make[3]: *** [Makefile.perf:289: sub-make] Error 2
>
> As with:
> https://lore.kernel.org/lkml/20250728093153.2330009-1-changqing.li@windriver.com/
> I'm not able to reproduce the problem but the change makes sense.
>
> Reviewed-by: Ian Rogers <irogers@google.com>
Thanks for the review. Not sure what makes my setup different from
yours. FWIW, it's an ARM64 cross-compile. I had the build system dump
the contents of $(ORPHAN_FILES) into a file for me. This is how many
files it was trying to pass via the shell:
$ wc -l json_files.txt
634 json_files.txt
Maybe you have fewer orphans to prune or your shell has a higher the
argument limit. Whatever the case, both our automated nightly builds
and manual builds have been running into this issue.
Regards,
-Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf build: prevent "argument list too long" error
2026-03-03 22:47 ` Markus Mayer
@ 2026-03-03 22:59 ` Ian Rogers
0 siblings, 0 replies; 5+ messages in thread
From: Ian Rogers @ 2026-03-03 22:59 UTC (permalink / raw)
To: Markus Mayer
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, James Clark, Perf Mailing List,
Linux Kernel Mailing List
On Tue, Mar 3, 2026 at 2:47 PM Markus Mayer <mmayer@broadcom.com> wrote:
>
> On Tue, 3 Mar 2026 at 14:35, Ian Rogers <irogers@google.com> wrote:
> >
> > On Tue, Mar 3, 2026 at 1:16 PM Markus Mayer <mmayer@broadcom.com> wrote:
> > >
> > > TEST [...]/arm64/build/linux-custom/tools/perf/pmu-events/metric_test.log
> > > make[5]: /bin/sh: Argument list too long
> > > make[5]: *** [pmu-events/Build:217: prune_orphans] Error 127
> > > make[5]: *** Waiting for unfinished jobs....
> > > make[4]: *** [Makefile.perf:773: [...]/tools/perf/pmu-events/pmu-events-in.o] Error 2
> > > make[4]: *** Waiting for unfinished jobs....
> > > make[3]: *** [Makefile.perf:289: sub-make] Error 2
> >
> > As with:
> > https://lore.kernel.org/lkml/20250728093153.2330009-1-changqing.li@windriver.com/
> > I'm not able to reproduce the problem but the change makes sense.
> >
> > Reviewed-by: Ian Rogers <irogers@google.com>
>
> Thanks for the review. Not sure what makes my setup different from
> yours. FWIW, it's an ARM64 cross-compile. I had the build system dump
> the contents of $(ORPHAN_FILES) into a file for me. This is how many
> files it was trying to pass via the shell:
>
> $ wc -l json_files.txt
> 634 json_files.txt
>
> Maybe you have fewer orphans to prune or your shell has a higher the
> argument limit. Whatever the case, both our automated nightly builds
> and manual builds have been running into this issue.
Yes, building an x86 version and then cross-compiling for ARM would
create a large set of orphan files requiring cleanup. Trying that with
a giant output directory path I couldn't trigger a breakage, but I
think I just have a very generous MAX_ARGS.
Thanks,
Ian
> Regards,
> -Markus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] perf build: prevent "argument list too long" error
2026-03-03 21:15 [PATCH] perf build: prevent "argument list too long" error Markus Mayer
2026-03-03 22:35 ` Ian Rogers
@ 2026-03-04 14:23 ` Arnaldo Carvalho de Melo
1 sibling, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-03-04 14:23 UTC (permalink / raw)
To: Markus Mayer
Cc: Peter Zijlstra, Ingo Molnar, Namhyung Kim, Mark Rutland,
Alexander Shishkin, Jiri Olsa, Ian Rogers, Adrian Hunter,
James Clark, Perf Mailing List, Linux Kernel Mailing List
On Tue, Mar 03, 2026 at 01:15:01PM -0800, Markus Mayer wrote:
> Due to a recent change, building perf may result in a build error when
> it is trying to "prune orphans". The file list passed to "rm" may exceed
> what the shell can handle. The build will then abort with an error like
> this:
>
> TEST [...]/arm64/build/linux-custom/tools/perf/pmu-events/metric_test.log
> make[5]: /bin/sh: Argument list too long
> make[5]: *** [pmu-events/Build:217: prune_orphans] Error 127
> make[5]: *** Waiting for unfinished jobs....
> make[4]: *** [Makefile.perf:773: [...]/tools/perf/pmu-events/pmu-events-in.o] Error 2
> make[4]: *** Waiting for unfinished jobs....
> make[3]: *** [Makefile.perf:289: sub-make] Error 2
>
> Processing the arguments via "xargs", instead of passing the list of
> files directly to "rm" via the shell, prevents this issue.
>
> Fixes: 36a1b0061a5 (perf build: Reduce pmu-events related copying and mkdirs)
> Signed-off-by: Markus Mayer <mmayer@broadcom.com>
Thanks, applied to perf-tools, for v7.0.
- Arnaldo
> ---
> tools/perf/pmu-events/Build | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
> index 63c65788d442..dc5f94862a3b 100644
> --- a/tools/perf/pmu-events/Build
> +++ b/tools/perf/pmu-events/Build
> @@ -214,7 +214,8 @@ ifneq ($(strip $(ORPHAN_FILES)),)
> quiet_cmd_rm = RM $^
>
> prune_orphans: $(ORPHAN_FILES)
> - $(Q)$(call echo-cmd,rm)rm -f $^
> + # The list of files can be long. Use xargs to prevent issues.
> + $(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f
>
> JEVENTS_DEPS += prune_orphans
> endif
> --
> 2.52.0
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-03-04 14:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-03 21:15 [PATCH] perf build: prevent "argument list too long" error Markus Mayer
2026-03-03 22:35 ` Ian Rogers
2026-03-03 22:47 ` Markus Mayer
2026-03-03 22:59 ` Ian Rogers
2026-03-04 14:23 ` Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox