diff mbox series

[bpf-next,v2,03/10] selftests/bpf: Disable feature-llvm for vmtest

Message ID 20240904141951.1139090-4-pulehui@huaweicloud.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series Local vmtest enhancement and RV64 enabled | 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-3 success Logs for Validate matrix.py
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Unittests
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-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-6 success Logs for aarch64-gcc / test (test_maps, false, 360) / test_maps on 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-15 success Logs for s390x-gcc / test (test_verifier, false, 360) / test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 success Logs for s390x-gcc / veristat
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-19 success Logs for x86_64-gcc / build-release
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-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-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-41 success Logs for x86_64-llvm-18 / veristat
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-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-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-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-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-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-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-14 success Logs for s390x-gcc / test (test_progs_no_alu32, false, 360) / test_progs_no_alu32 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-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-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-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-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-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
netdev/tree_selection success Clearly marked for bpf-next
netdev/apply fail Patch does not apply to bpf-next-0

Commit Message

Pu Lehui Sept. 4, 2024, 2:19 p.m. UTC
From: Pu Lehui <pulehui@huawei.com>

After commit b991fc520700 ("selftests/bpf: utility function to get
program disassembly after jit"), Makefile will link libLLVM* related
libraries to the user binary execution file when detecting that
feature-llvm is enabled, which will cause the local vmtest to appear as
follows mistake:

  ./test_progs: error while loading shared libraries: libLLVM-17.so.1:
    cannot open shared object file: No such file or directory

Considering that the get_jited_program_text() function is a useful tool
for user debugging and will not be relied upon by the entire bpf
selftests, let's turn it off in local vmtest.

Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
 tools/testing/selftests/bpf/Makefile  | 2 ++
 tools/testing/selftests/bpf/vmtest.sh | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

Comments

Eduard Zingerman Sept. 4, 2024, 7:37 p.m. UTC | #1
On Wed, 2024-09-04 at 14:19 +0000, Pu Lehui wrote:
> From: Pu Lehui <pulehui@huawei.com>
> 
> After commit b991fc520700 ("selftests/bpf: utility function to get
> program disassembly after jit"), Makefile will link libLLVM* related
> libraries to the user binary execution file when detecting that
> feature-llvm is enabled, which will cause the local vmtest to appear as
> follows mistake:
> 
>   ./test_progs: error while loading shared libraries: libLLVM-17.so.1:
>     cannot open shared object file: No such file or directory
> 
> Considering that the get_jited_program_text() function is a useful tool
> for user debugging and will not be relied upon by the entire bpf
> selftests, let's turn it off in local vmtest.
> 
> Signed-off-by: Pu Lehui <pulehui@huawei.com>
> ---

I actually don't agree.
The __jited tag is supposed to be used by selftests
(granted, used by a single selftest for now).
Maybe add an option to forgo LLVM linkage when test_progs are compiled?
Regarding base image lacking libLLVM -- I need to fix this.
Eduard Zingerman Sept. 4, 2024, 11:08 p.m. UTC | #2
On Wed, 2024-09-04 at 12:37 -0700, Eduard Zingerman wrote:
> On Wed, 2024-09-04 at 14:19 +0000, Pu Lehui wrote:
> > From: Pu Lehui <pulehui@huawei.com>
> > 
> > After commit b991fc520700 ("selftests/bpf: utility function to get
> > program disassembly after jit"), Makefile will link libLLVM* related
> > libraries to the user binary execution file when detecting that
> > feature-llvm is enabled, which will cause the local vmtest to appear as
> > follows mistake:
> > 
> >   ./test_progs: error while loading shared libraries: libLLVM-17.so.1:
> >     cannot open shared object file: No such file or directory
> > 
> > Considering that the get_jited_program_text() function is a useful tool
> > for user debugging and will not be relied upon by the entire bpf
> > selftests, let's turn it off in local vmtest.
> > 
> > Signed-off-by: Pu Lehui <pulehui@huawei.com>
> > ---
> 
> I actually don't agree.
> The __jited tag is supposed to be used by selftests
> (granted, used by a single selftest for now).
> Maybe add an option to forgo LLVM linkage when test_progs are compiled?
> Regarding base image lacking libLLVM -- I need to fix this.
> 

Please consider using my commit [1] instead of this patch, it forces
static linking form LLVM libraries, thus avoiding issues with rootfs.
(This was suggested by Andrii off list).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/ez/bpf-next.git/commit/?h=selftest-llvm-static-linking&id=263bacf2f20fbc17204fd912609e26bdf6ac5a13
Pu Lehui Sept. 5, 2024, 8:36 a.m. UTC | #3
On 2024/9/5 7:08, Eduard Zingerman wrote:
> On Wed, 2024-09-04 at 12:37 -0700, Eduard Zingerman wrote:
>> On Wed, 2024-09-04 at 14:19 +0000, Pu Lehui wrote:
>>> From: Pu Lehui <pulehui@huawei.com>
>>>
>>> After commit b991fc520700 ("selftests/bpf: utility function to get
>>> program disassembly after jit"), Makefile will link libLLVM* related
>>> libraries to the user binary execution file when detecting that
>>> feature-llvm is enabled, which will cause the local vmtest to appear as
>>> follows mistake:
>>>
>>>    ./test_progs: error while loading shared libraries: libLLVM-17.so.1:
>>>      cannot open shared object file: No such file or directory
>>>
>>> Considering that the get_jited_program_text() function is a useful tool
>>> for user debugging and will not be relied upon by the entire bpf
>>> selftests, let's turn it off in local vmtest.
>>>
>>> Signed-off-by: Pu Lehui <pulehui@huawei.com>
>>> ---
>>
>> I actually don't agree.
>> The __jited tag is supposed to be used by selftests
>> (granted, used by a single selftest for now).
>> Maybe add an option to forgo LLVM linkage when test_progs are compiled?
>> Regarding base image lacking libLLVM -- I need to fix this.
>>
> 
> Please consider using my commit [1] instead of this patch, it forces
> static linking form LLVM libraries, thus avoiding issues with rootfs.
> (This was suggested by Andrii off list).
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/ez/bpf-next.git/commit/?h=selftest-llvm-static-linking&id=263bacf2f20fbc17204fd912609e26bdf6ac5a13

Happy to see this modification only on llvm lib. I test it works good 
and have picked this in next version. Thanks
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 9905e3739dd0..47aa4f113fed 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -197,6 +197,7 @@  OUTPUT := $(patsubst %/,%,$(OUTPUT))
 endif
 endif
 
+ifneq ($(FORCE_FEAT_LLVM_OFF),1)
 ifeq ($(feature-llvm),1)
   LLVM_CFLAGS  += -DHAVE_LLVM_SUPPORT
   LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets
@@ -209,6 +210,7 @@  ifeq ($(feature-llvm),1)
   endif
   LLVM_LDFLAGS += $(shell $(LLVM_CONFIG) --ldflags)
 endif
+endif
 
 SCRATCH_DIR := $(OUTPUT)/tools
 BUILD_DIR := $(SCRATCH_DIR)/build
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 65d14f3bbe30..ae2e5a5ca279 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -162,7 +162,7 @@  update_selftests()
 	local selftests_dir="${kernel_checkout}/tools/testing/selftests/bpf"
 
 	cd "${selftests_dir}"
-	${make_command}
+	FORCE_FEAT_LLVM_OFF=1 ${make_command}
 
 	# Mount the image and copy the selftests to the image.
 	mount_image