diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2020-09-10 19:13:36 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-09-11 04:53:58 +0200 |
commit | 90a1deda75c6b749fb89310e4744554a4c36ea33 (patch) | |
tree | c09152db0d3413176ba8ec45ed76337a070c1700 /tools | |
parent | bpf: Plug hole in struct bpf_sk_lookup_kern (diff) | |
download | linux-90a1deda75c6b749fb89310e4744554a4c36ea33.tar.xz linux-90a1deda75c6b749fb89310e4744554a4c36ea33.zip |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/ksyms.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/ksyms.c b/tools/testing/selftests/bpf/prog_tests/ksyms.c index e3d6777226a8..b771804b2342 100644 --- a/tools/testing/selftests/bpf/prog_tests/ksyms.c +++ b/tools/testing/selftests/bpf/prog_tests/ksyms.c @@ -32,6 +32,7 @@ out: void test_ksyms(void) { + __u64 per_cpu_start_addr = kallsyms_find("__per_cpu_start"); __u64 link_fops_addr = kallsyms_find("bpf_link_fops"); const char *btf_path = "/sys/kernel/btf/vmlinux"; struct test_ksyms *skel; @@ -63,8 +64,9 @@ void test_ksyms(void) "got %llu, exp %llu\n", data->out__bpf_link_fops1, (__u64)0); CHECK(data->out__btf_size != btf_size, "btf_size", "got %llu, exp %llu\n", data->out__btf_size, btf_size); - CHECK(data->out__per_cpu_start != 0, "__per_cpu_start", - "got %llu, exp %llu\n", data->out__per_cpu_start, (__u64)0); + CHECK(data->out__per_cpu_start != per_cpu_start_addr, "__per_cpu_start", + "got %llu, exp %llu\n", data->out__per_cpu_start, + per_cpu_start_addr); cleanup: test_ksyms__destroy(skel); |