netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] selftests/bpf: prevent runqslower from racing on building bpftool
@ 2020-08-05  0:47 Andrii Nakryiko
  2020-08-06  6:27 ` John Fastabend
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2020-08-05  0:47 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

runqslower's Makefile is building/installing bpftool into
$(OUTPUT)/sbin/bpftool, which coincides with $(DEFAULT_BPFTOOL). In practice
this means that often when building selftests from scratch (after `make
clean`), selftests are racing with runqslower to simultaneously build bpftool
and one of the two processes fail due to file being busy. Prevent this race by
explicitly order-depending on $(BPFTOOL_DEFAULT).

Fixes: a2c9652f751e ("selftests: Refactor build to remove tools/lib/bpf from include path")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/testing/selftests/bpf/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index e7a8cf83ba48..48425f9251b5 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -142,7 +142,9 @@ VMLINUX_BTF_PATHS ?= $(if $(O),$(O)/vmlinux)				\
 		     /boot/vmlinux-$(shell uname -r)
 VMLINUX_BTF ?= $(abspath $(firstword $(wildcard $(VMLINUX_BTF_PATHS))))
 
-$(OUTPUT)/runqslower: $(BPFOBJ)
+DEFAULT_BPFTOOL := $(SCRATCH_DIR)/sbin/bpftool
+
+$(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL)
 	$(Q)$(MAKE) $(submake_extras) -C $(TOOLSDIR)/bpf/runqslower	\
 		    OUTPUT=$(SCRATCH_DIR)/ VMLINUX_BTF=$(VMLINUX_BTF)   \
 		    BPFOBJ=$(BPFOBJ) BPF_INCLUDE=$(INCLUDE_DIR) &&	\
@@ -164,7 +166,6 @@ $(OUTPUT)/test_netcnt: cgroup_helpers.c
 $(OUTPUT)/test_sock_fields: cgroup_helpers.c
 $(OUTPUT)/test_sysctl: cgroup_helpers.c
 
-DEFAULT_BPFTOOL := $(SCRATCH_DIR)/sbin/bpftool
 BPFTOOL ?= $(DEFAULT_BPFTOOL)
 $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
 		    $(BPFOBJ) | $(BUILD_DIR)/bpftool
-- 
2.24.1


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

* RE: [PATCH bpf] selftests/bpf: prevent runqslower from racing on building bpftool
  2020-08-05  0:47 [PATCH bpf] selftests/bpf: prevent runqslower from racing on building bpftool Andrii Nakryiko
@ 2020-08-06  6:27 ` John Fastabend
  2020-08-06 23:38   ` Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: John Fastabend @ 2020-08-06  6:27 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, netdev, ast, daniel
  Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

Andrii Nakryiko wrote:
> runqslower's Makefile is building/installing bpftool into
> $(OUTPUT)/sbin/bpftool, which coincides with $(DEFAULT_BPFTOOL). In practice
> this means that often when building selftests from scratch (after `make
> clean`), selftests are racing with runqslower to simultaneously build bpftool
> and one of the two processes fail due to file being busy. Prevent this race by
> explicitly order-depending on $(BPFTOOL_DEFAULT).
> 
> Fixes: a2c9652f751e ("selftests: Refactor build to remove tools/lib/bpf from include path")
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> ---

Acked-by: John Fastabend <john.fastabend@gmail.com>

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

* Re: [PATCH bpf] selftests/bpf: prevent runqslower from racing on building bpftool
  2020-08-06  6:27 ` John Fastabend
@ 2020-08-06 23:38   ` Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-08-06 23:38 UTC (permalink / raw)
  To: John Fastabend
  Cc: Andrii Nakryiko, bpf, Network Development, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Kernel Team

On Wed, Aug 5, 2020 at 11:27 PM John Fastabend <john.fastabend@gmail.com> wrote:
>
> Andrii Nakryiko wrote:
> > runqslower's Makefile is building/installing bpftool into
> > $(OUTPUT)/sbin/bpftool, which coincides with $(DEFAULT_BPFTOOL). In practice
> > this means that often when building selftests from scratch (after `make
> > clean`), selftests are racing with runqslower to simultaneously build bpftool
> > and one of the two processes fail due to file being busy. Prevent this race by
> > explicitly order-depending on $(BPFTOOL_DEFAULT).
> >
> > Fixes: a2c9652f751e ("selftests: Refactor build to remove tools/lib/bpf from include path")
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> > ---
>
> Acked-by: John Fastabend <john.fastabend@gmail.com>

Applied. Thanks

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

end of thread, other threads:[~2020-08-06 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05  0:47 [PATCH bpf] selftests/bpf: prevent runqslower from racing on building bpftool Andrii Nakryiko
2020-08-06  6:27 ` John Fastabend
2020-08-06 23:38   ` Alexei Starovoitov

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).