mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-08-09 06:14:34 +02:00
Add the testcase for the jited inline of bpf_get_smp_processor_id(), only for LoongArch currently. Here is the test result on LoongArch: $ sudo ./test_progs -t verifier_jit_inline #604/1 verifier_jit_inline/inline_bpf_get_current_task:OK #604/2 verifier_jit_inline/inline_bpf_get_smp_processor_id:OK #604 verifier_jit_inline:OK Summary: 1/2 PASSED, 0 SKIPPED, 0 FAILED Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
36 lines
640 B
C
36 lines
640 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <vmlinux.h>
|
|
#include <bpf/bpf_helpers.h>
|
|
#include "bpf_misc.h"
|
|
|
|
SEC("fentry/bpf_fentry_test1")
|
|
__success __retval(0)
|
|
__arch_x86_64
|
|
__jited(" addq %gs:{{.*}}, %rax")
|
|
__arch_arm64
|
|
__jited(" mrs x8, SP_EL0")
|
|
__arch_riscv64
|
|
__jited(" mv a5, tp")
|
|
__arch_loongarch
|
|
__jited(" move $a5, $tp")
|
|
int inline_bpf_get_current_task(void)
|
|
{
|
|
bpf_get_current_task();
|
|
|
|
return 0;
|
|
}
|
|
|
|
SEC("fentry/bpf_fentry_test2")
|
|
__success __retval(0)
|
|
__arch_loongarch
|
|
__jited(" ld.wu $a5, $tp, 16")
|
|
int inline_bpf_get_smp_processor_id(void)
|
|
{
|
|
bpf_get_smp_processor_id();
|
|
|
|
return 0;
|
|
}
|
|
|
|
char _license[] SEC("license") = "GPL";
|