* [PATCH bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile [not found] <20210129134855.195810-1-jolsa@redhat.com> @ 2021-02-04 21:18 ` Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories Jiri Olsa ` (3 more replies) 0 siblings, 4 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-04 21:18 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild hi, resolve_btfids tool is used during the kernel build, so we should clean it on kernel's make clean. thanks, jirka --- Jiri Olsa (4): tools/resolve_btfids: Build libbpf and libsubcmd in separate directories tools/resolve_btfids: Check objects before removing tools/resolve_btfids: Set srctree variable unconditionally kbuild: Add resolve_btfids clean to root clean target Makefile | 7 ++++++- tools/bpf/resolve_btfids/.gitignore | 2 -- tools/bpf/resolve_btfids/Makefile | 38 ++++++++++++++++++++------------------ 3 files changed, 26 insertions(+), 21 deletions(-) ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories 2021-02-04 21:18 ` [PATCH bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile Jiri Olsa @ 2021-02-04 21:18 ` Jiri Olsa 2021-02-04 23:33 ` Song Liu 2021-02-05 0:39 ` Andrii Nakryiko 2021-02-04 21:18 ` [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing Jiri Olsa ` (2 subsequent siblings) 3 siblings, 2 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-04 21:18 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild Setting up separate build directories for libbpf and libpsubcmd, so it's separated from other objects and we don't get them mixed in the future. It also simplifies cleaning, which is now simple rm -rf. Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h files in .gitignore anymore. Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- tools/bpf/resolve_btfids/.gitignore | 2 -- tools/bpf/resolve_btfids/Makefile | 26 +++++++++++--------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/tools/bpf/resolve_btfids/.gitignore b/tools/bpf/resolve_btfids/.gitignore index a026df7dc280..25f308c933cc 100644 --- a/tools/bpf/resolve_btfids/.gitignore +++ b/tools/bpf/resolve_btfids/.gitignore @@ -1,4 +1,2 @@ -/FEATURE-DUMP.libbpf -/bpf_helper_defs.h /fixdep /resolve_btfids diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile index bf656432ad73..b780b3a9fb07 100644 --- a/tools/bpf/resolve_btfids/Makefile +++ b/tools/bpf/resolve_btfids/Makefile @@ -28,22 +28,22 @@ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ LIBBPF_SRC := $(srctree)/tools/lib/bpf/ SUBCMD_SRC := $(srctree)/tools/lib/subcmd/ -BPFOBJ := $(OUTPUT)/libbpf.a -SUBCMDOBJ := $(OUTPUT)/libsubcmd.a +BPFOBJ := $(OUTPUT)/libbpf/libbpf.a +SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a BINARY := $(OUTPUT)/resolve_btfids BINARY_IN := $(BINARY)-in.o all: $(BINARY) -$(OUTPUT): +$(OUTPUT) $(OUTPUT)/libbpf $(OUTPUT)/libsubcmd: $(call msg,MKDIR,,$@) - $(Q)mkdir -p $(OUTPUT) + $(Q)mkdir -p $(@) -$(SUBCMDOBJ): fixdep FORCE - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) +$(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd + $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) -$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT) +$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)/libbpf $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) CFLAGS := -g \ @@ -57,23 +57,19 @@ LIBS = -lelf -lz export srctree OUTPUT CFLAGS Q include $(srctree)/tools/build/Makefile.include -$(BINARY_IN): fixdep FORCE +$(BINARY_IN): fixdep FORCE | $(OUTPUT) $(Q)$(MAKE) $(build)=resolve_btfids $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) $(call msg,LINK,$@) $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) -libsubcmd-clean: - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) clean - -libbpf-clean: - $(Q)$(MAKE) -C $(LIBBPF_SRC) OUTPUT=$(OUTPUT) clean - -clean: libsubcmd-clean libbpf-clean fixdep-clean +clean: fixdep-clean $(call msg,CLEAN,$(BINARY)) $(Q)$(RM) -f $(BINARY); \ $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ + $(RM) -rf $(OUTPUT)libbpf; \ + $(RM) -rf $(OUTPUT)libsubcmd; \ find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) tags: -- 2.26.2 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories 2021-02-04 21:18 ` [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories Jiri Olsa @ 2021-02-04 23:33 ` Song Liu 2021-02-05 0:39 ` Andrii Nakryiko 1 sibling, 0 replies; 27+ messages in thread From: Song Liu @ 2021-02-04 23:33 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Networking, bpf, Martin Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild > On Feb 4, 2021, at 1:18 PM, Jiri Olsa <jolsa@kernel.org> wrote: > > Setting up separate build directories for libbpf and libpsubcmd, > so it's separated from other objects and we don't get them mixed > in the future. > > It also simplifies cleaning, which is now simple rm -rf. > > Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h > files in .gitignore anymore. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> [...] ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories 2021-02-04 21:18 ` [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories Jiri Olsa 2021-02-04 23:33 ` Song Liu @ 2021-02-05 0:39 ` Andrii Nakryiko 2021-02-05 10:35 ` Jiri Olsa 1 sibling, 1 reply; 27+ messages in thread From: Andrii Nakryiko @ 2021-02-05 0:39 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Thu, Feb 4, 2021 at 1:20 PM Jiri Olsa <jolsa@kernel.org> wrote: > > Setting up separate build directories for libbpf and libpsubcmd, > so it's separated from other objects and we don't get them mixed > in the future. > > It also simplifies cleaning, which is now simple rm -rf. > > Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h > files in .gitignore anymore. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- > tools/bpf/resolve_btfids/.gitignore | 2 -- > tools/bpf/resolve_btfids/Makefile | 26 +++++++++++--------------- > 2 files changed, 11 insertions(+), 17 deletions(-) > > diff --git a/tools/bpf/resolve_btfids/.gitignore b/tools/bpf/resolve_btfids/.gitignore > index a026df7dc280..25f308c933cc 100644 > --- a/tools/bpf/resolve_btfids/.gitignore > +++ b/tools/bpf/resolve_btfids/.gitignore > @@ -1,4 +1,2 @@ > -/FEATURE-DUMP.libbpf > -/bpf_helper_defs.h > /fixdep > /resolve_btfids > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > index bf656432ad73..b780b3a9fb07 100644 > --- a/tools/bpf/resolve_btfids/Makefile > +++ b/tools/bpf/resolve_btfids/Makefile > @@ -28,22 +28,22 @@ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > LIBBPF_SRC := $(srctree)/tools/lib/bpf/ > SUBCMD_SRC := $(srctree)/tools/lib/subcmd/ > > -BPFOBJ := $(OUTPUT)/libbpf.a > -SUBCMDOBJ := $(OUTPUT)/libsubcmd.a > +BPFOBJ := $(OUTPUT)/libbpf/libbpf.a > +SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a > > BINARY := $(OUTPUT)/resolve_btfids > BINARY_IN := $(BINARY)-in.o > > all: $(BINARY) > > -$(OUTPUT): > +$(OUTPUT) $(OUTPUT)/libbpf $(OUTPUT)/libsubcmd: > $(call msg,MKDIR,,$@) > - $(Q)mkdir -p $(OUTPUT) > + $(Q)mkdir -p $(@) > > -$(SUBCMDOBJ): fixdep FORCE > - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) > +$(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd > + $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) > > -$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT) > +$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)/libbpf > $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) > > CFLAGS := -g \ > @@ -57,23 +57,19 @@ LIBS = -lelf -lz > export srctree OUTPUT CFLAGS Q > include $(srctree)/tools/build/Makefile.include > > -$(BINARY_IN): fixdep FORCE > +$(BINARY_IN): fixdep FORCE | $(OUTPUT) > $(Q)$(MAKE) $(build)=resolve_btfids > > $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) > $(call msg,LINK,$@) > $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) > > -libsubcmd-clean: > - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) clean > - > -libbpf-clean: > - $(Q)$(MAKE) -C $(LIBBPF_SRC) OUTPUT=$(OUTPUT) clean > - > -clean: libsubcmd-clean libbpf-clean fixdep-clean > +clean: fixdep-clean > $(call msg,CLEAN,$(BINARY)) > $(Q)$(RM) -f $(BINARY); \ > $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ > + $(RM) -rf $(OUTPUT)libbpf; \ > + $(RM) -rf $(OUTPUT)libsubcmd; \ If someone specifies OUTPUT=bla, you will attempt to delete blalibbpf, not bla/libbpf > find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) > > tags: > -- > 2.26.2 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories 2021-02-05 0:39 ` Andrii Nakryiko @ 2021-02-05 10:35 ` Jiri Olsa 0 siblings, 0 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-05 10:35 UTC (permalink / raw) To: Andrii Nakryiko Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Thu, Feb 04, 2021 at 04:39:38PM -0800, Andrii Nakryiko wrote: > On Thu, Feb 4, 2021 at 1:20 PM Jiri Olsa <jolsa@kernel.org> wrote: > > > > Setting up separate build directories for libbpf and libpsubcmd, > > so it's separated from other objects and we don't get them mixed > > in the future. > > > > It also simplifies cleaning, which is now simple rm -rf. > > > > Also there's no need for FEATURE-DUMP.libbpf and bpf_helper_defs.h > > files in .gitignore anymore. > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > --- > > tools/bpf/resolve_btfids/.gitignore | 2 -- > > tools/bpf/resolve_btfids/Makefile | 26 +++++++++++--------------- > > 2 files changed, 11 insertions(+), 17 deletions(-) > > > > diff --git a/tools/bpf/resolve_btfids/.gitignore b/tools/bpf/resolve_btfids/.gitignore > > index a026df7dc280..25f308c933cc 100644 > > --- a/tools/bpf/resolve_btfids/.gitignore > > +++ b/tools/bpf/resolve_btfids/.gitignore > > @@ -1,4 +1,2 @@ > > -/FEATURE-DUMP.libbpf > > -/bpf_helper_defs.h > > /fixdep > > /resolve_btfids > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > > index bf656432ad73..b780b3a9fb07 100644 > > --- a/tools/bpf/resolve_btfids/Makefile > > +++ b/tools/bpf/resolve_btfids/Makefile > > @@ -28,22 +28,22 @@ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > LIBBPF_SRC := $(srctree)/tools/lib/bpf/ > > SUBCMD_SRC := $(srctree)/tools/lib/subcmd/ > > > > -BPFOBJ := $(OUTPUT)/libbpf.a > > -SUBCMDOBJ := $(OUTPUT)/libsubcmd.a > > +BPFOBJ := $(OUTPUT)/libbpf/libbpf.a > > +SUBCMDOBJ := $(OUTPUT)/libsubcmd/libsubcmd.a > > > > BINARY := $(OUTPUT)/resolve_btfids > > BINARY_IN := $(BINARY)-in.o > > > > all: $(BINARY) > > > > -$(OUTPUT): > > +$(OUTPUT) $(OUTPUT)/libbpf $(OUTPUT)/libsubcmd: > > $(call msg,MKDIR,,$@) > > - $(Q)mkdir -p $(OUTPUT) > > + $(Q)mkdir -p $(@) > > > > -$(SUBCMDOBJ): fixdep FORCE > > - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) > > +$(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd > > + $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) > > > > -$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT) > > +$(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(OUTPUT)/libbpf > > $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@) > > > > CFLAGS := -g \ > > @@ -57,23 +57,19 @@ LIBS = -lelf -lz > > export srctree OUTPUT CFLAGS Q > > include $(srctree)/tools/build/Makefile.include > > > > -$(BINARY_IN): fixdep FORCE > > +$(BINARY_IN): fixdep FORCE | $(OUTPUT) > > $(Q)$(MAKE) $(build)=resolve_btfids > > > > $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) > > $(call msg,LINK,$@) > > $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) > > > > -libsubcmd-clean: > > - $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(OUTPUT) clean > > - > > -libbpf-clean: > > - $(Q)$(MAKE) -C $(LIBBPF_SRC) OUTPUT=$(OUTPUT) clean > > - > > -clean: libsubcmd-clean libbpf-clean fixdep-clean > > +clean: fixdep-clean > > $(call msg,CLEAN,$(BINARY)) > > $(Q)$(RM) -f $(BINARY); \ > > $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ > > + $(RM) -rf $(OUTPUT)libbpf; \ > > + $(RM) -rf $(OUTPUT)libsubcmd; \ > > If someone specifies OUTPUT=bla, you will attempt to delete blalibbpf, > not bla/libbpf will add missing '/', thanks jirka ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing 2021-02-04 21:18 ` [PATCH bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories Jiri Olsa @ 2021-02-04 21:18 ` Jiri Olsa 2021-02-04 23:41 ` Song Liu 2021-02-05 0:42 ` Andrii Nakryiko 2021-02-04 21:18 ` [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa 3 siblings, 2 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-04 21:18 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild We want this clean to be called from tree's root clean and that one is silent if there's nothing to clean. Adding check for all object to clean and display CLEAN messages only if there are objects to remove. Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- tools/bpf/resolve_btfids/Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile index b780b3a9fb07..3007cfabf5e6 100644 --- a/tools/bpf/resolve_btfids/Makefile +++ b/tools/bpf/resolve_btfids/Makefile @@ -64,13 +64,20 @@ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) $(call msg,LINK,$@) $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) +clean_objects := $(wildcard $(OUTPUT)/*.o \ + $(OUTPUT)/.*.o.cmd \ + $(OUTPUT)/.*.o.d \ + $(OUTPUT)/libbpf \ + $(OUTPUT)/libsubcmd \ + $(OUTPUT)/resolve_btfids) + +clean: + +ifneq ($(clean_objects),) clean: fixdep-clean $(call msg,CLEAN,$(BINARY)) - $(Q)$(RM) -f $(BINARY); \ - $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ - $(RM) -rf $(OUTPUT)libbpf; \ - $(RM) -rf $(OUTPUT)libsubcmd; \ - find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) + $(Q)$(RM) -rf $(clean_objects) +endif tags: $(call msg,GEN,,tags) -- 2.26.2 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing 2021-02-04 21:18 ` [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing Jiri Olsa @ 2021-02-04 23:41 ` Song Liu 2021-02-05 0:42 ` Andrii Nakryiko 1 sibling, 0 replies; 27+ messages in thread From: Song Liu @ 2021-02-04 23:41 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, netdev, bpf, Martin Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild > On Feb 4, 2021, at 1:18 PM, Jiri Olsa <jolsa@kernel.org> wrote: > > We want this clean to be called from tree's root clean > and that one is silent if there's nothing to clean. > > Adding check for all object to clean and display CLEAN > messages only if there are objects to remove. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> > --- > tools/bpf/resolve_btfids/Makefile | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > index b780b3a9fb07..3007cfabf5e6 100644 > --- a/tools/bpf/resolve_btfids/Makefile > +++ b/tools/bpf/resolve_btfids/Makefile > @@ -64,13 +64,20 @@ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) > $(call msg,LINK,$@) > $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) > > +clean_objects := $(wildcard $(OUTPUT)/*.o \ > + $(OUTPUT)/.*.o.cmd \ > + $(OUTPUT)/.*.o.d \ > + $(OUTPUT)/libbpf \ > + $(OUTPUT)/libsubcmd \ > + $(OUTPUT)/resolve_btfids) > + > +clean: > + > +ifneq ($(clean_objects),) > clean: fixdep-clean > $(call msg,CLEAN,$(BINARY)) > - $(Q)$(RM) -f $(BINARY); \ > - $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ > - $(RM) -rf $(OUTPUT)libbpf; \ > - $(RM) -rf $(OUTPUT)libsubcmd; \ > - find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) > + $(Q)$(RM) -rf $(clean_objects) > +endif > > tags: > $(call msg,GEN,,tags) > -- > 2.26.2 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing 2021-02-04 21:18 ` [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing Jiri Olsa 2021-02-04 23:41 ` Song Liu @ 2021-02-05 0:42 ` Andrii Nakryiko 2021-02-05 10:40 ` Jiri Olsa 1 sibling, 1 reply; 27+ messages in thread From: Andrii Nakryiko @ 2021-02-05 0:42 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Thu, Feb 4, 2021 at 1:20 PM Jiri Olsa <jolsa@kernel.org> wrote: > > We want this clean to be called from tree's root clean > and that one is silent if there's nothing to clean. > > Adding check for all object to clean and display CLEAN > messages only if there are objects to remove. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- > tools/bpf/resolve_btfids/Makefile | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > index b780b3a9fb07..3007cfabf5e6 100644 > --- a/tools/bpf/resolve_btfids/Makefile > +++ b/tools/bpf/resolve_btfids/Makefile > @@ -64,13 +64,20 @@ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) > $(call msg,LINK,$@) > $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) > > +clean_objects := $(wildcard $(OUTPUT)/*.o \ > + $(OUTPUT)/.*.o.cmd \ > + $(OUTPUT)/.*.o.d \ > + $(OUTPUT)/libbpf \ > + $(OUTPUT)/libsubcmd \ > + $(OUTPUT)/resolve_btfids) > + > +clean: > + > +ifneq ($(clean_objects),) > clean: fixdep-clean this looks a bit weird, declaring clean twice. Wouldn't moving ifneq inside the clean work just fine? > $(call msg,CLEAN,$(BINARY)) > - $(Q)$(RM) -f $(BINARY); \ > - $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ > - $(RM) -rf $(OUTPUT)libbpf; \ > - $(RM) -rf $(OUTPUT)libsubcmd; \ > - find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) > + $(Q)$(RM) -rf $(clean_objects) > +endif > > tags: > $(call msg,GEN,,tags) > -- > 2.26.2 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing 2021-02-05 0:42 ` Andrii Nakryiko @ 2021-02-05 10:40 ` Jiri Olsa 0 siblings, 0 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-05 10:40 UTC (permalink / raw) To: Andrii Nakryiko Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Thu, Feb 04, 2021 at 04:42:41PM -0800, Andrii Nakryiko wrote: > On Thu, Feb 4, 2021 at 1:20 PM Jiri Olsa <jolsa@kernel.org> wrote: > > > > We want this clean to be called from tree's root clean > > and that one is silent if there's nothing to clean. > > > > Adding check for all object to clean and display CLEAN > > messages only if there are objects to remove. > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > --- > > tools/bpf/resolve_btfids/Makefile | 17 ++++++++++++----- > > 1 file changed, 12 insertions(+), 5 deletions(-) > > > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > > index b780b3a9fb07..3007cfabf5e6 100644 > > --- a/tools/bpf/resolve_btfids/Makefile > > +++ b/tools/bpf/resolve_btfids/Makefile > > @@ -64,13 +64,20 @@ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) > > $(call msg,LINK,$@) > > $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) > > > > +clean_objects := $(wildcard $(OUTPUT)/*.o \ > > + $(OUTPUT)/.*.o.cmd \ > > + $(OUTPUT)/.*.o.d \ > > + $(OUTPUT)/libbpf \ > > + $(OUTPUT)/libsubcmd \ > > + $(OUTPUT)/resolve_btfids) > > + > > +clean: > > + > > +ifneq ($(clean_objects),) > > clean: fixdep-clean > > this looks a bit weird, declaring clean twice. Wouldn't moving ifneq > inside the clean work just fine? it has the fixdep-clean dependency we don't want to run if clean_objects is not defined.. I could move the empty clean to the the else path jirka --- diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile index 1d46a247ec95..be09ec4f03ff 100644 --- a/tools/bpf/resolve_btfids/Makefile +++ b/tools/bpf/resolve_btfids/Makefile @@ -64,13 +64,20 @@ $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) $(call msg,LINK,$@) $(Q)$(CC) $(BINARY_IN) $(LDFLAGS) -o $@ $(BPFOBJ) $(SUBCMDOBJ) $(LIBS) +clean_objects := $(wildcard $(OUTPUT)/*.o \ + $(OUTPUT)/.*.o.cmd \ + $(OUTPUT)/.*.o.d \ + $(OUTPUT)/libbpf \ + $(OUTPUT)/libsubcmd \ + $(OUTPUT)/resolve_btfids) + +ifneq ($(clean_objects),) clean: fixdep-clean $(call msg,CLEAN,$(BINARY)) - $(Q)$(RM) -f $(BINARY); \ - $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \ - $(RM) -rf $(OUTPUT)/libbpf; \ - $(RM) -rf $(OUTPUT)/libsubcmd; \ - find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM) + $(Q)$(RM) -rf $(clean_objects) +else +clean: +endif tags: $(call msg,GEN,,tags) ^ permalink raw reply related [flat|nested] 27+ messages in thread
* [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally 2021-02-04 21:18 ` [PATCH bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing Jiri Olsa @ 2021-02-04 21:18 ` Jiri Olsa 2021-02-04 23:41 ` Song Liu 2021-02-05 1:24 ` Andrii Nakryiko 2021-02-04 21:18 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa 3 siblings, 2 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-04 21:18 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild We want this clean to be called from tree's root Makefile, which defines same srctree variable and that will screw the make setup. We actually do not use srctree being passed from outside, so we can solve this by setting current srctree value directly. Also root Makefile does not define the implicit RM variable, so adding RM initialization. Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- tools/bpf/resolve_btfids/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile index 3007cfabf5e6..b41fc9a81e83 100644 --- a/tools/bpf/resolve_btfids/Makefile +++ b/tools/bpf/resolve_btfids/Makefile @@ -2,11 +2,9 @@ include ../../scripts/Makefile.include include ../../scripts/Makefile.arch -ifeq ($(srctree),) srctree := $(patsubst %/,%,$(dir $(CURDIR))) srctree := $(patsubst %/,%,$(dir $(srctree))) srctree := $(patsubst %/,%,$(dir $(srctree))) -endif ifeq ($(V),1) Q = @@ -22,6 +20,7 @@ AR = $(HOSTAR) CC = $(HOSTCC) LD = $(HOSTLD) ARCH = $(HOSTARCH) +RM ?= rm OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ -- 2.26.2 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally 2021-02-04 21:18 ` [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally Jiri Olsa @ 2021-02-04 23:41 ` Song Liu 2021-02-05 1:24 ` Andrii Nakryiko 1 sibling, 0 replies; 27+ messages in thread From: Song Liu @ 2021-02-04 23:41 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, netdev, bpf, Martin Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild > On Feb 4, 2021, at 1:18 PM, Jiri Olsa <jolsa@kernel.org> wrote: > > We want this clean to be called from tree's root Makefile, > which defines same srctree variable and that will screw > the make setup. > > We actually do not use srctree being passed from outside, > so we can solve this by setting current srctree value > directly. > > Also root Makefile does not define the implicit RM variable, > so adding RM initialization. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> > --- > tools/bpf/resolve_btfids/Makefile | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > index 3007cfabf5e6..b41fc9a81e83 100644 > --- a/tools/bpf/resolve_btfids/Makefile > +++ b/tools/bpf/resolve_btfids/Makefile > @@ -2,11 +2,9 @@ > include ../../scripts/Makefile.include > include ../../scripts/Makefile.arch > > -ifeq ($(srctree),) > srctree := $(patsubst %/,%,$(dir $(CURDIR))) > srctree := $(patsubst %/,%,$(dir $(srctree))) > srctree := $(patsubst %/,%,$(dir $(srctree))) > -endif > > ifeq ($(V),1) > Q = > @@ -22,6 +20,7 @@ AR = $(HOSTAR) > CC = $(HOSTCC) > LD = $(HOSTLD) > ARCH = $(HOSTARCH) > +RM ?= rm > > OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > -- > 2.26.2 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally 2021-02-04 21:18 ` [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally Jiri Olsa 2021-02-04 23:41 ` Song Liu @ 2021-02-05 1:24 ` Andrii Nakryiko 1 sibling, 0 replies; 27+ messages in thread From: Andrii Nakryiko @ 2021-02-05 1:24 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Networking, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Thu, Feb 4, 2021 at 1:21 PM Jiri Olsa <jolsa@kernel.org> wrote: > > We want this clean to be called from tree's root Makefile, > which defines same srctree variable and that will screw > the make setup. > > We actually do not use srctree being passed from outside, > so we can solve this by setting current srctree value > directly. > > Also root Makefile does not define the implicit RM variable, > so adding RM initialization. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- > tools/bpf/resolve_btfids/Makefile | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile > index 3007cfabf5e6..b41fc9a81e83 100644 > --- a/tools/bpf/resolve_btfids/Makefile > +++ b/tools/bpf/resolve_btfids/Makefile > @@ -2,11 +2,9 @@ > include ../../scripts/Makefile.include > include ../../scripts/Makefile.arch > > -ifeq ($(srctree),) > srctree := $(patsubst %/,%,$(dir $(CURDIR))) > srctree := $(patsubst %/,%,$(dir $(srctree))) > srctree := $(patsubst %/,%,$(dir $(srctree))) Is this just a weird way of doing $(abspath $(CURDIR)/../../../)? Are there any advantages compared to a more straightforward way? > -endif > > ifeq ($(V),1) > Q = > @@ -22,6 +20,7 @@ AR = $(HOSTAR) > CC = $(HOSTCC) > LD = $(HOSTLD) > ARCH = $(HOSTARCH) > +RM ?= rm > > OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > -- > 2.26.2 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-04 21:18 ` [PATCH bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile Jiri Olsa ` (2 preceding siblings ...) 2021-02-04 21:18 ` [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally Jiri Olsa @ 2021-02-04 21:18 ` Jiri Olsa 2021-02-04 23:42 ` Song Liu 3 siblings, 1 reply; 27+ messages in thread From: Jiri Olsa @ 2021-02-04 21:18 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild The resolve_btfids tool is used during the kernel build, so we should clean it on kernel's make clean. Invoking the the resolve_btfids clean as part of root 'make clean'. Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b0e4767735dc..159d9592b587 100644 --- a/Makefile +++ b/Makefile @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION endif endif +PHONY += resolve_btfids_clean + +resolve_btfids_clean: + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean + ifdef CONFIG_BPF ifdef CONFIG_DEBUG_INFO_BTF ifeq ($(has_libelf),1) @@ -1495,7 +1500,7 @@ vmlinuxclean: $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) -clean: archclean vmlinuxclean +clean: archclean vmlinuxclean resolve_btfids_clean # mrproper - Delete all generated files, including .config # -- 2.26.2 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-04 21:18 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa @ 2021-02-04 23:42 ` Song Liu 0 siblings, 0 replies; 27+ messages in thread From: Song Liu @ 2021-02-04 23:42 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, netdev, bpf, Martin Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild > On Feb 4, 2021, at 1:18 PM, Jiri Olsa <jolsa@kernel.org> wrote: > > The resolve_btfids tool is used during the kernel build, > so we should clean it on kernel's make clean. > > Invoking the the resolve_btfids clean as part of root > 'make clean'. > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> > --- > Makefile | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index b0e4767735dc..159d9592b587 100644 > --- a/Makefile > +++ b/Makefile > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > endif > endif > > +PHONY += resolve_btfids_clean > + > +resolve_btfids_clean: > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > + > ifdef CONFIG_BPF > ifdef CONFIG_DEBUG_INFO_BTF > ifeq ($(has_libelf),1) > @@ -1495,7 +1500,7 @@ vmlinuxclean: > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > -clean: archclean vmlinuxclean > +clean: archclean vmlinuxclean resolve_btfids_clean > > # mrproper - Delete all generated files, including .config > # > -- > 2.26.2 > ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCHv2 bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile @ 2021-02-05 12:40 Jiri Olsa 2021-02-05 12:40 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa 0 siblings, 1 reply; 27+ messages in thread From: Jiri Olsa @ 2021-02-05 12:40 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko Cc: netdev, bpf, Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild hi, resolve_btfids tool is used during the kernel build, so we should clean it on kernel's make clean. v2 changes: - add Song's acks on patches 1 and 4 (others changed) [Song] - add missing / [Andrii] - change srctree variable initialization [Andrii] - shifted ifdef for clean target [Andrii] thanks, jirka --- Jiri Olsa (4): tools/resolve_btfids: Build libbpf and libsubcmd in separate directories tools/resolve_btfids: Check objects before removing tools/resolve_btfids: Set srctree variable unconditionally kbuild: Add resolve_btfids clean to root clean target Makefile | 7 ++++++- tools/bpf/resolve_btfids/.gitignore | 2 -- tools/bpf/resolve_btfids/Makefile | 44 ++++++++++++++++++++++---------------------- 3 files changed, 28 insertions(+), 25 deletions(-) ^ permalink raw reply [flat|nested] 27+ messages in thread
* [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-05 12:40 [PATCHv2 bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile Jiri Olsa @ 2021-02-05 12:40 ` Jiri Olsa 2021-02-06 5:11 ` Amy Parker 2021-02-10 17:44 ` Nathan Chancellor 0 siblings, 2 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-05 12:40 UTC (permalink / raw) To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko Cc: Song Liu, netdev, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild The resolve_btfids tool is used during the kernel build, so we should clean it on kernel's make clean. Invoking the the resolve_btfids clean as part of root 'make clean'. Acked-by: Song Liu <songliubraving@fb.com> Signed-off-by: Jiri Olsa <jolsa@kernel.org> --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b0e4767735dc..159d9592b587 100644 --- a/Makefile +++ b/Makefile @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION endif endif +PHONY += resolve_btfids_clean + +resolve_btfids_clean: + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean + ifdef CONFIG_BPF ifdef CONFIG_DEBUG_INFO_BTF ifeq ($(has_libelf),1) @@ -1495,7 +1500,7 @@ vmlinuxclean: $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) -clean: archclean vmlinuxclean +clean: archclean vmlinuxclean resolve_btfids_clean # mrproper - Delete all generated files, including .config # -- 2.26.2 ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-05 12:40 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa @ 2021-02-06 5:11 ` Amy Parker 2021-02-10 17:44 ` Nathan Chancellor 1 sibling, 0 replies; 27+ messages in thread From: Amy Parker @ 2021-02-06 5:11 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, netdev, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild On Fri, Feb 5, 2021 at 4:46 AM Jiri Olsa <jolsa@kernel.org> wrote: > > The resolve_btfids tool is used during the kernel build, > so we should clean it on kernel's make clean. > > Invoking the the resolve_btfids clean as part of root > 'make clean'. > > Acked-by: Song Liu <songliubraving@fb.com> > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- > Makefile | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index b0e4767735dc..159d9592b587 100644 > --- a/Makefile > +++ b/Makefile > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > endif > endif > > +PHONY += resolve_btfids_clean > + > +resolve_btfids_clean: > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > + > ifdef CONFIG_BPF > ifdef CONFIG_DEBUG_INFO_BTF > ifeq ($(has_libelf),1) > @@ -1495,7 +1500,7 @@ vmlinuxclean: > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > -clean: archclean vmlinuxclean > +clean: archclean vmlinuxclean resolve_btfids_clean > > # mrproper - Delete all generated files, including .config > # > -- > 2.26.2 > It compiles, looks good to me. Reviewed by: Amy Parker <enbyamy@gmail.com> Have a great day, and thank you for this patch! -Amy IP ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-05 12:40 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa 2021-02-06 5:11 ` Amy Parker @ 2021-02-10 17:44 ` Nathan Chancellor 2021-02-10 17:52 ` Andrii Nakryiko 1 sibling, 1 reply; 27+ messages in thread From: Nathan Chancellor @ 2021-02-10 17:44 UTC (permalink / raw) To: Jiri Olsa Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, netdev, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, linux-kbuild On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > The resolve_btfids tool is used during the kernel build, > so we should clean it on kernel's make clean. > > Invoking the the resolve_btfids clean as part of root > 'make clean'. > > Acked-by: Song Liu <songliubraving@fb.com> > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > --- > Makefile | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/Makefile b/Makefile > index b0e4767735dc..159d9592b587 100644 > --- a/Makefile > +++ b/Makefile > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > endif > endif > > +PHONY += resolve_btfids_clean > + > +resolve_btfids_clean: > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > + > ifdef CONFIG_BPF > ifdef CONFIG_DEBUG_INFO_BTF > ifeq ($(has_libelf),1) > @@ -1495,7 +1500,7 @@ vmlinuxclean: > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > -clean: archclean vmlinuxclean > +clean: archclean vmlinuxclean resolve_btfids_clean > > # mrproper - Delete all generated files, including .config > # > -- > 2.26.2 > This breaks running distclean on a clean tree (my script just unconditionally runs distclean regardless of the tree state): $ make -s O=build distclean ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. Cheers, Nathan ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 17:44 ` Nathan Chancellor @ 2021-02-10 17:52 ` Andrii Nakryiko 2021-02-10 18:02 ` Nathan Chancellor 2021-02-10 18:14 ` Jiri Olsa 0 siblings, 2 replies; 27+ messages in thread From: Andrii Nakryiko @ 2021-02-10 17:52 UTC (permalink / raw) To: Nathan Chancellor Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 9:47 AM Nathan Chancellor <nathan@kernel.org> wrote: > > On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > > The resolve_btfids tool is used during the kernel build, > > so we should clean it on kernel's make clean. > > > > Invoking the the resolve_btfids clean as part of root > > 'make clean'. > > > > Acked-by: Song Liu <songliubraving@fb.com> > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > --- > > Makefile | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/Makefile b/Makefile > > index b0e4767735dc..159d9592b587 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > > endif > > endif > > > > +PHONY += resolve_btfids_clean > > + > > +resolve_btfids_clean: > > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > + > > ifdef CONFIG_BPF > > ifdef CONFIG_DEBUG_INFO_BTF > > ifeq ($(has_libelf),1) > > @@ -1495,7 +1500,7 @@ vmlinuxclean: > > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > > > -clean: archclean vmlinuxclean > > +clean: archclean vmlinuxclean resolve_btfids_clean > > > > # mrproper - Delete all generated files, including .config > > # > > -- > > 2.26.2 > > > > This breaks running distclean on a clean tree (my script just > unconditionally runs distclean regardless of the tree state): > > $ make -s O=build distclean > ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. > Can't reproduce it. It works in all kinds of variants (relative and absolute O=, clean and not clean trees, etc). Jiri, please check as well. > Cheers, > Nathan ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 17:52 ` Andrii Nakryiko @ 2021-02-10 18:02 ` Nathan Chancellor 2021-02-10 18:29 ` Jiri Olsa 2021-02-10 19:23 ` Andrii Nakryiko 2021-02-10 18:14 ` Jiri Olsa 1 sibling, 2 replies; 27+ messages in thread From: Nathan Chancellor @ 2021-02-10 18:02 UTC (permalink / raw) To: Andrii Nakryiko Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 09:52:42AM -0800, Andrii Nakryiko wrote: > On Wed, Feb 10, 2021 at 9:47 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > > > The resolve_btfids tool is used during the kernel build, > > > so we should clean it on kernel's make clean. > > > > > > Invoking the the resolve_btfids clean as part of root > > > 'make clean'. > > > > > > Acked-by: Song Liu <songliubraving@fb.com> > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > > --- > > > Makefile | 7 ++++++- > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/Makefile b/Makefile > > > index b0e4767735dc..159d9592b587 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > > > endif > > > endif > > > > > > +PHONY += resolve_btfids_clean > > > + > > > +resolve_btfids_clean: > > > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > > + > > > ifdef CONFIG_BPF > > > ifdef CONFIG_DEBUG_INFO_BTF > > > ifeq ($(has_libelf),1) > > > @@ -1495,7 +1500,7 @@ vmlinuxclean: > > > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > > > > > -clean: archclean vmlinuxclean > > > +clean: archclean vmlinuxclean resolve_btfids_clean > > > > > > # mrproper - Delete all generated files, including .config > > > # > > > -- > > > 2.26.2 > > > > > > > This breaks running distclean on a clean tree (my script just > > unconditionally runs distclean regardless of the tree state): > > > > $ make -s O=build distclean > > ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > Can't reproduce it. It works in all kinds of variants (relative and > absolute O=, clean and not clean trees, etc). Jiri, please check as > well. > Odd, this reproduces for me on a completely clean checkout of bpf-next: $ git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ $ cd bpf-next $ make -s O=build distclean ../../scripts/Makefile.include:4: *** O=/tmp/bpf-next/build/tools/bpf/resolve_btfids does not exist. Stop. I do not really see how this could be environment related. It seems like this comes from tools/scripts/Makefile.include, where there is no guarantee that $(O) is created before being used like in the main Makefile? Cheers, Nathan ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 18:02 ` Nathan Chancellor @ 2021-02-10 18:29 ` Jiri Olsa 2021-02-10 18:37 ` Nathan Chancellor 2021-02-10 19:26 ` Andrii Nakryiko 2021-02-10 19:23 ` Andrii Nakryiko 1 sibling, 2 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-10 18:29 UTC (permalink / raw) To: Nathan Chancellor Cc: Andrii Nakryiko, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 11:02:15AM -0700, Nathan Chancellor wrote: > On Wed, Feb 10, 2021 at 09:52:42AM -0800, Andrii Nakryiko wrote: > > On Wed, Feb 10, 2021 at 9:47 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > > > On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > > > > The resolve_btfids tool is used during the kernel build, > > > > so we should clean it on kernel's make clean. > > > > > > > > Invoking the the resolve_btfids clean as part of root > > > > 'make clean'. > > > > > > > > Acked-by: Song Liu <songliubraving@fb.com> > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > > > --- > > > > Makefile | 7 ++++++- > > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/Makefile b/Makefile > > > > index b0e4767735dc..159d9592b587 100644 > > > > --- a/Makefile > > > > +++ b/Makefile > > > > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > > > > endif > > > > endif > > > > > > > > +PHONY += resolve_btfids_clean > > > > + > > > > +resolve_btfids_clean: > > > > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > > > + > > > > ifdef CONFIG_BPF > > > > ifdef CONFIG_DEBUG_INFO_BTF > > > > ifeq ($(has_libelf),1) > > > > @@ -1495,7 +1500,7 @@ vmlinuxclean: > > > > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > > > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > > > > > > > -clean: archclean vmlinuxclean > > > > +clean: archclean vmlinuxclean resolve_btfids_clean > > > > > > > > # mrproper - Delete all generated files, including .config > > > > # > > > > -- > > > > 2.26.2 > > > > > > > > > > This breaks running distclean on a clean tree (my script just > > > unconditionally runs distclean regardless of the tree state): > > > > > > $ make -s O=build distclean > > > ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > > > > Can't reproduce it. It works in all kinds of variants (relative and > > absolute O=, clean and not clean trees, etc). Jiri, please check as > > well. > > > > Odd, this reproduces for me on a completely clean checkout of bpf-next: > > $ git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ > > $ cd bpf-next > > $ make -s O=build distclean > ../../scripts/Makefile.include:4: *** O=/tmp/bpf-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > I do not really see how this could be environment related. It seems like > this comes from tools/scripts/Makefile.include, where there is no > guarantee that $(O) is created before being used like in the main > Makefile? right, we need to handle the case where tools/bpf/resolve_btfids does not exist, patch below fixes it for me jirka --- diff --git a/Makefile b/Makefile index 159d9592b587..ce9685961abe 100644 --- a/Makefile +++ b/Makefile @@ -1088,8 +1088,14 @@ endif PHONY += resolve_btfids_clean +resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids + +# tools/bpf/resolve_btfids directory might not exist +# in output directory, skip its clean in that case resolve_btfids_clean: - $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean +ifneq (,$(wildcard $(resolve_btfids_O))) + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean +endif ifdef CONFIG_BPF ifdef CONFIG_DEBUG_INFO_BTF ^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 18:29 ` Jiri Olsa @ 2021-02-10 18:37 ` Nathan Chancellor 2021-02-10 19:26 ` Andrii Nakryiko 1 sibling, 0 replies; 27+ messages in thread From: Nathan Chancellor @ 2021-02-10 18:37 UTC (permalink / raw) To: Jiri Olsa Cc: Andrii Nakryiko, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 07:29:31PM +0100, Jiri Olsa wrote: > On Wed, Feb 10, 2021 at 11:02:15AM -0700, Nathan Chancellor wrote: > > On Wed, Feb 10, 2021 at 09:52:42AM -0800, Andrii Nakryiko wrote: > > > On Wed, Feb 10, 2021 at 9:47 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > > > > > On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > > > > > The resolve_btfids tool is used during the kernel build, > > > > > so we should clean it on kernel's make clean. > > > > > > > > > > Invoking the the resolve_btfids clean as part of root > > > > > 'make clean'. > > > > > > > > > > Acked-by: Song Liu <songliubraving@fb.com> > > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > > > > --- > > > > > Makefile | 7 ++++++- > > > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/Makefile b/Makefile > > > > > index b0e4767735dc..159d9592b587 100644 > > > > > --- a/Makefile > > > > > +++ b/Makefile > > > > > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > > > > > endif > > > > > endif > > > > > > > > > > +PHONY += resolve_btfids_clean > > > > > + > > > > > +resolve_btfids_clean: > > > > > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > > > > + > > > > > ifdef CONFIG_BPF > > > > > ifdef CONFIG_DEBUG_INFO_BTF > > > > > ifeq ($(has_libelf),1) > > > > > @@ -1495,7 +1500,7 @@ vmlinuxclean: > > > > > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > > > > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > > > > > > > > > -clean: archclean vmlinuxclean > > > > > +clean: archclean vmlinuxclean resolve_btfids_clean > > > > > > > > > > # mrproper - Delete all generated files, including .config > > > > > # > > > > > -- > > > > > 2.26.2 > > > > > > > > > > > > > This breaks running distclean on a clean tree (my script just > > > > unconditionally runs distclean regardless of the tree state): > > > > > > > > $ make -s O=build distclean > > > > ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > > > > > > > Can't reproduce it. It works in all kinds of variants (relative and > > > absolute O=, clean and not clean trees, etc). Jiri, please check as > > > well. > > > > > > > Odd, this reproduces for me on a completely clean checkout of bpf-next: > > > > $ git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ > > > > $ cd bpf-next > > > > $ make -s O=build distclean > > ../../scripts/Makefile.include:4: *** O=/tmp/bpf-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > I do not really see how this could be environment related. It seems like > > this comes from tools/scripts/Makefile.include, where there is no > > guarantee that $(O) is created before being used like in the main > > Makefile? > > right, we need to handle the case where tools/bpf/resolve_btfids > does not exist, patch below fixes it for me > > jirka Yes, this seems to work fine for me as well. Tested-by: Nathan Chancellor <nathan@kernel.org> > --- > diff --git a/Makefile b/Makefile > index 159d9592b587..ce9685961abe 100644 > --- a/Makefile > +++ b/Makefile > @@ -1088,8 +1088,14 @@ endif > > PHONY += resolve_btfids_clean > > +resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids > + > +# tools/bpf/resolve_btfids directory might not exist > +# in output directory, skip its clean in that case > resolve_btfids_clean: > - $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > +ifneq (,$(wildcard $(resolve_btfids_O))) > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean > +endif > > ifdef CONFIG_BPF > ifdef CONFIG_DEBUG_INFO_BTF > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 18:29 ` Jiri Olsa 2021-02-10 18:37 ` Nathan Chancellor @ 2021-02-10 19:26 ` Andrii Nakryiko 2021-02-11 12:17 ` Jiri Olsa 1 sibling, 1 reply; 27+ messages in thread From: Andrii Nakryiko @ 2021-02-10 19:26 UTC (permalink / raw) To: Jiri Olsa Cc: Nathan Chancellor, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 10:29 AM Jiri Olsa <jolsa@redhat.com> wrote: > > On Wed, Feb 10, 2021 at 11:02:15AM -0700, Nathan Chancellor wrote: > > On Wed, Feb 10, 2021 at 09:52:42AM -0800, Andrii Nakryiko wrote: > > > On Wed, Feb 10, 2021 at 9:47 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > > > > > On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > > > > > The resolve_btfids tool is used during the kernel build, > > > > > so we should clean it on kernel's make clean. > > > > > > > > > > Invoking the the resolve_btfids clean as part of root > > > > > 'make clean'. > > > > > > > > > > Acked-by: Song Liu <songliubraving@fb.com> > > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > > > > --- > > > > > Makefile | 7 ++++++- > > > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/Makefile b/Makefile > > > > > index b0e4767735dc..159d9592b587 100644 > > > > > --- a/Makefile > > > > > +++ b/Makefile > > > > > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > > > > > endif > > > > > endif > > > > > > > > > > +PHONY += resolve_btfids_clean > > > > > + > > > > > +resolve_btfids_clean: > > > > > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > > > > + > > > > > ifdef CONFIG_BPF > > > > > ifdef CONFIG_DEBUG_INFO_BTF > > > > > ifeq ($(has_libelf),1) > > > > > @@ -1495,7 +1500,7 @@ vmlinuxclean: > > > > > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > > > > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > > > > > > > > > -clean: archclean vmlinuxclean > > > > > +clean: archclean vmlinuxclean resolve_btfids_clean > > > > > > > > > > # mrproper - Delete all generated files, including .config > > > > > # > > > > > -- > > > > > 2.26.2 > > > > > > > > > > > > > This breaks running distclean on a clean tree (my script just > > > > unconditionally runs distclean regardless of the tree state): > > > > > > > > $ make -s O=build distclean > > > > ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > > > > > > > Can't reproduce it. It works in all kinds of variants (relative and > > > absolute O=, clean and not clean trees, etc). Jiri, please check as > > > well. > > > > > > > Odd, this reproduces for me on a completely clean checkout of bpf-next: > > > > $ git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ > > > > $ cd bpf-next > > > > $ make -s O=build distclean > > ../../scripts/Makefile.include:4: *** O=/tmp/bpf-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > I do not really see how this could be environment related. It seems like > > this comes from tools/scripts/Makefile.include, where there is no > > guarantee that $(O) is created before being used like in the main > > Makefile? > > right, we need to handle the case where tools/bpf/resolve_btfids > does not exist, patch below fixes it for me > > jirka > Looks good to me, please send it as a proper patch to bpf-next. But I'm curious, why is objtool not doing something like that? Is it not doing clean at all? Or does it do it in some different way? > > --- > diff --git a/Makefile b/Makefile > index 159d9592b587..ce9685961abe 100644 > --- a/Makefile > +++ b/Makefile > @@ -1088,8 +1088,14 @@ endif > > PHONY += resolve_btfids_clean > > +resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids > + > +# tools/bpf/resolve_btfids directory might not exist > +# in output directory, skip its clean in that case > resolve_btfids_clean: > - $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > +ifneq (,$(wildcard $(resolve_btfids_O))) nit: kind of backwards, usually it's in a `ifneq($var,)` form > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(resolve_btfids_O) clean > +endif > > ifdef CONFIG_BPF > ifdef CONFIG_DEBUG_INFO_BTF > ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 19:26 ` Andrii Nakryiko @ 2021-02-11 12:17 ` Jiri Olsa 2021-02-12 3:30 ` Masahiro Yamada 0 siblings, 1 reply; 27+ messages in thread From: Jiri Olsa @ 2021-02-11 12:17 UTC (permalink / raw) To: Andrii Nakryiko Cc: Nathan Chancellor, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 11:26:28AM -0800, Andrii Nakryiko wrote: SNIP > > > > Can't reproduce it. It works in all kinds of variants (relative and > > > > absolute O=, clean and not clean trees, etc). Jiri, please check as > > > > well. > > > > > > > > > > Odd, this reproduces for me on a completely clean checkout of bpf-next: > > > > > > $ git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ > > > > > > $ cd bpf-next > > > > > > $ make -s O=build distclean > > > ../../scripts/Makefile.include:4: *** O=/tmp/bpf-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > > > I do not really see how this could be environment related. It seems like > > > this comes from tools/scripts/Makefile.include, where there is no > > > guarantee that $(O) is created before being used like in the main > > > Makefile? > > > > right, we need to handle the case where tools/bpf/resolve_btfids > > does not exist, patch below fixes it for me > > > > jirka > > > > Looks good to me, please send it as a proper patch to bpf-next. > > But I'm curious, why is objtool not doing something like that? Is it > not doing clean at all? Or does it do it in some different way? yes, it's not connected to global make clean > > > > > --- > > diff --git a/Makefile b/Makefile > > index 159d9592b587..ce9685961abe 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -1088,8 +1088,14 @@ endif > > > > PHONY += resolve_btfids_clean > > > > +resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids > > + > > +# tools/bpf/resolve_btfids directory might not exist > > +# in output directory, skip its clean in that case > > resolve_btfids_clean: > > - $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > +ifneq (,$(wildcard $(resolve_btfids_O))) > > nit: kind of backwards, usually it's in a `ifneq($var,)` form ok thanks, jirka ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-11 12:17 ` Jiri Olsa @ 2021-02-12 3:30 ` Masahiro Yamada 2021-02-12 13:35 ` Jiri Olsa 0 siblings, 1 reply; 27+ messages in thread From: Masahiro Yamada @ 2021-02-12 3:30 UTC (permalink / raw) To: Jiri Olsa Cc: Andrii Nakryiko, Nathan Chancellor, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Michal Marek, Linux Kbuild mailing list On Thu, Feb 11, 2021 at 9:17 PM Jiri Olsa <jolsa@redhat.com> wrote: > > On Wed, Feb 10, 2021 at 11:26:28AM -0800, Andrii Nakryiko wrote: > > SNIP > > > > > > Can't reproduce it. It works in all kinds of variants (relative and > > > > > absolute O=, clean and not clean trees, etc). Jiri, please check as > > > > > well. > > > > > > > > > > > > > Odd, this reproduces for me on a completely clean checkout of bpf-next: > > > > > > > > $ git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ > > > > > > > > $ cd bpf-next > > > > > > > > $ make -s O=build distclean > > > > ../../scripts/Makefile.include:4: *** O=/tmp/bpf-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > > > > > I do not really see how this could be environment related. It seems like > > > > this comes from tools/scripts/Makefile.include, where there is no > > > > guarantee that $(O) is created before being used like in the main > > > > Makefile? > > > > > > right, we need to handle the case where tools/bpf/resolve_btfids > > > does not exist, patch below fixes it for me > > > > > > jirka > > > > > > > Looks good to me, please send it as a proper patch to bpf-next. > > > > But I'm curious, why is objtool not doing something like that? Is it > > not doing clean at all? Or does it do it in some different way? > > yes, it's not connected to global make clean > > > > > > > > > --- > > > diff --git a/Makefile b/Makefile > > > index 159d9592b587..ce9685961abe 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -1088,8 +1088,14 @@ endif > > > > > > PHONY += resolve_btfids_clean > > > > > > +resolve_btfids_O = $(abspath $(objtree))/tools/bpf/resolve_btfids > > > + > > > +# tools/bpf/resolve_btfids directory might not exist > > > +# in output directory, skip its clean in that case > > > resolve_btfids_clean: > > > - $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > > +ifneq (,$(wildcard $(resolve_btfids_O))) > > > > nit: kind of backwards, usually it's in a `ifneq($var,)` form > > ok > > thanks, > jirka > I expected this kind of mess when I saw 33a57ce0a54d498275f432db04850001175dfdfa The tools/ directory is a completely different world governed by a different build system (no, not a build system, but a collection of adhoc makefile code) All the other programs used during the kernel build are located under scripts/, and can be built with a simple syntax, and cleaned up correctly. It is simple, clean and robust. objtool is the first alien that opt out Kbuild, and this is the second one. It is scary to mix up two different things, which run in different working directories. See, this is wired up in the top Makefile in an ugly way, and you are struggling in suppressing issues, where you can never do it in the right way. -- Best Regards Masahiro Yamada ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-12 3:30 ` Masahiro Yamada @ 2021-02-12 13:35 ` Jiri Olsa 0 siblings, 0 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-12 13:35 UTC (permalink / raw) To: Masahiro Yamada Cc: Andrii Nakryiko, Nathan Chancellor, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Michal Marek, Linux Kbuild mailing list On Fri, Feb 12, 2021 at 12:30:45PM +0900, Masahiro Yamada wrote: SNIP > > I expected this kind of mess > when I saw 33a57ce0a54d498275f432db04850001175dfdfa > > > The tools/ directory is a completely different world > governed by a different build system > (no, not a build system, but a collection of adhoc makefile code) > > > All the other programs used during the kernel build > are located under scripts/, and can be built with > a simple syntax, and cleaned up correctly. > It is simple, clean and robust. > > objtool is the first alien that opt out Kbuild, > and this is the second one. > > > It is scary to mix up two different things, > which run in different working directories. would you see any way out? apart from changing resolve_btfids to use Kbuild.. there are some dependencies we'd need to change as well and they are used by other tools.. probably it'd end up with all or nothing scenario > > See, this is wired up in the top Makefile > in an ugly way, and you are struggling > in suppressing issues, where you can never > do it in the right way. maybe we could move it out of top makefile into separate one, that would handle all the related mess jirka ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 18:02 ` Nathan Chancellor 2021-02-10 18:29 ` Jiri Olsa @ 2021-02-10 19:23 ` Andrii Nakryiko 1 sibling, 0 replies; 27+ messages in thread From: Andrii Nakryiko @ 2021-02-10 19:23 UTC (permalink / raw) To: Nathan Chancellor Cc: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 10:02 AM Nathan Chancellor <nathan@kernel.org> wrote: > > On Wed, Feb 10, 2021 at 09:52:42AM -0800, Andrii Nakryiko wrote: > > On Wed, Feb 10, 2021 at 9:47 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > > > On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > > > > The resolve_btfids tool is used during the kernel build, > > > > so we should clean it on kernel's make clean. > > > > > > > > Invoking the the resolve_btfids clean as part of root > > > > 'make clean'. > > > > > > > > Acked-by: Song Liu <songliubraving@fb.com> > > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > > > --- > > > > Makefile | 7 ++++++- > > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/Makefile b/Makefile > > > > index b0e4767735dc..159d9592b587 100644 > > > > --- a/Makefile > > > > +++ b/Makefile > > > > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > > > > endif > > > > endif > > > > > > > > +PHONY += resolve_btfids_clean > > > > + > > > > +resolve_btfids_clean: > > > > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > > > + > > > > ifdef CONFIG_BPF > > > > ifdef CONFIG_DEBUG_INFO_BTF > > > > ifeq ($(has_libelf),1) > > > > @@ -1495,7 +1500,7 @@ vmlinuxclean: > > > > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > > > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > > > > > > > -clean: archclean vmlinuxclean > > > > +clean: archclean vmlinuxclean resolve_btfids_clean > > > > > > > > # mrproper - Delete all generated files, including .config > > > > # > > > > -- > > > > 2.26.2 > > > > > > > > > > This breaks running distclean on a clean tree (my script just > > > unconditionally runs distclean regardless of the tree state): > > > > > > $ make -s O=build distclean > > > ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > > > > Can't reproduce it. It works in all kinds of variants (relative and > > absolute O=, clean and not clean trees, etc). Jiri, please check as > > well. > > > > Odd, this reproduces for me on a completely clean checkout of bpf-next: my bad, I was trying it on a branch that didn't have Jiri's patches, sorry about that. > > $ git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/ > > $ cd bpf-next > > $ make -s O=build distclean > ../../scripts/Makefile.include:4: *** O=/tmp/bpf-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > I do not really see how this could be environment related. It seems like > this comes from tools/scripts/Makefile.include, where there is no > guarantee that $(O) is created before being used like in the main > Makefile? > > Cheers, > Nathan ^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target 2021-02-10 17:52 ` Andrii Nakryiko 2021-02-10 18:02 ` Nathan Chancellor @ 2021-02-10 18:14 ` Jiri Olsa 1 sibling, 0 replies; 27+ messages in thread From: Jiri Olsa @ 2021-02-10 18:14 UTC (permalink / raw) To: Andrii Nakryiko Cc: Nathan Chancellor, Jiri Olsa, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, Song Liu, Networking, bpf, Martin KaFai Lau, Yonghong Song, John Fastabend, KP Singh, Masahiro Yamada, Michal Marek, Linux Kbuild mailing list On Wed, Feb 10, 2021 at 09:52:42AM -0800, Andrii Nakryiko wrote: > On Wed, Feb 10, 2021 at 9:47 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > On Fri, Feb 05, 2021 at 01:40:20PM +0100, Jiri Olsa wrote: > > > The resolve_btfids tool is used during the kernel build, > > > so we should clean it on kernel's make clean. > > > > > > Invoking the the resolve_btfids clean as part of root > > > 'make clean'. > > > > > > Acked-by: Song Liu <songliubraving@fb.com> > > > Signed-off-by: Jiri Olsa <jolsa@kernel.org> > > > --- > > > Makefile | 7 ++++++- > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/Makefile b/Makefile > > > index b0e4767735dc..159d9592b587 100644 > > > --- a/Makefile > > > +++ b/Makefile > > > @@ -1086,6 +1086,11 @@ ifdef CONFIG_STACK_VALIDATION > > > endif > > > endif > > > > > > +PHONY += resolve_btfids_clean > > > + > > > +resolve_btfids_clean: > > > + $(Q)$(MAKE) -sC $(srctree)/tools/bpf/resolve_btfids O=$(abspath $(objtree))/tools/bpf/resolve_btfids clean > > > + > > > ifdef CONFIG_BPF > > > ifdef CONFIG_DEBUG_INFO_BTF > > > ifeq ($(has_libelf),1) > > > @@ -1495,7 +1500,7 @@ vmlinuxclean: > > > $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean > > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean) > > > > > > -clean: archclean vmlinuxclean > > > +clean: archclean vmlinuxclean resolve_btfids_clean > > > > > > # mrproper - Delete all generated files, including .config > > > # > > > -- > > > 2.26.2 > > > > > > > This breaks running distclean on a clean tree (my script just > > unconditionally runs distclean regardless of the tree state): > > > > $ make -s O=build distclean > > ../../scripts/Makefile.include:4: *** O=/home/nathan/cbl/src/linux-next/build/tools/bpf/resolve_btfids does not exist. Stop. > > > > Can't reproduce it. It works in all kinds of variants (relative and > absolute O=, clean and not clean trees, etc). Jiri, please check as > well. I can reproduce if I set O=XXX to directory that does not contain kernel build $ mkdir /tmp/krava $ make O=/tmp/krava distclean make[1]: Entering directory '/tmp/krava' ../../scripts/Makefile.include:4: *** O=/tmp/krava/tools/bpf/resolve_btfids does not exist. Stop. make[1]: *** [/home/jolsa/linux/Makefile:1092: resolve_btfids_clean] Error 2 make[1]: Leaving directory '/tmp/krava' make: *** [Makefile:185: __sub-make] Error 2 will check on fix jirka ^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2021-02-12 13:37 UTC | newest] Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20210129134855.195810-1-jolsa@redhat.com> 2021-02-04 21:18 ` [PATCH bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 1/4] tools/resolve_btfids: Build libbpf and libsubcmd in separate directories Jiri Olsa 2021-02-04 23:33 ` Song Liu 2021-02-05 0:39 ` Andrii Nakryiko 2021-02-05 10:35 ` Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 2/4] tools/resolve_btfids: Check objects before removing Jiri Olsa 2021-02-04 23:41 ` Song Liu 2021-02-05 0:42 ` Andrii Nakryiko 2021-02-05 10:40 ` Jiri Olsa 2021-02-04 21:18 ` [PATCH bpf-next 3/4] tools/resolve_btfids: Set srctree variable unconditionally Jiri Olsa 2021-02-04 23:41 ` Song Liu 2021-02-05 1:24 ` Andrii Nakryiko 2021-02-04 21:18 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa 2021-02-04 23:42 ` Song Liu 2021-02-05 12:40 [PATCHv2 bpf-next 0/4] kbuild/resolve_btfids: Invoke resolve_btfids clean in root Makefile Jiri Olsa 2021-02-05 12:40 ` [PATCH bpf-next 4/4] kbuild: Add resolve_btfids clean to root clean target Jiri Olsa 2021-02-06 5:11 ` Amy Parker 2021-02-10 17:44 ` Nathan Chancellor 2021-02-10 17:52 ` Andrii Nakryiko 2021-02-10 18:02 ` Nathan Chancellor 2021-02-10 18:29 ` Jiri Olsa 2021-02-10 18:37 ` Nathan Chancellor 2021-02-10 19:26 ` Andrii Nakryiko 2021-02-11 12:17 ` Jiri Olsa 2021-02-12 3:30 ` Masahiro Yamada 2021-02-12 13:35 ` Jiri Olsa 2021-02-10 19:23 ` Andrii Nakryiko 2021-02-10 18:14 ` Jiri Olsa
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).