Re: [PATCH v5 bpf-next 2/2] selftests/bpf: add tests for BPF_F_PRESERVE_ELEMS

2020-09-30 Thread Alexei Starovoitov
On Wed, Sep 30, 2020 at 03:49:27PM -0700, Song Liu wrote: > + > +SEC("raw_tp/task_rename") > +int BPF_PROG(read_array_2) > +{ > + struct bpf_perf_event_value val; > + long ret; > + > + ret = bpf_perf_event_read_value(&array_2, 0, &val, sizeof(val)); > + return ret; > +} After remov

[PATCH v5 bpf-next 2/2] selftests/bpf: add tests for BPF_F_PRESERVE_ELEMS

2020-09-30 Thread Song Liu
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 --- .../bpf