diff options
author | Andrii Nakryiko <[email protected]> | 2021-01-11 23:55:20 -0800 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2021-01-12 17:24:30 -0800 |
commit | 430d97a8a7bf1500c081ce756ff2ead73d2303c5 (patch) | |
tree | 348ac2808f0006934b49aa2f472b7d069af710ba /tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | |
parent | 284d2587ea8a96f97ca519a3de683ff226e9e2b3 (diff) |
selftests/bpf: Test kernel module ksym externs
Add per-CPU variable to bpf_testmod.ko and use those from new selftest to
validate it works end-to-end.
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Acked-by: Hao Luo <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c')
-rw-r--r-- | tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c index 2df19d73ca49..0b991e115d1f 100644 --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c @@ -3,6 +3,7 @@ #include <linux/error-injection.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/percpu-defs.h> #include <linux/sysfs.h> #include <linux/tracepoint.h> #include "bpf_testmod.h" @@ -10,6 +11,8 @@ #define CREATE_TRACE_POINTS #include "bpf_testmod-events.h" +DEFINE_PER_CPU(int, bpf_testmod_ksym_percpu) = 123; + noinline ssize_t bpf_testmod_test_read(struct file *file, struct kobject *kobj, struct bin_attribute *bin_attr, |