[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220414202345.kireigrz7jftmes4@kafai-mbp.dhcp.thefacebook.com>
Date: Thu, 14 Apr 2022 13:23:45 -0700
From: Martin KaFai Lau <kafai@...com>
To: Stanislav Fomichev <sdf@...gle.com>
Cc: netdev@...r.kernel.org, bpf@...r.kernel.org, ast@...nel.org,
daniel@...earbox.net, andrii@...nel.org
Subject: Re: [PATCH bpf-next v2] bpf: move rcu lock management out of
BPF_PROG_RUN routines
On Thu, Apr 14, 2022 at 09:12:33AM -0700, Stanislav Fomichev wrote:
> Commit 7d08c2c91171 ("bpf: Refactor BPF_PROG_RUN_ARRAY family of macros
> into functions") switched a bunch of BPF_PROG_RUN macros to inline
> routines. This changed the semantic a bit. Due to arguments expansion
> of macros, it used to be:
>
> rcu_read_lock();
> array = rcu_dereference(cgrp->bpf.effective[atype]);
> ...
>
> Now, with with inline routines, we have:
> array_rcu = rcu_dereference(cgrp->bpf.effective[atype]);
> /* array_rcu can be kfree'd here */
> rcu_read_lock();
> array = rcu_dereference(array_rcu);
>
> I'm assuming in practice rcu subsystem isn't fast enough to trigger
> this but let's use rcu API properly.
>
> Also, rename to lower caps to not confuse with macros. Additionally,
> drop and expand BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY.
>
> See [1] for more context.
>
> [1] https://lore.kernel.org/bpf/CAKH8qBs60fOinFdxiiQikK_q0EcVxGvNTQoWvHLEUGbgcj1UYg@mail.gmail.com/T/#u
>
> v2
> - keep rcu locks inside by passing cgroup_bpf
Acked-by: Martin KaFai Lau <kafai@...com>
Powered by blists - more mailing lists