diff mbox series

[bpf-next] selftests/bpf: compare vmlinux.h checksum when building %.bpf.o

Message ID TCvb-R45mBUJOpoW3V-tLkH2XppfNXYbkv7Ph0ae8J9MZKWFvQ3nkJw74KKMbMzzpAvbwXBwRuBmhFOtHl0-jLLrIALH-_2_Zp-MZ9pPXPo=@pm.me (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series [bpf-next] selftests/bpf: compare vmlinux.h checksum when building %.bpf.o | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-0 success Logs for Lint
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Unittests
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-5 success Logs for aarch64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-4 success Logs for aarch64-gcc / build / build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-9 success Logs for aarch64-gcc / test (test_verifier, false, 360) / test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for aarch64-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-11 success Logs for s390x-gcc / build / build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-12 success Logs for s390x-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-15 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-17 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-18 success Logs for x86_64-gcc / build / build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for s390x-gcc / veristat
bpf/vmtest-bpf-next-VM_Test-19 success Logs for x86_64-gcc / build-release
bpf/vmtest-bpf-next-VM_Test-20 success Logs for x86_64-gcc / test (test_maps, false, 360) / test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-23 success Logs for x86_64-gcc / test (test_progs_no_alu32_parallel, true, 30) / test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-24 success Logs for x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for x86_64-gcc / test (test_verifier, false, 360) / test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-26 success Logs for x86_64-gcc / veristat / veristat on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for x86_64-llvm-17 / build / build for x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-29 success Logs for x86_64-llvm-17 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-28 success Logs for x86_64-llvm-17 / build-release / build for x86_64 with llvm-17-O2
bpf/vmtest-bpf-next-VM_Test-33 success Logs for x86_64-llvm-17 / veristat
bpf/vmtest-bpf-next-VM_Test-32 success Logs for x86_64-llvm-17 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-34 success Logs for x86_64-llvm-18 / build / build for x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-35 success Logs for x86_64-llvm-18 / build-release / build for x86_64 with llvm-18-O2
bpf/vmtest-bpf-next-VM_Test-36 success Logs for x86_64-llvm-18 / test (test_maps, false, 360) / test_maps on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-40 success Logs for x86_64-llvm-18 / test (test_verifier, false, 360) / test_verifier on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-41 success Logs for x86_64-llvm-18 / veristat
bpf/vmtest-bpf-next-VM_Test-6 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for aarch64-gcc / test (test_progs, false, 360) / test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-8 success Logs for aarch64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 success Logs for s390x-gcc / test (test_progs, false, 360) / test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for x86_64-gcc / test (test_progs, false, 360) / test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-22 success Logs for x86_64-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-30 success Logs for x86_64-llvm-17 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-37 success Logs for x86_64-llvm-18 / test (test_progs, false, 360) / test_progs on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-31 success Logs for x86_64-llvm-17 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-17
bpf/vmtest-bpf-next-VM_Test-39 success Logs for x86_64-llvm-18 / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-38 success Logs for x86_64-llvm-18 / test (test_progs_cpuv4, false, 360) / test_progs_cpuv4 on x86_64 with llvm-18
bpf/vmtest-bpf-next-VM_Test-14 success Logs for s390x-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 on s390x with gcc
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for bpf-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 10 maintainers not CCed: sdf@fomichev.me haoluo@google.com jolsa@kernel.org shuah@kernel.org linux-kselftest@vger.kernel.org song@kernel.org yonghong.song@linux.dev kpsingh@kernel.org martin.lau@linux.dev john.fastabend@gmail.com
netdev/build_clang success Errors and warnings before: 17 this patch: 17
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 22 this patch: 22
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 37 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Ihor Solodrai Aug. 23, 2024, 11:06 p.m. UTC
%.bpf.o objects depend on vmlinux.h, which makes them transitively
dependent on unnecessary libbpf headers. However vmlinux.h doesn't
actually change as often.

Compute and save vmlinux.h checksum, and change $(TRUNNER_BPF_OBJS)
dependencies so that they are rebuilt only if vmlinux.h contents was
changed. Also explicitly list libbpf headers required for test progs.

Example of build time improvement (after first clean build):
  $ touch ../../../lib/bpf/bpf.h
  $ time make -j8
Before: real  1m37.592s
After:  real  0m27.310s

You may notice that the speed gain is caused by skipping %.bpf.o gen.

Link: https://lore.kernel.org/bpf/CAEf4BzY1z5cC7BKye8=A8aTVxpsCzD=p1jdTfKC7i0XVuYoHUQ@mail.gmail.com

Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
---
 tools/testing/selftests/bpf/Makefile | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

Comments

Andrii Nakryiko Aug. 26, 2024, 9:59 p.m. UTC | #1
On Fri, Aug 23, 2024 at 4:06 PM Ihor Solodrai <ihor.solodrai@pm.me> wrote:
>
> %.bpf.o objects depend on vmlinux.h, which makes them transitively
> dependent on unnecessary libbpf headers. However vmlinux.h doesn't
> actually change as often.
>
> Compute and save vmlinux.h checksum, and change $(TRUNNER_BPF_OBJS)
> dependencies so that they are rebuilt only if vmlinux.h contents was
> changed. Also explicitly list libbpf headers required for test progs.
>
> Example of build time improvement (after first clean build):
>   $ touch ../../../lib/bpf/bpf.h
>   $ time make -j8
> Before: real  1m37.592s
> After:  real  0m27.310s
>
> You may notice that the speed gain is caused by skipping %.bpf.o gen.
>
> Link: https://lore.kernel.org/bpf/CAEf4BzY1z5cC7BKye8=A8aTVxpsCzD=p1jdTfKC7i0XVuYoHUQ@mail.gmail.com
>
> Signed-off-by: Ihor Solodrai <ihor.solodrai@pm.me>
> ---
>  tools/testing/selftests/bpf/Makefile | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index ec7d425c4022..4f23d9ddc8b8 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -407,6 +407,14 @@ else
>         $(Q)cp "$(VMLINUX_H)" $@
>  endif
>
> +VMLINUX_H_CHECKSUM := $(INCLUDE_DIR)/vmlinux.h.md5
> +
> +$(VMLINUX_H_CHECKSUM): $(INCLUDE_DIR)/vmlinux.h
> +       $(shell md5sum $(INCLUDE_DIR)/vmlinux.h > .tmp.md5)
> +       $(shell md5sum -c .tmp.md5 $(VMLINUX_H_CHECKSUM) --status \
> +               || cp -f .tmp.md5 $(VMLINUX_H_CHECKSUM))
> +       $(shell rm .tmp.md5)

I'm not sure what md5sum buys us here, tbh... To compute checksum you
need to read entire contents anyways, so you are not really saving
anything performance-wise.

I was originally thinking that we'll extend existing rule for
$(INCLUDE_DIR)/vmlinux.h to do bpftool dump into temporary file, then
do `cmp --silent` over it and existing vmlinux.h (if it does exist, of
course), and if they are identical just exit and not modify anything.
If not, we just mv temp file over destination vmlinux.h.

In my head this would prevent make from triggering dependent targets
because vmlinux.h's modification time won't change.

Does the above not work?


> +
>  $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids   \
>                        $(TOOLSDIR)/bpf/resolve_btfids/main.c    \
>                        $(TOOLSDIR)/lib/rbtree.c                 \
> @@ -515,6 +523,12 @@ xdp_features.skel.h-deps := xdp_features.bpf.o
>  LINKED_BPF_OBJS := $(foreach skel,$(LINKED_SKELS),$($(skel)-deps))
>  LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.c,$(LINKED_BPF_OBJS))
>
> +HEADERS_FOR_BPF_OBJS := $(wildcard $(BPFDIR)/*.bpf.h)          \
> +                       $(addprefix $(BPFDIR)/, bpf_core_read.h \
> +                                               bpf_endian.h    \
> +                                               bpf_helpers.h   \
> +                                               bpf_tracing.h)
> +
>  # Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on
>  # $eval()) and pass control to DEFINE_TEST_RUNNER_RULES.
>  # Parameters:
> @@ -564,9 +578,8 @@ $(TRUNNER_BPF_PROGS_DIR)$(if $2,-)$2-bpfobjs := y
>  $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.bpf.o:                                \
>                      $(TRUNNER_BPF_PROGS_DIR)/%.c                       \
>                      $(TRUNNER_BPF_PROGS_DIR)/*.h                       \
> -                    $$(INCLUDE_DIR)/vmlinux.h                          \
> -                    $(wildcard $(BPFDIR)/bpf_*.h)                      \
> -                    $(wildcard $(BPFDIR)/*.bpf.h)                      \
> +                    $(VMLINUX_H_CHECKSUM)                              \
> +                    $(HEADERS_FOR_BPF_OBJS)                            \
>                      | $(TRUNNER_OUTPUT) $$(BPFOBJ)
>         $$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@,                      \
>                                           $(TRUNNER_BPF_CFLAGS)         \
> --
> 2.34.1
>
>
Ihor Solodrai Aug. 27, 2024, 1:22 a.m. UTC | #2
Hi Andrii, thanks for a review.

On Monday, August 26th, 2024 at 2:59 PM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:

[...]

> I'm not sure what md5sum buys us here, tbh... To compute checksum you
> need to read entire contents anyways, so you are not really saving
> anything performance-wise.
> 
> I was originally thinking that we'll extend existing rule for
> $(INCLUDE_DIR)/vmlinux.h to do bpftool dump into temporary file, then
> do `cmp --silent` over it and existing vmlinux.h (if it does exist, of
> course), and if they are identical just exit and not modify anything.
> If not, we just mv temp file over destination vmlinux.h.

> 
> In my head this would prevent make from triggering dependent targets
> because vmlinux.h's modification time won't change.
> 
> Does the above not work?

I tried your suggestion and it works too. I like it better, as it's a
smaller change (see below).

A checksum was just the first idea I had about saving the previous
state of vmlinux.h, and I went with it. Copying an entire file seemed
excessive to me, but it's not necessary as it turns out.

Please let me know if the cmp version is ok, and I'll send v2 of the
patch.

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index c120617b64ad..25412b9194bd 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -402,7 +402,8 @@ endif
 $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR)
 ifeq ($(VMLINUX_H),)
 	$(call msg,GEN,,$@)
-	$(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
+	$(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $(INCLUDE_DIR)/.vmlinux.h.tmp
+	$(Q)cmp -s $(INCLUDE_DIR)/.vmlinux.h.tmp $@ || mv $(INCLUDE_DIR)/.vmlinux.h.tmp $@
 else
 	$(call msg,CP,,$@)
 	$(Q)cp "$(VMLINUX_H)" $@
@@ -516,6 +517,12 @@ xdp_features.skel.h-deps := xdp_features.bpf.o
 LINKED_BPF_OBJS := $(foreach skel,$(LINKED_SKELS),$($(skel)-deps))
 LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.c,$(LINKED_BPF_OBJS))
 
+HEADERS_FOR_BPF_OBJS := $(wildcard $(BPFDIR)/*.bpf.h)		\
+			$(addprefix $(BPFDIR)/,	bpf_core_read.h	\
+			                        bpf_endian.h	\
+						bpf_helpers.h	\
+			                        bpf_tracing.h)
+
 # Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on
 # $eval()) and pass control to DEFINE_TEST_RUNNER_RULES.
 # Parameters:
@@ -566,8 +573,7 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.bpf.o:				\
 		     $(TRUNNER_BPF_PROGS_DIR)/%.c			\
 		     $(TRUNNER_BPF_PROGS_DIR)/*.h			\
 		     $$(INCLUDE_DIR)/vmlinux.h				\
-		     $(wildcard $(BPFDIR)/bpf_*.h)			\
-		     $(wildcard $(BPFDIR)/*.bpf.h)			\
+		     $(HEADERS_FOR_BPF_OBJS)				\
 		     | $(TRUNNER_OUTPUT) $$(BPFOBJ)
 	$$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@,			\
 					  $(TRUNNER_BPF_CFLAGS)         \
Andrii Nakryiko Aug. 27, 2024, 5 p.m. UTC | #3
On Mon, Aug 26, 2024 at 6:22 PM Ihor Solodrai <ihor.solodrai@pm.me> wrote:
>
> Hi Andrii, thanks for a review.
>
> On Monday, August 26th, 2024 at 2:59 PM, Andrii Nakryiko <andrii.nakryiko@gmail.com> wrote:
>
> [...]
>
> > I'm not sure what md5sum buys us here, tbh... To compute checksum you
> > need to read entire contents anyways, so you are not really saving
> > anything performance-wise.
> >
> > I was originally thinking that we'll extend existing rule for
> > $(INCLUDE_DIR)/vmlinux.h to do bpftool dump into temporary file, then
> > do `cmp --silent` over it and existing vmlinux.h (if it does exist, of
> > course), and if they are identical just exit and not modify anything.
> > If not, we just mv temp file over destination vmlinux.h.
>
> >
> > In my head this would prevent make from triggering dependent targets
> > because vmlinux.h's modification time won't change.
> >
> > Does the above not work?
>
> I tried your suggestion and it works too. I like it better, as it's a
> smaller change (see below).
>
> A checksum was just the first idea I had about saving the previous
> state of vmlinux.h, and I went with it. Copying an entire file seemed
> excessive to me, but it's not necessary as it turns out.
>
> Please let me know if the cmp version is ok, and I'll send v2 of the
> patch.
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index c120617b64ad..25412b9194bd 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -402,7 +402,8 @@ endif
>  $(INCLUDE_DIR)/vmlinux.h: $(VMLINUX_BTF) $(BPFTOOL) | $(INCLUDE_DIR)
>  ifeq ($(VMLINUX_H),)
>         $(call msg,GEN,,$@)
> -       $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $@
> +       $(Q)$(BPFTOOL) btf dump file $(VMLINUX_BTF) format c > $(INCLUDE_DIR)/.vmlinux.h.tmp
> +       $(Q)cmp -s $(INCLUDE_DIR)/.vmlinux.h.tmp $@ || mv $(INCLUDE_DIR)/.vmlinux.h.tmp $@

great, just maybe leave a small comment that we do this to avoid
updating timestamps if contents didn't change, to not trigger
expensive recompilation of many dependent files

>  else
>         $(call msg,CP,,$@)
>         $(Q)cp "$(VMLINUX_H)" $@
> @@ -516,6 +517,12 @@ xdp_features.skel.h-deps := xdp_features.bpf.o
>  LINKED_BPF_OBJS := $(foreach skel,$(LINKED_SKELS),$($(skel)-deps))
>  LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.c,$(LINKED_BPF_OBJS))
>
> +HEADERS_FOR_BPF_OBJS := $(wildcard $(BPFDIR)/*.bpf.h)          \
> +                       $(addprefix $(BPFDIR)/, bpf_core_read.h \
> +                                               bpf_endian.h    \
> +                                               bpf_helpers.h   \
> +                                               bpf_tracing.h)
> +

let's split this change into a separate patch?

>  # Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on
>  # $eval()) and pass control to DEFINE_TEST_RUNNER_RULES.
>  # Parameters:
> @@ -566,8 +573,7 @@ $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.bpf.o:                             \
>                      $(TRUNNER_BPF_PROGS_DIR)/%.c                       \
>                      $(TRUNNER_BPF_PROGS_DIR)/*.h                       \
>                      $$(INCLUDE_DIR)/vmlinux.h                          \
> -                    $(wildcard $(BPFDIR)/bpf_*.h)                      \
> -                    $(wildcard $(BPFDIR)/*.bpf.h)                      \
> +                    $(HEADERS_FOR_BPF_OBJS)                            \
>                      | $(TRUNNER_OUTPUT) $$(BPFOBJ)
>         $$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@,                      \
>                                           $(TRUNNER_BPF_CFLAGS)         \
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index ec7d425c4022..4f23d9ddc8b8 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -407,6 +407,14 @@  else
 	$(Q)cp "$(VMLINUX_H)" $@
 endif
 
+VMLINUX_H_CHECKSUM := $(INCLUDE_DIR)/vmlinux.h.md5
+
+$(VMLINUX_H_CHECKSUM): $(INCLUDE_DIR)/vmlinux.h
+	$(shell md5sum $(INCLUDE_DIR)/vmlinux.h > .tmp.md5)
+	$(shell md5sum -c .tmp.md5 $(VMLINUX_H_CHECKSUM) --status \
+		|| cp -f .tmp.md5 $(VMLINUX_H_CHECKSUM))
+	$(shell rm .tmp.md5)
+
 $(RESOLVE_BTFIDS): $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/resolve_btfids	\
 		       $(TOOLSDIR)/bpf/resolve_btfids/main.c	\
 		       $(TOOLSDIR)/lib/rbtree.c			\
@@ -515,6 +523,12 @@  xdp_features.skel.h-deps := xdp_features.bpf.o
 LINKED_BPF_OBJS := $(foreach skel,$(LINKED_SKELS),$($(skel)-deps))
 LINKED_BPF_SRCS := $(patsubst %.bpf.o,%.c,$(LINKED_BPF_OBJS))
 
+HEADERS_FOR_BPF_OBJS := $(wildcard $(BPFDIR)/*.bpf.h)		\
+			$(addprefix $(BPFDIR)/,	bpf_core_read.h	\
+			                        bpf_endian.h	\
+						bpf_helpers.h	\
+			                        bpf_tracing.h)
+
 # Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on
 # $eval()) and pass control to DEFINE_TEST_RUNNER_RULES.
 # Parameters:
@@ -564,9 +578,8 @@  $(TRUNNER_BPF_PROGS_DIR)$(if $2,-)$2-bpfobjs := y
 $(TRUNNER_BPF_OBJS): $(TRUNNER_OUTPUT)/%.bpf.o:				\
 		     $(TRUNNER_BPF_PROGS_DIR)/%.c			\
 		     $(TRUNNER_BPF_PROGS_DIR)/*.h			\
-		     $$(INCLUDE_DIR)/vmlinux.h				\
-		     $(wildcard $(BPFDIR)/bpf_*.h)			\
-		     $(wildcard $(BPFDIR)/*.bpf.h)			\
+		     $(VMLINUX_H_CHECKSUM)				\
+		     $(HEADERS_FOR_BPF_OBJS)				\
 		     | $(TRUNNER_OUTPUT) $$(BPFOBJ)
 	$$(call $(TRUNNER_BPF_BUILD_RULE),$$<,$$@,			\
 					  $(TRUNNER_BPF_CFLAGS)         \