[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200930190228.GL2611@hirez.programming.kicks-ass.net>
Date: Wed, 30 Sep 2020 21:02:28 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Boqun Feng <boqun.feng@...il.com>
Cc: g@...ez.programming.kicks-ass.net, Qian Cai <cai@...hat.com>,
Waiman Long <longman@...hat.com>,
Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>,
linux-kernel@...r.kernel.org
Subject: Re: lockdep null-ptr-deref
On Wed, Sep 30, 2020 at 08:18:18PM +0800, Boqun Feng wrote:
> For one thing, I do think that LOCK_READ_USED trace is helpful for
> better reporting, because if there is a read lock in the dependency path
> which causes the deadlock, it's better to have the LOCK_READ_USED trace
> to know at least the initial READ usage. For example, if we have
>
> void f1(...)
> {
> write_lock(&A);
> spin_lock(&C);
> // A -> C
> ...
> }
>
> void g(...)
> {
> read_lock(&A);
> ...
> }
> void f2(...)
> {
> spin_lock(&B);
> g(...);
> // B -> A
> }
>
> void f3(...) {
> spin_lock(&C);
> spin_lock(&B);
> // C -> B, trigger lockdep splat
> }
>
> when lockdep reports the deadlock (at the time f3() is called), it will
> be useful if we have a trace like:
>
> INITIAL READ usage at:
> g+0x.../0x...
> f2+0x.../0x...
>
> Thoughts?
Wouldn't that also be in LOCK_ENABLED_*_READ ?
That is, with PROVE_LOCKING on, the initial usage is bound to set more
states, except for !check||trylock usage, and those aren't really all
that interesting.
Powered by blists - more mailing lists