[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091119155549.GB4967@nowhere>
Date: Thu, 19 Nov 2009 16:55:55 +0100
From: Frederic Weisbecker <fweisbec@...il.com>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Ingo Molnar <mingo@...e.hu>, LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ming Lei <tom.leiming@...il.com>
Subject: Re: [PATCH 2/2] lockdep: Don't only check recursive read locks
once in a sequence
On Wed, Nov 18, 2009 at 05:43:03PM +0800, Lai Jiangshan wrote:
> Frederic Weisbecker wrote:
> > Say we have the following locks:
> > A (rwlock, Aw: writelock, Ar: recursive read lock)
> > B (normal lock)
> >
> > and the following sequences:
> > Ar -> B -> Ar
> > Aw -> B
> >
> > This won't be detected as a lock inversion
>
> """
> read-preference <==> read-recursive ability (rwlock)
> otherwise ==> read-recursive disability (rwsem)
> """
I don't understand the idea of "read-preference". And btw I
don't understand why rwsem read locks are not considered as
recursive in lockdep.
> If "B -> Ar" is always after "Ar", it's NOT a really
> lock inversion because rwlock is read-preference, we
> can ignore all "Ar" which are after "B".
It's not a lock inversion in itself because it's legal to have:
Ar -> B -> Ar
> If sometimes "B -> Ar" is not after "Ar",
> then we have these sequences:
> B -> Ar
> Aw -> B
>
> Lockdep can detects it now(without this patch applied).
>
> Maybe I have misunderstood your patch.
Well.
In my example we have this sequence first:
Ar -> B -> Ar
And this second one:
Aw -> B
In the lockdep tree, the read lock won't even be registered,
so we'll just have Aw -> B in the tree.
If we insert these in the tree, we'll have one branch that will
look like that:
Aw
|
B
|
Ar
Like we do with any other kind of lock. We just plug the dependencies
between them. We know that B depends on Aw, but Ar also depends on B.
Although the merged sequence might never happen, there is still a risk
and the above is not legal.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists