[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230928080556.GE9829@noisy.programming.kicks-ass.net>
Date: Thu, 28 Sep 2023 10:05:56 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Boqun Feng <boqun.feng@...il.com>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org, rcu@...r.kernel.org,
"Paul E. McKenney" <paulmck@...nel.org>,
Frederic Weisbecker <frederic@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Joel Fernandes <joel@...lfernandes.org>,
John Ogness <john.ogness@...utronix.de>,
Josh Triplett <josh@...htriplett.org>,
Lai Jiangshan <jiangshanlai@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Neeraj Upadhyay <quic_neeraju@...cinc.com>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Waiman Long <longman@...hat.com>,
Will Deacon <will@...nel.org>,
Zqiang <qiang.zhang1211@...il.com>
Subject: Re: [RFC PATCH] srcu: Use try-lock lockdep annotation for NMI-safe
access.
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.
Powered by blists - more mailing lists