On Mon, May 25, 2020 at 08:47:30AM -0700, Paul E. McKenney wrote: > On Mon, May 25, 2020 at 01:25:21PM +0200, Peter Zijlstra wrote: > > That is; how can you use a spinlock on the producer side at all? > > So even trylock is now forbidden in NMI handlers? If so, why? The litmus tests don't have trylock. But you made me look at the actual patch: +static void *__bpf_ringbuf_reserve(struct bpf_ringbuf *rb, u64 size) +{ + unsigned long cons_pos, prod_pos, new_prod_pos, flags; + u32 len, pg_off; + struct bpf_ringbuf_hdr *hdr; + + if (unlikely(size > RINGBUF_MAX_RECORD_SZ)) + return NULL; + + len = round_up(size + BPF_RINGBUF_HDR_SZ, 8); + cons_pos = smp_load_acquire(&rb->consumer_pos); + + if (in_nmi()) { + if (!spin_trylock_irqsave(&rb->spinlock, flags)) + return NULL; + } else { + spin_lock_irqsave(&rb->spinlock, flags); + } And that is of course utter crap. That's like saying you don't care about your NMI data.