Re: [PATCH] bpf: add KF_SPIN_LOCK flag for kfuncs under bpf_spin_lock
From: Kumar Kartikeya Dwivedi
Date: Tue Aug 04 2026 - 09:16:27 EST
On Tue, 4 Aug 2026 at 14:43, Leon Hwang <hffilwlqm@xxxxxxxxx> 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
>