Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix test_ksyms on non-SMP kernels

On non-SMP kernels __per_cpu_start is not 0, so look it up in kallsyms.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200910171336.3161995-1-iii@linux.ibm.com

authored by

Ilya Leoshkevich and committed by
Alexei Starovoitov
90a1deda d66423fb

+4 -2
+4 -2
tools/testing/selftests/bpf/prog_tests/ksyms.c
··· 32 32 33 33 void test_ksyms(void) 34 34 { 35 + __u64 per_cpu_start_addr = kallsyms_find("__per_cpu_start"); 35 36 __u64 link_fops_addr = kallsyms_find("bpf_link_fops"); 36 37 const char *btf_path = "/sys/kernel/btf/vmlinux"; 37 38 struct test_ksyms *skel; ··· 64 63 "got %llu, exp %llu\n", data->out__bpf_link_fops1, (__u64)0); 65 64 CHECK(data->out__btf_size != btf_size, "btf_size", 66 65 "got %llu, exp %llu\n", data->out__btf_size, btf_size); 67 - CHECK(data->out__per_cpu_start != 0, "__per_cpu_start", 68 - "got %llu, exp %llu\n", data->out__per_cpu_start, (__u64)0); 66 + CHECK(data->out__per_cpu_start != per_cpu_start_addr, "__per_cpu_start", 67 + "got %llu, exp %llu\n", data->out__per_cpu_start, 68 + per_cpu_start_addr); 69 69 70 70 cleanup: 71 71 test_ksyms__destroy(skel);