OSDN Git Service

selftests/bpf: Add tests for BPF_F_PRESERVE_ELEMS
authorSong Liu <songliubraving@fb.com>
Wed, 30 Sep 2020 22:49:27 +0000 (15:49 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 1 Oct 2020 06:21:06 +0000 (23:21 -0700)
commitd6b42068412bd17d94b3b7b51d3787120ba8c738
tree5ced6a6080311879a0f2d103db5bc6e761e0f406
parent792caccc4526bb489e054f9ab61d7c024b15dea2
selftests/bpf: Add tests for BPF_F_PRESERVE_ELEMS

Add tests for perf event array with and without BPF_F_PRESERVE_ELEMS.

Add a perf event to array via fd mfd. Without BPF_F_PRESERVE_ELEMS, the
perf event is removed when mfd is closed. With BPF_F_PRESERVE_ELEMS, the
perf event is removed when the map is freed.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200930224927.1936644-3-songliubraving@fb.com
tools/testing/selftests/bpf/prog_tests/pe_preserve_elems.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_pe_preserve_elems.c [new file with mode: 0644]