Re: [PATCH net-next v3] selftests/xsk: decouple xskxceiver and xdp apps from test_progs objects

[email protected] Sat, 1 Aug 2026 01:32:01 +0000 (UTC)
Newsgroups org.kernel.vger.bpf,org.kernel.vger.netdev
Message-ID <5846008399c0c914c487eb22a9548201420ea5a14b3a4293735411e3a9726961@mail.kernel.org>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 55d394438705..2749b26fd4cd 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -932,17 +932,26 @@ $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT)
>  	$(call msg,BINARY,,$@)
>  	$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
>
> -# Include find_bit.c to compile xskxceiver.
> -EXTRA_SRC := $(TOOLSDIR)/lib/find_bit.c prog_tests/test_xsk.c prog_tests/test_xsk.h
> -$(OUTPUT)/xskxceiver: $(EXTRA_SRC) xskxceiver.c xskxceiver.h $(OUTPUT)/network_helpers.o $(OUTPUT)/xsk.o $(OUTPUT)/xsk_xdp_progs.skel.h $(BPFOBJ) | $(OUTPUT)
> +# Keep xskxceiver independent from test_progs object dependencies.
> +$(OUTPUT)/xskxceiver: xskxceiver.c xsk.c network_helpers.c \
> +			   $(TOOLSDIR)/lib/find_bit.c prog_tests/test_xsk.c \
> +			   xskxceiver.h xsk.h network_helpers.h \
> +			   prog_tests/test_xsk.h test_progs.h bpf_util.h \
> +			   $(OUTPUT)/xsk_xdp_progs.skel.h $(BPFOBJ) | $(OUTPUT)
>  	$(call msg,BINARY,,$@)
>  	$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
>
> -$(OUTPUT)/xdp_hw_metadata: xdp_hw_metadata.c $(OUTPUT)/network_helpers.o $(OUTPUT)/xsk.o $(OUTPUT)/xdp_hw_metadata.skel.h | $(OUTPUT)
> +$(OUTPUT)/xdp_hw_metadata: xdp_hw_metadata.c xsk.c network_helpers.c \
> +			   $(TOOLSDIR)/lib/find_bit.c xdp_metadata.h \
> +			   xsk.h network_helpers.h test_progs.h bpf_util.h \
> +			   $(OUTPUT)/xdp_hw_metadata.skel.h $(BPFOBJ) | $(OUTPUT)
>  	$(call msg,BINARY,,$@)
>  	$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@

This isn't a bug, but does xdp_hw_metadata actually need
$(TOOLSDIR)/lib/find_bit.c? Nothing in xdp_hw_metadata.c, xsk.c or
network_helpers.c seems to pull in <linux/bitmap.h> or the find_*_bit
helpers, unlike prog_tests/test_xsk.c in the xskxceiver rule.

The xskxceiver rule genuinely needs find_bit.c because
prog_tests/test_xsk.c includes <linux/bitmap.h> and calls bitmap_full(),
bitmap_zero(), and __set_bit(). The pre-patch xdp_hw_metadata rule did not
list find_bit.c either. The only bit-field work in xdp_hw_metadata.c is
FIELD_GET on GENMASK constants, which doesn't require find_bit helpers.

>
> -$(OUTPUT)/xdp_features: xdp_features.c $(OUTPUT)/network_helpers.o $(OUTPUT)/xdp_features.skel.h | $(OUTPUT)
> +$(OUTPUT)/xdp_features: xdp_features.c network_helpers.c xdp_features.h \
> +			   network_helpers.h \
> +			   test_progs.h bpf_util.h $(OUTPUT)/xdp_features.skel.h \
> +			   $(BPFOBJ) | $(OUTPUT)
>  	$(call msg,BINARY,,$@)
>  	$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@

This isn't a bug, but could the xdp_features prerequisite list be packed
into two continuation lines to match the density of the xskxceiver and
xdp_hw_metadata rules just above? The current wrapping spreads the
prerequisites over four lines with one line carrying only network_helpers.h
and the final line carrying just $(BPFOBJ) | $(OUTPUT), while both rules
above group their prerequisites more densely at the same indentation.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/30676354696