linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: mingo@kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lockdep: Check if nested lock is actually held
Date: Thu, 13 Sep 2012 12:16:32 +0200	[thread overview]
Message-ID: <1347531392.15764.119.camel@twins> (raw)
In-Reply-To: <5051B101.4030806@canonical.com>

On Thu, 2012-09-13 at 12:10 +0200, Maarten Lankhorst wrote:
> Hey,
> 
> Op 13-09-12 11:59, Peter Zijlstra schreef:
> > On Thu, 2012-09-13 at 11:39 +0200, Maarten Lankhorst wrote:
> >> It is considered good form to lock the lock you claim to be nested in.
> > Uhm yeah.. cute. You actually found a site where this triggered?
> >
> Not in mainline, I was working on some lockdep annotations for my work on
> moving ttm reservations to base kernel, and I wrote a whole bunch of tests
> to stress interaction between reservations and locks, one of the tests I
> was doing was taking a spinlock without the nested object:
> 
> static void reservation_test_fence_nest_unreserved(void)
> {
> 	struct reservation_object o;
> 
> 	reservation_object_init(&o);
> 
> 	spin_lock_nest_lock(&o.fence_lock, &o);
> 	spin_unlock(&o.fence_lock);
> }
> 
> I would have expected it to fail, and the patch fixed it. As a nice side effect
> it also complained about another hack I was doing elsewhere with reservations to
> tests for deadlocks, and it forced me to fix it in a slightly less hacky way.

Nice.. thanks for noticing!

  reply	other threads:[~2012-09-13 10:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13  9:39 [PATCH] lockdep: Check if nested lock is actually held Maarten Lankhorst
2012-09-13  9:59 ` Peter Zijlstra
2012-09-13 10:10   ` Maarten Lankhorst
2012-09-13 10:16     ` Peter Zijlstra [this message]
2012-09-14  6:18 ` [tip:core/locking] " tip-bot for Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347531392.15764.119.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@canonical.com \
    --cc=mingo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).