diff mbox series

[bpf-next,2/2] selftests: bpf: Add missing per-arch include path

Message ID 20240927131355.350918-2-bjorn@kernel.org (mailing list archive)
State Handled Elsewhere
Headers show
Series [bpf-next,1/2] libbpf: Add missing per-arch include path | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR success PR summary
conchuod/patch-2-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh took 135.32s
conchuod/patch-2-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 1289.02s
conchuod/patch-2-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 1513.68s
conchuod/patch-2-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 20.27s
conchuod/patch-2-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 22.14s
conchuod/patch-2-test-6 success .github/scripts/patches/tests/checkpatch.sh took 0.38s
conchuod/patch-2-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 42.44s
conchuod/patch-2-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.00s
conchuod/patch-2-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.56s
conchuod/patch-2-test-10 success .github/scripts/patches/tests/module_param.sh took 0.01s
conchuod/patch-2-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.02s
conchuod/patch-2-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.03s

Commit Message

Björn Töpel Sept. 27, 2024, 1:13 p.m. UTC
From: Björn Töpel <bjorn@rivosinc.com>

The prog_tests programs do not include the per-arch tools include
path, e.g. tools/arch/riscv/include. Some architectures depend those
files to build properly.

Include tools/arch/$(SUBARCH)/include in the selftests bpf build.

Fixes: 6d74d178fe6e ("tools: Add riscv barrier implementation")
Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
---
 tools/testing/selftests/bpf/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andrii Nakryiko Sept. 27, 2024, 8:52 p.m. UTC | #1
On Fri, Sep 27, 2024 at 6:14 AM Björn Töpel <bjorn@kernel.org> wrote:
>
> From: Björn Töpel <bjorn@rivosinc.com>
>
> The prog_tests programs do not include the per-arch tools include
> path, e.g. tools/arch/riscv/include. Some architectures depend those
> files to build properly.
>
> Include tools/arch/$(SUBARCH)/include in the selftests bpf build.
>
> Fixes: 6d74d178fe6e ("tools: Add riscv barrier implementation")
> Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
> ---
>  tools/testing/selftests/bpf/Makefile | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> index 365740f24d2e..d6a53afa449f 100644
> --- a/tools/testing/selftests/bpf/Makefile
> +++ b/tools/testing/selftests/bpf/Makefile
> @@ -10,6 +10,7 @@ TOOLSDIR := $(abspath ../../..)
>  LIBDIR := $(TOOLSDIR)/lib
>  BPFDIR := $(LIBDIR)/bpf
>  TOOLSINCDIR := $(TOOLSDIR)/include
> +TOOLSARCHINCDIR := $(TOOLSDIR)/arch/$(SRCARCH)/include
>  BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool
>  APIDIR := $(TOOLSINCDIR)/uapi
>  ifneq ($(O),)
> @@ -44,7 +45,7 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic                                   \
>           -Wall -Werror -fno-omit-frame-pointer                         \
>           $(GENFLAGS) $(SAN_CFLAGS) $(LIBELF_CFLAGS)                    \
>           -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)          \
> -         -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)
> +         -I$(TOOLSINCDIR) -I$(TOOLSARCHINCDIR) -I$(APIDIR) -I$(OUTPUT)

Eduard was going to switch selftests to use kernel UAPI headers, I
wonder if we should do just that and then set up arch-specific
includes from kernel (not from tools/) as well?

>  LDFLAGS += $(SAN_LDFLAGS)
>  LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread
>
> --
> 2.43.0
>
Björn Töpel Sept. 28, 2024, 9:14 a.m. UTC | #2
On Fri, 27 Sept 2024 at 22:52, Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Fri, Sep 27, 2024 at 6:14 AM Björn Töpel <bjorn@kernel.org> wrote:
> >
> > From: Björn Töpel <bjorn@rivosinc.com>
> >
> > The prog_tests programs do not include the per-arch tools include
> > path, e.g. tools/arch/riscv/include. Some architectures depend those
> > files to build properly.
> >
> > Include tools/arch/$(SUBARCH)/include in the selftests bpf build.
> >
> > Fixes: 6d74d178fe6e ("tools: Add riscv barrier implementation")
> > Signed-off-by: Björn Töpel <bjorn@rivosinc.com>
> > ---
> >  tools/testing/selftests/bpf/Makefile | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
> > index 365740f24d2e..d6a53afa449f 100644
> > --- a/tools/testing/selftests/bpf/Makefile
> > +++ b/tools/testing/selftests/bpf/Makefile
> > @@ -10,6 +10,7 @@ TOOLSDIR := $(abspath ../../..)
> >  LIBDIR := $(TOOLSDIR)/lib
> >  BPFDIR := $(LIBDIR)/bpf
> >  TOOLSINCDIR := $(TOOLSDIR)/include
> > +TOOLSARCHINCDIR := $(TOOLSDIR)/arch/$(SRCARCH)/include
> >  BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool
> >  APIDIR := $(TOOLSINCDIR)/uapi
> >  ifneq ($(O),)
> > @@ -44,7 +45,7 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic                                   \
> >           -Wall -Werror -fno-omit-frame-pointer                         \
> >           $(GENFLAGS) $(SAN_CFLAGS) $(LIBELF_CFLAGS)                    \
> >           -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)          \
> > -         -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)
> > +         -I$(TOOLSINCDIR) -I$(TOOLSARCHINCDIR) -I$(APIDIR) -I$(OUTPUT)
>
> Eduard was going to switch selftests to use kernel UAPI headers, I
> wonder if we should do just that and then set up arch-specific
> includes from kernel (not from tools/) as well?

In the end it's up to you guys! This is broken on Linus' master for
RISC-V now, so from my (RISC-V) perspective having a workaround sooner
than later would be nice!

@Eduard Do you have any patches around? If so, I can take them for a spin on RV.


Björn
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 365740f24d2e..d6a53afa449f 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -10,6 +10,7 @@  TOOLSDIR := $(abspath ../../..)
 LIBDIR := $(TOOLSDIR)/lib
 BPFDIR := $(LIBDIR)/bpf
 TOOLSINCDIR := $(TOOLSDIR)/include
+TOOLSARCHINCDIR := $(TOOLSDIR)/arch/$(SRCARCH)/include
 BPFTOOLDIR := $(TOOLSDIR)/bpf/bpftool
 APIDIR := $(TOOLSINCDIR)/uapi
 ifneq ($(O),)
@@ -44,7 +45,7 @@  CFLAGS += -g $(OPT_FLAGS) -rdynamic					\
 	  -Wall -Werror -fno-omit-frame-pointer				\
 	  $(GENFLAGS) $(SAN_CFLAGS) $(LIBELF_CFLAGS)			\
 	  -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)		\
-	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)
+	  -I$(TOOLSINCDIR) -I$(TOOLSARCHINCDIR) -I$(APIDIR) -I$(OUTPUT)
 LDFLAGS += $(SAN_LDFLAGS)
 LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread