libbpf: Add missing per-arch include path
Subsystems (7)
PATCH 1/2 libbpf: Add missing per-arch include path
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
--- tools/lib/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/Makefile +2 -1
@@ -61,7 +61,8 @@ ifndef VERBOSE endif INCLUDES = -I$(or $(OUTPUT),.) \ - -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi + -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi \ + -I$(srctree)/tools/arch/$(SRCARCH)/include export prefix libdir src obj
base-commit: db5ca265e3334b48c4e3fa07eef79e8bc578c430
Signature · 1 line
2.43.0
PATCH 2/2 selftests: bpf: Add missing per-arch include path
From: Björn Töpel <[email protected]>
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.
--- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/Makefile +2 -1
@@ -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
Signature · 1 line
2.43.0
Re: [PATCH bpf-next 2/2] selftests: bpf: Add missing per-arch include path
Quoted 28 lines · Björn Töpel
From: Björn Töpel <[email protected]>
The
prog_testsprograms 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 <[email protected]>--- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +1
-0@@ -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),)
tools/testing/selftests/bpf/Makefile CFLAGS += -g $(OPT_FLAGS) -rdynamic \ · line 48
Quoted 5 lines
tools/testing/selftests/bpf/Makefile +1
-1@@ -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?
Quoted 6 lines
tools/testing/selftests/bpf/Makefile +0
-1LDFLAGS += $(SAN_LDFLAGS) LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread --2.43.0
Re: [PATCH bpf-next 2/2] selftests: bpf: Add missing per-arch include path
Quoted 31 lines · Andrii Nakryiko
Quoted 29 lines · Björn Töpel
From: Björn Töpel <[email protected]>
The
prog_testsprograms 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 <[email protected]>--- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/bpf/Makefile +1
-0@@ -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 \
Quoted 8 lines
tools/testing/selftests/bpf/Makefile CFLAGS += -g $(OPT_FLAGS) -rdynamic \ · line 48
Quoted 4 lines
tools/testing/selftests/bpf/Makefile +1
-1$(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
Quoted 20 lines · Björn Töpel
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
Fixes 6d74d178fe6e ("tools: Add riscv barrier implementation")Signed-off-by Björn Töpel <[email protected]>--- tools/lib/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/lib/bpf/Makefile +0
-0
tools/lib/bpf/Makefile ifndef VERBOSE · line 68
Quoted 9 lines
tools/lib/bpf/Makefile +2
-1@@ -61,7 +61,8 @@ ifndef VERBOSE endif INCLUDES = -I$(or $(OUTPUT),.) \ - -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi + -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi \ + -I$(srctree)/tools/arch/$(SRCARCH)/include export prefix libdir src obj
Do you know what exactly is used from tools/arch/$(SRCARCH)/include for (I assume) RISC-V? I'm asking because we'd need to make sure that Github version of libbpf Makefile and include directory has all the necessary pieces as well (so I'd appreciate if you could take a look at that as well, if you haven't already).
Quoted 5 lines
base-commit:
db5ca265e3334b48c4e3fa07eef79e8bc578c430--
2.43.0
Andrii,
Quoted 29 lines · Andrii Nakryiko
Quoted 27 lines · Björn Töpel
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
Fixes 6d74d178fe6e ("tools: Add riscv barrier implementation")Signed-off-by Björn Töpel <[email protected]>--- tools/lib/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/lib/bpf/Makefile +2
-1@@ -61,7 +61,8 @@ ifndef VERBOSE endif INCLUDES = -I$(or $(OUTPUT),.) \ - -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi + -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi \ + -I$(srctree)/tools/arch/$(SRCARCH)/include
Quoted 8 lines
tools/lib/bpf/Makefile ifndef VERBOSE · line 68
Quoted 2 lines
tools/lib/bpf/Makefile +0
-0export prefix libdir src objDo you know what exactly is used from tools/arch/$(SRCARCH)/include for (I assume) RISC-V? I'm asking because we'd need to make sure that Github version of libbpf
Makefileand include directory has all the necessary pieces as well (so I'd appreciate if you could take a look at that as well, if you haven't already).
Ah, apologies for not stating that explicitly. It's tools/arch/riscv/include/asm/{barrier.h,fence.h}
Cheers,
Björn
This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 9 lines · On Fri, 27 Sep 2024 15:13:52 +0200 you wrote:
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
[...]
Here is the summary with links:
- [bpf-next,1/2] libbpf: Add missing per-arch include path
https://git.kernel.org/bpf/bpf-next/c/710fbca820c7 - [bpf-next,2/2] selftests: bpf: Add missing per-arch include path https://git.kernel.org/bpf/bpf-next/c/19090f0306f1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 14 lines · [email protected] writes:
Hello:
This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 8 lines · On Fri, 27 Sep 2024 15:13:52 +0200 you wrote:
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
Quoted 7 lines
Quoted 1 line
[...]
Here is the summary with links:
- [bpf-next,1/2] libbpf: Add missing per-arch include pathhttps://git.kernel.org/bpf/bpf-next/c/710fbca820c7 - [bpf-next,2/2] selftests: bpf: Add missing per-arch include path https://git.kernel.org/bpf/bpf-next/c/19090f0306f1
Andrii, I just noted that this landed into bpf-next, and not bpf (fixes).
RISC-V libbpf/perf needs this fix in 6.12 to properly build. Would it be possible to have it in the bpf tree, and have it land in 6.12-rc7?
Andreas that has a similar fix [1].
Björn
Quoted 19 lines · Björn Töpel
Quoted 16 lines · [email protected] writes:
Hello:
This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 9 lines · On Fri, 27 Sep 2024 15:13:52 +0200 you wrote:
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
[...]
Quoted 8 lines
Quoted 5 lines
Here is the summary with links:
- [bpf-next,1/2] libbpf: Add missing per-arch include pathhttps://git.kernel.org/bpf/bpf-next/c/710fbca820c7 - [bpf-next,2/2] selftests: bpf: Add missing per-arch include path https://git.kernel.org/bpf/bpf-next/c/19090f0306f1Andrii, I just noted that this landed into bpf-next, and not bpf (fixes).
Hi Bjorn,
Yes, libbpf and selftests fixes are generally applied through bpf-next, unless the issue is pretty bad and immediate.
I'm sorry, but unfortunately it's too late now to move those patches as it's now been more than a month since they landed. For the future, please let us know ASAP if you think patches were misrouted. I think we are stuck with the need to do a stable backport for these, sorry.
Quoted 10 lines
RISC-V libbpf/perf needs this fix in 6.12 to properly build. Would it be possible to have it in the bpf tree, and have it land in 6.12-rc7?
Andreas that has a similar fix [1].
Björn
Quoted 4 lines · Andrii Nakryiko
I'm sorry, but unfortunately it's too late now to move those patches as it's now been more than a month since they landed. For the future, please let us know ASAP if you think patches were misrouted. I think we are stuck with the need to do a stable backport for these, sorry.
Yeah, realize that it's really late. Thanks for getting back, and noted for the future.
Cheers,
Björn
Hi Bjorn,
Quoted 29 lines · Björn Töpel
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
Fixes 6d74d178fe6e ("tools: Add riscv barrier implementation")Signed-off-by Björn Töpel <[email protected]>--- tools/lib/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/lib/bpf/Makefile +2
-1@@ -61,7 +61,8 @@ ifndef VERBOSE endif INCLUDES = -I$(or $(OUTPUT),.) \ - -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi + -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi \ + -I$(srctree)/tools/arch/$(SRCARCH)/include export prefix libdir src obj
Quoted 1 line
base-commit:
db5ca265e3334b48c4e3fa07eef79e8bc578c430
You can add:
Thanks,
Alex
Quoted 29 lines · Björn Töpel
From: Björn Töpel <[email protected]>
libbpf does 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 libbpf build.
Fixes 6d74d178fe6e ("tools: Add riscv barrier implementation")Signed-off-by Björn Töpel <[email protected]>--- tools/lib/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/lib/bpf/Makefile +2
-1@@ -61,7 +61,8 @@ ifndef VERBOSE endif INCLUDES = -I$(or $(OUTPUT),.) \ - -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi + -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi \ + -I$(srctree)/tools/arch/$(SRCARCH)/include export prefix libdir src obj
Quoted 1 line
base-commit:
db5ca265e3334b48c4e3fa07eef79e8bc578c430
This fixes building of bpf tools, thanks! You can add the following tags...
Signature · 2 lines
Best Regards, Kexy Biscuit