Re: [PATCH bpf v2 1/4] rhashtable: Add trylock_irqsoff for callers that can't spin

From: Alexei Starovoitov

Date: Fri Dec 04 2026 - 23:23:19 EST


On Thu, Dec 03, 2026 at 08:47 PM Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:
> Please call it something more obvious like used_in_nmi.

It's not only NMI. rht_lock_nested() calls lock_acquire_exclusive()
with the bit set. With lockdep a prog on the lock_acquire tracepoint
runs there and in_nmi() is false.
How about "reentrant" ?

> But I have to say that I'd rather draw a line and say that rhashtable
> should not be used in NMI handlers and if you guys need that please
> design your own data structure.

BPF_MAP_TYPE_RHASH is uapi since 7.2.
Are you suggesting to copy paste the whole rhashtable logic
into kernel/bpf/ ?
We can, but that's silly. no?

Can you live with the flag under a better name?