diff options
| author | Andrii Nakryiko <andrii@kernel.org> | 2021-05-06 22:41:15 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2021-05-11 15:07:17 -0700 |
| commit | 256eab48e70c0eaf5b1b9af83c0588491986c7de (patch) | |
| tree | 31f258d11a2de49f180040ebc7f74100c331993c /tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c | |
| parent | fdbf5ddeb855a80831af2e5bb9db9218926e6789 (diff) | |
selftests/bpf: Stop using static variables for passing data to/from user-space
In preparation of skipping emitting static variables in BPF skeletons, switch
all current selftests uses of static variables to pass data between BPF and
user-space to use global variables.
All non-read-only `static volatile` variables become just plain global
variables by dropping `static volatile` part.
Read-only `static volatile const` variables, though, still require `volatile`
modifier, otherwise compiler will ignore whatever values are set from
user-space.
Few static linker tests are using name-conflicting static variables to
validate that static linker still properly handles static variables and
doesn't trip up on name conflicts.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20210507054119.270888-4-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c')
| -rw-r--r-- | tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c b/tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c index ee49493dc125..400fdf8d6233 100644 --- a/tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c +++ b/tools/testing/selftests/bpf/progs/bpf_iter_test_kern4.c @@ -9,8 +9,8 @@ __u32 map1_id = 0, map2_id = 0; __u32 map1_accessed = 0, map2_accessed = 0; __u64 map1_seqnum = 0, map2_seqnum1 = 0, map2_seqnum2 = 0; -static volatile const __u32 print_len; -static volatile const __u32 ret1; +volatile const __u32 print_len; +volatile const __u32 ret1; SEC("iter/bpf_map") int dump_bpf_map(struct bpf_iter__bpf_map *ctx) |