diff mbox series

[v3,2/2] bpf: makefiles: do not generate empty vmlinux.h

Message ID 20221217223509.88254-3-changbin.du@gmail.com (mailing list archive)
State Accepted
Commit e7f0d5cdd023d8fa53d9ca541b9a55f0eb45618c
Headers show
Series bpftool: improve error handing for missing .BTF section | expand

Commit Message

Changbin Du Dec. 17, 2022, 10:35 p.m. UTC
Remove the empty vmlinux.h if bpftool failed to dump btf info.
The empty 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/testing/selftests/bpf/Makefile | 3 +++
 2 files changed, 6 insertions(+)

Comments

Leo Yan Dec. 19, 2022, 3:59 a.m. UTC | #1
On Sun, Dec 18, 2022 at 06:35:09AM +0800, Changbin Du wrote:
> Remove the empty vmlinux.h if bpftool failed to dump btf info.
> The empty vmlinux.h can hide real error when reading output
> of make.
> 
> This is done by adding .DELETE_ON_ERROR special target in related
> makefiles.

We need to handle the same case for perf building, its makefile
linux/tools/perf/Makefile.perf also uses bpftool to generate
vmlinux.h, see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Makefile.perf#n1067

Please consider to use a separate patch to add the same change in
Makefile.perf?

Thanks,
Leo

> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> ---
>  tools/bpf/bpftool/Makefile           | 3 +++
>  tools/testing/selftests/bpf/Makefile | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index 787b857d3fb5..313fd1b09189 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -289,3 +289,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/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index c22c43bbee19..205e8c3c346a 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -626,3 +626,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
>
Changbin Du Dec. 20, 2022, 1:26 a.m. UTC | #2
On Mon, Dec 19, 2022 at 11:59:38AM +0800, Leo Yan wrote:
> On Sun, Dec 18, 2022 at 06:35:09AM +0800, Changbin Du wrote:
> > Remove the empty vmlinux.h if bpftool failed to dump btf info.
> > The empty vmlinux.h can hide real error when reading output
> > of make.
> > 
> > This is done by adding .DELETE_ON_ERROR special target in related
> > makefiles.
> 
> We need to handle the same case for perf building, its makefile
> linux/tools/perf/Makefile.perf also uses bpftool to generate
> vmlinux.h, see:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Makefile.perf#n1067
> 
> Please consider to use a separate patch to add the same change in
> Makefile.perf?
>
It's alreay there.
https://lore.kernel.org/lkml/20221217225151.90387-1-changbin.du@gmail.com/T/

> Thanks,
> Leo
> 
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> >  tools/bpf/bpftool/Makefile           | 3 +++
> >  tools/testing/selftests/bpf/Makefile | 3 +++
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> > index 787b857d3fb5..313fd1b09189 100644
> > --- a/tools/bpf/bpftool/Makefile
> > +++ b/tools/bpf/bpftool/Makefile
> > @@ -289,3 +289,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/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index c22c43bbee19..205e8c3c346a 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -626,3 +626,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
> >
Quentin Monnet Dec. 20, 2022, 3:38 p.m. UTC | #3
2022-12-18 06:35 UTC+0800 ~ Changbin Du <changbin.du@gmail.com>
> Remove the empty vmlinux.h if bpftool failed to dump btf info.
> The empty 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/testing/selftests/bpf/Makefile | 3 +++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
> index 787b857d3fb5..313fd1b09189 100644
> --- a/tools/bpf/bpftool/Makefile
> +++ b/tools/bpf/bpftool/Makefile
> @@ -289,3 +289,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:

Acked-by: Quentin Monnet <quentin@isovalent.com>

Thanks!
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 787b857d3fb5..313fd1b09189 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -289,3 +289,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/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index c22c43bbee19..205e8c3c346a 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -626,3 +626,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: