Re: Some -serious- BPF-related litmus tests

From: Peter Zijlstra
Date: Mon May 25 2020 - 07:25:50 EST

On Fri, May 22, 2020 at 12:38:21PM -0700, Andrii Nakryiko wrote:
> On 5/22/20 10:43 AM, Paul E. McKenney wrote:
> > On Fri, May 22, 2020 at 10:32:01AM -0400, Alan Stern wrote:

> > > Also, what use is a spinlock that is accessed in only one thread?
> >
> > Multiple writers synchronize via the spinlock in this case. I am
> > guessing that his larger 16-hour test contended this spinlock.
> Yes, spinlock is for coordinating multiple producers. 2p1c cases (bounded
> and unbounded) rely on this already. 1p1c cases are sort of subsets (but
> very fast to verify) checking only consumer/producer interaction.

Does that spinlock imply that we can now never fix that atrocious
bpf_prog_active trainwreck ?

How does that spinlock not trigger the USED <- IN-NMI lockdep check:

f6f48e180404 ("lockdep: Teach lockdep about "USED" <- "IN-NMI" inversions")


That is; how can you use a spinlock on the producer side at all?