On 9/15/06, Dmitry Torokhov <[email protected]> wrote:
On 9/15/06, Jiri Kosina <[email protected]> wrote:
> On Fri, 15 Sep 2006, Dmitry Torokhov wrote:
>
> > I understand what Ingo is saying about detecting deadlocks across the
> > pool of locks of the same class not waiting till they really clash, it
> > is really useful. I also want to make my code as independent of lockdep
> > as possible. Having a speciall marking on the locks themselves (done
> > upon creation) instead of altering call sites is the cleanest way IMHO.
> > Can we have a flag in the lock structure that would tell lockdep that it
> > is OK for the given lock to be taken several times (i.e. the locks are
> > really on the different objects)? This would still allow to detect
> > incorrect locking across different classes.
>
> Yes, but unfortunately marking the lock as 'can-be-taken-multiple-times'
> is weaker than using the nested locking provided by lockdep.
>
> i.e. if you mark a lock this way, it opens door for having deadlock, which
> won't be detected by lockdep. This will happen if the code, by mistake,
> really takes the _very same_ lock twice. lockdep will not be able to
> detect this, when the lock is marked in a way you propose, but is able to
> detect this when using the nested semantics.
>
But nested semantics breaks the notion of the locks belonging to the
same pool so both solutions have tradeoffs. I could use either one of
these as long as details are hidden and callers do not have to care.
One more thing I forgot to add - how will we deal with lockdep in
cases when we have X-over-Y-over-X protocol, when there is no tight
coupling between the X parts so it is impossible to know when to apply
special marking on the lock or callers?
--
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]