All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] tools/bpf: build: make sure resolve_btfids cleans up after itself
@ 2020-09-01 14:43 Toke Høiland-Jørgensen
  2020-09-01 15:20 ` Jiri Olsa
  0 siblings, 1 reply; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2020-09-01 14:43 UTC (permalink / raw)
  To: daniel, ast; +Cc: Toke Høiland-Jørgensen, bpf, netdev, jolsa

The new resolve_btfids tool did not clean up the feature detection folder
on 'make clean', and also was not called properly from the clean rule in
tools/make/ folder on its 'make clean'. This lead to stale objects being
left around, which could cause feature detection to fail on subsequent
builds.

Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 tools/bpf/Makefile                | 4 ++--
 tools/bpf/resolve_btfids/Makefile | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
index 0a6d09a3e91f..39bb322707b4 100644
--- a/tools/bpf/Makefile
+++ b/tools/bpf/Makefile
@@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args
 FEATURE_DISPLAY = libbfd disassembler-four-args
 
 check_feat := 1
-NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean
+NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
 ifdef MAKECMDGOALS
 ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
   check_feat := 0
@@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
 $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
 $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
 
-clean: bpftool_clean runqslower_clean
+clean: bpftool_clean runqslower_clean resolve_btfids_clean
 	$(call QUIET_CLEAN, bpf-progs)
 	$(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
 	       $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
index a88cd4426398..fe8eb537688b 100644
--- a/tools/bpf/resolve_btfids/Makefile
+++ b/tools/bpf/resolve_btfids/Makefile
@@ -80,6 +80,7 @@ libbpf-clean:
 clean: libsubcmd-clean libbpf-clean fixdep-clean
 	$(call msg,CLEAN,$(BINARY))
 	$(Q)$(RM) -f $(BINARY); \
+	$(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
 	find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
 
 tags:
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf] tools/bpf: build: make sure resolve_btfids cleans up after itself
  2020-09-01 14:43 [PATCH bpf] tools/bpf: build: make sure resolve_btfids cleans up after itself Toke Høiland-Jørgensen
@ 2020-09-01 15:20 ` Jiri Olsa
  2020-09-01 16:08   ` Toke Høiland-Jørgensen
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2020-09-01 15:20 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: daniel, ast, bpf, netdev, jolsa

On Tue, Sep 01, 2020 at 04:43:43PM +0200, Toke Høiland-Jørgensen wrote:
> The new resolve_btfids tool did not clean up the feature detection folder
> on 'make clean', and also was not called properly from the clean rule in
> tools/make/ folder on its 'make clean'. This lead to stale objects being
> left around, which could cause feature detection to fail on subsequent
> builds.
> 
> Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  tools/bpf/Makefile                | 4 ++--
>  tools/bpf/resolve_btfids/Makefile | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
> index 0a6d09a3e91f..39bb322707b4 100644
> --- a/tools/bpf/Makefile
> +++ b/tools/bpf/Makefile
> @@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args
>  FEATURE_DISPLAY = libbfd disassembler-four-args
>  
>  check_feat := 1
> -NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean
> +NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
>  ifdef MAKECMDGOALS
>  ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
>    check_feat := 0
> @@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
>  $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
>  $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
>  
> -clean: bpftool_clean runqslower_clean
> +clean: bpftool_clean runqslower_clean resolve_btfids_clean
>  	$(call QUIET_CLEAN, bpf-progs)
>  	$(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
>  	       $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> index a88cd4426398..fe8eb537688b 100644
> --- a/tools/bpf/resolve_btfids/Makefile
> +++ b/tools/bpf/resolve_btfids/Makefile
> @@ -80,6 +80,7 @@ libbpf-clean:
>  clean: libsubcmd-clean libbpf-clean fixdep-clean
>  	$(call msg,CLEAN,$(BINARY))
>  	$(Q)$(RM) -f $(BINARY); \
> +	$(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \

I forgot this one.. thanks for fixing this

Acked-by: Jiri Olsa <jolsa@redhat.com>

jirka


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf] tools/bpf: build: make sure resolve_btfids cleans up after itself
  2020-09-01 15:20 ` Jiri Olsa
@ 2020-09-01 16:08   ` Toke Høiland-Jørgensen
  2020-09-01 16:13     ` Daniel Borkmann
  2020-09-01 19:28     ` Jiri Olsa
  0 siblings, 2 replies; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2020-09-01 16:08 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: daniel, ast, bpf, netdev, jolsa

Jiri Olsa <jolsa@redhat.com> writes:

> On Tue, Sep 01, 2020 at 04:43:43PM +0200, Toke Høiland-Jørgensen wrote:
>> The new resolve_btfids tool did not clean up the feature detection folder
>> on 'make clean', and also was not called properly from the clean rule in
>> tools/make/ folder on its 'make clean'. This lead to stale objects being
>> left around, which could cause feature detection to fail on subsequent
>> builds.
>> 
>> Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  tools/bpf/Makefile                | 4 ++--
>>  tools/bpf/resolve_btfids/Makefile | 1 +
>>  2 files changed, 3 insertions(+), 2 deletions(-)
>> 
>> diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
>> index 0a6d09a3e91f..39bb322707b4 100644
>> --- a/tools/bpf/Makefile
>> +++ b/tools/bpf/Makefile
>> @@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args
>>  FEATURE_DISPLAY = libbfd disassembler-four-args
>>  
>>  check_feat := 1
>> -NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean
>> +NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
>>  ifdef MAKECMDGOALS
>>  ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
>>    check_feat := 0
>> @@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
>>  $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
>>  $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
>>  
>> -clean: bpftool_clean runqslower_clean
>> +clean: bpftool_clean runqslower_clean resolve_btfids_clean
>>  	$(call QUIET_CLEAN, bpf-progs)
>>  	$(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
>>  	       $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
>> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
>> index a88cd4426398..fe8eb537688b 100644
>> --- a/tools/bpf/resolve_btfids/Makefile
>> +++ b/tools/bpf/resolve_btfids/Makefile
>> @@ -80,6 +80,7 @@ libbpf-clean:
>>  clean: libsubcmd-clean libbpf-clean fixdep-clean
>>  	$(call msg,CLEAN,$(BINARY))
>>  	$(Q)$(RM) -f $(BINARY); \
>> +	$(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
>
> I forgot this one.. thanks for fixing this

You're welcome - it was a bit frustrating to track down, but a simple
fix once I figured out what was going on.

BTW, there's still an issue that a 'make clean' in the toplevel kernel
dir will not clean up this feature dir, so if someone doesn't know to do
'cd tools/bpf && make clean' the main build may still break (I happened
upon this because my main kernel build broke :/). Couldn't figure out
how to convince make to fix that, so if you could take a look that would
be great! :)

-Toke


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf] tools/bpf: build: make sure resolve_btfids cleans up after itself
  2020-09-01 16:08   ` Toke Høiland-Jørgensen
