Re: [PATCH] bpf: add KF_SPIN_LOCK flag for kfuncs under bpf_spin_lock

Kumar Kartikeya Dwivedi <[email protected]> Tue, 4 Aug 2026 15:05:48 +0200
Newsgroups org.kernel.vger.bpf,org.kernel.vger.linux-kernel
Message-ID <CAP01T759brVc7=HWHqtjcvLJYEJg9FjkjmdgBxTneS2J348uqQ@mail.gmail.com>
On Tue, 4 Aug 2026 at 14:43, Leon Hwang <[email protected]> wrote:
>
> On 2026/8/4 18:22, Kumar Kartikeya Dwivedi wrote:
> > On Tue Aug 4, 2026 at 12:09 PM CEST, Kaitao Cheng wrote:
> [...]
> >>
> >> Alternatively, following the naming of GFP_ATOMIC, could we call it KF_ATOMIC?
> >
> > I think that is also confusing, every kfunc is allowed in atomic context in
> > general. E.g. bpf_map_update_elem() in spin lock critical section would be
> > problematic (due to embedded bpf_spin_lock in map value surfacing a deadlock
> > opportunity). KF_OK_IN_SPIN_LOCK_CS is another option, but slightly longer than
> > the previous proposal.
> >
> > In any case, let's choose this or the former one, and not fret too much about
> > the naming. We can also choose a better name later on.
> >
>
> KF_LOCK_SAFE? Since other kfuncs are lock-unsafe for verifier.

That works too, probably better. Kaitao would probably prefer
KF_SPIN_LOCK_SAFE, to make it more specific I guess.

>
> Thanks,
> Leon
>