On Wed, Sep 27, 2023 at 11:06:09PM -0700, Boqun Feng wrote: > diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c > index e85b5ad3e206..1af8d44e5eb4 100644 > --- a/kernel/locking/lockdep.c > +++ b/kernel/locking/lockdep.c > @@ -5727,8 +5727,9 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass, > return; > > if (unlikely(!lockdep_enabled())) { > + /* Only do NMI context checking if it's a check lock */ > /* XXX allow trylock from NMI ?!? */ > - if (lockdep_nmi() && !trylock) { > + if (check && lockdep_nmi() && !trylock) { > struct held_lock hlock; > > hlock.acquire_ip = ip; > > Peter, thoughts? > I think I prefer the trylock one. Fundamentally trylock conveys the 'we wont block' thing. Making 'lock' sometimes work for NMI is just confusing.