[PATCH v2 2/2] bpf: makefiles: do not generate empty vmlinux.h

Changbin Du posted 2 patches 2 years, 9 months ago
There is a newer version of this series
[PATCH v2 2/2] bpf: makefiles: do not generate empty vmlinux.h
Posted by Changbin Du 2 years, 9 months ago
Remove the empty vmlinux.h if bpftool failed to dump btf info.
The emptry vmlinux.h can hide real error when reading output
of make.

This is done by adding .DELETE_ON_ERROR special target in related
makefiles.

Signed-off-by: Changbin Du <changbin.du@gmail.com>
---
 tools/bpf/bpftool/Makefile           | 3 +++
 tools/perf/Makefile.perf             | 2 ++
 tools/testing/selftests/bpf/Makefile | 3 +++
 3 files changed, 8 insertions(+)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 4a95c017ad4c..f6b1e65085db 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -265,3 +265,6 @@ FORCE:
 .PHONY: all FORCE bootstrap clean install-bin install uninstall
 .PHONY: doc doc-clean doc-install doc-uninstall
 .DEFAULT_GOAL := all
+
+# Delete partially updated (corrupted) files on error
+.DELETE_ON_ERROR:
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a432e59afc42..265254fc641a 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1149,3 +1149,5 @@ FORCE:
 .PHONY: libtraceevent_plugins archheaders
 
 endif # force_fixdep
+
+.DELETE_ON_ERROR:
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index e6cf21fad69f..f41c4b011221 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -617,3 +617,6 @@ EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR)	\
 			       liburandom_read.so)
 
 .PHONY: docs docs-clean
+
+# Delete partially updated (corrupted) files on error
+.DELETE_ON_ERROR:
-- 
2.37.2
Re: [PATCH v2 2/2] bpf: makefiles: do not generate empty vmlinux.h
Posted by Andrii Nakryiko 2 years, 9 months ago
On Tue, Nov 29, 2022 at 5:42 AM Changbin Du <changbin.du@gmail.com> wrote:
>
> Remove the empty vmlinux.h if bpftool failed to dump btf info.
> The emptry vmlinux.h can hide real error when reading output

typo: empty

> of make.
>
> This is done by adding .DELETE_ON_ERROR special target in related
> makefiles.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> ---
>  tools/bpf/bpftool/Makefile           | 3 +++
>  tools/perf/Makefile.perf             | 2 ++
>  tools/testing/selftests/bpf/Makefile | 3 +++
>  3 files changed, 8 insertions(+)
>
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index 4a95c017ad4c..f6b1e65085db 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -265,3 +265,6 @@ FORCE:
>  .PHONY: all FORCE bootstrap clean install-bin install uninstall
>  .PHONY: doc doc-clean doc-install doc-uninstall
>  .DEFAULT_GOAL := all
> +
> +# Delete partially updated (corrupted) files on error
> +.DELETE_ON_ERROR:
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index a432e59afc42..265254fc641a 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -1149,3 +1149,5 @@ FORCE:
>  .PHONY: libtraceevent_plugins archheaders
>
>  endif # force_fixdep
> +
> +.DELETE_ON_ERROR:

please split out perf changes, they should go through perf tree

> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index e6cf21fad69f..f41c4b011221 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -617,3 +617,6 @@ EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR)      \
>                                liburandom_read.so)
>
>  .PHONY: docs docs-clean
> +
> +# Delete partially updated (corrupted) files on error
> +.DELETE_ON_ERROR:
> --
> 2.37.2
>
Re: [PATCH v2 2/2] bpf: makefiles: do not generate empty vmlinux.h
Posted by Changbin Du 2 years, 9 months ago
On Wed, Nov 30, 2022 at 04:52:11PM -0800, Andrii Nakryiko wrote:
> On Tue, Nov 29, 2022 at 5:42 AM Changbin Du <changbin.du@gmail.com> wrote:
> >
> > Remove the empty vmlinux.h if bpftool failed to dump btf info.
> > The emptry vmlinux.h can hide real error when reading output
> 
> typo: empty
>
Will be fixed, thanks.

> > of make.
> >
> > This is done by adding .DELETE_ON_ERROR special target in related
> > makefiles.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> >  tools/bpf/bpftool/Makefile           | 3 +++
> >  tools/perf/Makefile.perf             | 2 ++
> >  tools/testing/selftests/bpf/Makefile | 3 +++
> >  3 files changed, 8 insertions(+)
> >
> > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> > index 4a95c017ad4c..f6b1e65085db 100644
> > --- a/tools/bpf/bpftool/Makefile
> > +++ b/tools/bpf/bpftool/Makefile
> > @@ -265,3 +265,6 @@ FORCE:
> >  .PHONY: all FORCE bootstrap clean install-bin install uninstall
> >  .PHONY: doc doc-clean doc-install doc-uninstall
> >  .DEFAULT_GOAL := all
> > +
> > +# Delete partially updated (corrupted) files on error
> > +.DELETE_ON_ERROR:
> > diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> > index a432e59afc42..265254fc641a 100644
> > --- a/tools/perf/Makefile.perf
> > +++ b/tools/perf/Makefile.perf
> > @@ -1149,3 +1149,5 @@ FORCE:
> >  .PHONY: libtraceevent_plugins archheaders
> >
> >  endif # force_fixdep
> > +
> > +.DELETE_ON_ERROR:
> 
> please split out perf changes, they should go through perf tree
> 
sure, I'll send a standalone patch to perf tree.

> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index e6cf21fad69f..f41c4b011221 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -617,3 +617,6 @@ EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR)      \
> >                                liburandom_read.so)
> >
> >  .PHONY: docs docs-clean
> > +
> > +# Delete partially updated (corrupted) files on error
> > +.DELETE_ON_ERROR:
> > --
> > 2.37.2
> >

-- 
Cheers,
Changbin Du