Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Stanislav Fomichev
On Tue, May 14, 2019 at 8:42 PM Alexei Starovoitov wrote: > > On Tue, May 14, 2019 at 8:38 PM Stanislav Fomichev wrote: > > > > Take a look at the patches 2-4 in the current series where I convert > > the callers. > > > > (Though, I'd rename xxx_dereference to xxx_rcu_dereference for clarity we >

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Stanislav Fomichev
On Tue, May 14, 2019 at 8:16 PM Alexei Starovoitov wrote: > > On Tue, May 14, 2019 at 07:56:36PM -0700, Stanislav Fomichev wrote: > > On 05/14, Eric Dumazet wrote: > > > > > > > > > On 5/14/19 7:27 PM, Alexei Starovoitov wrote: > > > > > > > what about activate_effective_progs() ? > > > > I wouldn

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Alexei Starovoitov
On Tue, May 14, 2019 at 8:38 PM Stanislav Fomichev wrote: > > Take a look at the patches 2-4 in the current series where I convert > the callers. > > (Though, I'd rename xxx_dereference to xxx_rcu_dereference for clarity we > get to a v2). please make a fresh repost _after_ bpf-next opens.

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Alexei Starovoitov
On Tue, May 14, 2019 at 07:56:36PM -0700, Stanislav Fomichev wrote: > On 05/14, Eric Dumazet wrote: > > > > > > On 5/14/19 7:27 PM, Alexei Starovoitov wrote: > > > > > what about activate_effective_progs() ? > > > I wouldn't want to lose the annotation there. > > > but then array_free will lose

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Stanislav Fomichev
On 05/14, Alexei Starovoitov wrote: > On Tue, May 14, 2019 at 10:53 AM Stanislav Fomichev wrote: > > > > Existing __rcu annotations don't add anything to the safety. > > what do you mean? > BPF_PROG_RUN_ARRAY derefs these pointers under rcu. And I'm not removing them from the struct definitions,

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Stanislav Fomichev
On 05/14, Eric Dumazet wrote: > > > On 5/14/19 7:27 PM, Alexei Starovoitov wrote: > > > what about activate_effective_progs() ? > > I wouldn't want to lose the annotation there. > > but then array_free will lose it? It would not have have it because the input is the result of bpf_prog_array_allo

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Eric Dumazet
On 5/14/19 7:27 PM, Alexei Starovoitov wrote: > what about activate_effective_progs() ? > I wouldn't want to lose the annotation there. > but then array_free will lose it? > in some cases it's called without mutex in a destruction path. > also how do you propose to solve different 'mtx' in > lo

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Alexei Starovoitov
On Tue, May 14, 2019 at 7:11 PM Stanislav Fomichev wrote: > > On 05/14, Alexei Starovoitov wrote: > > On Tue, May 14, 2019 at 10:53 AM Stanislav Fomichev > > wrote: > > > > > > Existing __rcu annotations don't add anything to the safety. > > > > what do you mean? > > BPF_PROG_RUN_ARRAY derefs th

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Alexei Starovoitov
On Tue, May 14, 2019 at 10:53 AM Stanislav Fomichev wrote: > > Existing __rcu annotations don't add anything to the safety. what do you mean? BPF_PROG_RUN_ARRAY derefs these pointers under rcu.

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Stanislav Fomichev
On 05/14, Alexei Starovoitov wrote: > On Tue, May 14, 2019 at 10:30:02AM -0700, Stanislav Fomichev wrote: > > On 05/14, Alexei Starovoitov wrote: > > > On Mon, May 13, 2019 at 11:57 AM Stanislav Fomichev > > > wrote: > > > > > > > > On 05/08, Stanislav Fomichev wrote: > > > > > On 05/08, Alexei S

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Alexei Starovoitov
On Tue, May 14, 2019 at 10:30:02AM -0700, Stanislav Fomichev wrote: > On 05/14, Alexei Starovoitov wrote: > > On Mon, May 13, 2019 at 11:57 AM Stanislav Fomichev > > wrote: > > > > > > On 05/08, Stanislav Fomichev wrote: > > > > On 05/08, Alexei Starovoitov wrote: > > > > > On Wed, May 08, 2019 a

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Stanislav Fomichev
On 05/14, Alexei Starovoitov wrote: > On Mon, May 13, 2019 at 11:57 AM Stanislav Fomichev wrote: > > > > On 05/08, Stanislav Fomichev wrote: > > > On 05/08, Alexei Starovoitov wrote: > > > > On Wed, May 08, 2019 at 10:18:41AM -0700, Stanislav Fomichev wrote: > > > > > Right now we are not using rc

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-14 Thread Alexei Starovoitov
On Mon, May 13, 2019 at 11:57 AM Stanislav Fomichev wrote: > > On 05/08, Stanislav Fomichev wrote: > > On 05/08, Alexei Starovoitov wrote: > > > On Wed, May 08, 2019 at 10:18:41AM -0700, Stanislav Fomichev wrote: > > > > Right now we are not using rcu api correctly: we pass __rcu pointers > > > >

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-13 Thread Stanislav Fomichev
On 05/08, Stanislav Fomichev wrote: > On 05/08, Alexei Starovoitov wrote: > > On Wed, May 08, 2019 at 10:18:41AM -0700, Stanislav Fomichev wrote: > > > Right now we are not using rcu api correctly: we pass __rcu pointers > > > to bpf_prog_array_xyz routines but don't use rcu_dereference on them > >

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-08 Thread Stanislav Fomichev
On 05/08, Alexei Starovoitov wrote: > On Wed, May 08, 2019 at 10:18:41AM -0700, Stanislav Fomichev wrote: > > Right now we are not using rcu api correctly: we pass __rcu pointers > > to bpf_prog_array_xyz routines but don't use rcu_dereference on them > > (see bpf_prog_array_delete_safe and bpf_pro

Re: [PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-08 Thread Alexei Starovoitov
On Wed, May 08, 2019 at 10:18:41AM -0700, Stanislav Fomichev wrote: > Right now we are not using rcu api correctly: we pass __rcu pointers > to bpf_prog_array_xyz routines but don't use rcu_dereference on them > (see bpf_prog_array_delete_safe and bpf_prog_array_copy in particular). > Instead of sp

[PATCH bpf 0/4] bpf: remove __rcu annotations from bpf_prog_array

2019-05-08 Thread Stanislav Fomichev
Right now we are not using rcu api correctly: we pass __rcu pointers to bpf_prog_array_xyz routines but don't use rcu_dereference on them (see bpf_prog_array_delete_safe and bpf_prog_array_copy in particular). Instead of sprinkling rcu_dereferences, let's just get rid of those __rcu annotations and