On 2/13/25 16:23, Alexei Starovoitov wrote: > On Thu, Feb 13, 2025 at 7:04 AM Vlastimil Babka <vbabka@xxxxxxx> wrote: >> >> >> > + >> > +#define __localtry_trylock_irqsave(lock, flags) \ >> > + ({ \ >> > + int __locked; \ >> > + \ >> > + typecheck(unsigned long, flags); \ >> > + flags = 0; \ >> > + if (in_nmi() | in_hardirq()) { \ >> > + __locked = 0; \ >> >> Because of this, IIUC? > > Right. > It's part of commit log: > + In PREEMPT_RT local_lock_irqsave() maps to preemptible spin_lock(). > + Map localtry_lock_irqsave() to preemptible spin_trylock(). > + When in hard IRQ or NMI return false right away, since > + spin_trylock() is not safe due to PI issues. > > Steven explained it in detail in some earlier thread. > > realtime is hard. bpf and realtime together are even harder. > Things got much better over the years, but plenty of work ahead. > I can go in detail, but offtopic for this thread. Thanks, it's fine. Just that the comment of the function could be more clear then, so people don't have to check implementation/commit log/lore discussions :)