@ 2020-09-01 16:13     ` Daniel Borkmann
  2020-09-01 19:28     ` Jiri Olsa
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2020-09-01 16:13 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, Jiri Olsa; +Cc: ast, bpf, netdev, jolsa

On 9/1/20 6:08 PM, Toke Høiland-Jørgensen wrote:
> Jiri Olsa <jolsa@redhat.com> writes:
> 
>> On Tue, Sep 01, 2020 at 04:43:43PM +0200, Toke Høiland-Jørgensen wrote:
>>> The new resolve_btfids tool did not clean up the feature detection folder
>>> on 'make clean', and also was not called properly from the clean rule in
>>> tools/make/ folder on its 'make clean'. This lead to stale objects being
>>> left around, which could cause feature detection to fail on subsequent
>>> builds.
>>>
>>> Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
>>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>

Applied, thanks guys!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf] tools/bpf: build: make sure resolve_btfids cleans up after itself
  2020-09-01 16:08   ` Toke Høiland-Jørgensen
  2020-09-01 16:13     ` Daniel Borkmann
@ 2020-09-01 19:28     ` Jiri Olsa
  1 sibling, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2020-09-01 19:28 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen; +Cc: daniel, ast, bpf, netdev, jolsa

On Tue, Sep 01, 2020 at 06:08:04PM +0200, Toke Høiland-Jørgensen wrote:
> Jiri Olsa <jolsa@redhat.com> writes:
> 
> > On Tue, Sep 01, 2020 at 04:43:43PM +0200, Toke Høiland-Jørgensen wrote:
> >> The new resolve_btfids tool did not clean up the feature detection folder
> >> on 'make clean', and also was not called properly from the clean rule in
> >> tools/make/ folder on its 'make clean'. This lead to stale objects being
> >> left around, which could cause feature detection to fail on subsequent
> >> builds.
> >> 
> >> Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
> >> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> >> ---
> >>  tools/bpf/Makefile                | 4 ++--
> >>  tools/bpf/resolve_btfids/Makefile | 1 +
> >>  2 files changed, 3 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
> >> index 0a6d09a3e91f..39bb322707b4 100644
> >> --- a/tools/bpf/Makefile
> >> +++ b/tools/bpf/Makefile
> >> @@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args
> >>  FEATURE_DISPLAY = libbfd disassembler-four-args
> >>  
> >>  check_feat := 1
> >> -NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean
> >> +NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
> >>  ifdef MAKECMDGOALS
> >>  ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
> >>    check_feat := 0
> >> @@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
> >>  $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
> >>  $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
> >>  
> >> -clean: bpftool_clean runqslower_clean
> >> +clean: bpftool_clean runqslower_clean resolve_btfids_clean
> >>  	$(call QUIET_CLEAN, bpf-progs)
> >>  	$(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
> >>  	       $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
> >> diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile
> >> index a88cd4426398..fe8eb537688b 100644
> >> --- a/tools/bpf/resolve_btfids/Makefile
> >> +++ b/tools/bpf/resolve_btfids/Makefile
> >> @@ -80,6 +80,7 @@ libbpf-clean:
> >>  clean: libsubcmd-clean libbpf-clean fixdep-clean
> >>  	$(call msg,CLEAN,$(BINARY))
> >>  	$(Q)$(RM) -f $(BINARY); \
> >> +	$(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
> >
> > I forgot this one.. thanks for fixing this
> 
> You're welcome - it was a bit frustrating to track down, but a simple
> fix once I figured out what was going on.
> 
> BTW, there's still an issue that a 'make clean' in the toplevel kernel
> dir will not clean up this feature dir, so if someone doesn't know to do
> 'cd tools/bpf && make clean' the main build may still break (I happened
> upon this because my main kernel build broke :/). Couldn't figure out
> how to convince make to fix that, so if you could take a look that would
> be great! :)

will check, thanks

jirka


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-09-01 19:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-01 14:43 [PATCH bpf] tools/bpf: build: make sure resolve_btfids cleans up after itself Toke Høiland-Jørgensen
2020-09-01 15:20 ` Jiri Olsa
2020-09-01 16:08   ` Toke Høiland-Jørgensen
2020-09-01 16:13     ` Daniel Borkmann
2020-09-01 19:28     ` Jiri Olsa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.