LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Ingo Molnar <mingo@elte.hu>, "Rafael J. Wysocki" <rjw@sisk.pl>,
Christian Kujau <lists@nerdbynature.de>,
linux-kernel@vger.kernel.org,
jfs-discussion@lists.sourceforge.net,
Davide Libenzi <davidel@xmailserver.org>,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: 2.6.24-rc6: possible recursive locking detected
Date: Mon, 7 Jan 2008 20:49:08 +0300 [thread overview]
Message-ID: <20080107174908.GB14880@tv-sign.ru> (raw)
In-Reply-To: <20080107172239.GA14880@tv-sign.ru>
On 01/07, Oleg Nesterov wrote:
>
> Consider this "just for illustration" patch,
>
> --- t/kernel/lockdep.c 2007-11-09 12:57:31.000000000 +0300
> +++ t/kernel/lockdep.c 2008-01-07 19:43:50.000000000 +0300
> @@ -1266,10 +1266,13 @@ check_deadlock(struct task_struct *curr,
> struct held_lock *prev;
> int i;
>
> - for (i = 0; i < curr->lockdep_depth; i++) {
> + for (i = curr->lockdep_depth; --i >= 0; ) {
> prev = curr->held_locks + i;
> if (prev->class != next->class)
> continue;
> +
> + if (prev->trylock == -1)
> + return 2;
> /*
> * Allow read-after-read recursion of the same
> * lock class (i.e. read_lock(lock)+read_lock(lock)):
> -------------------------------------------------------------------------
>
> Now,
>
> // trylock == -1
> #define spin_mark_nested(l) \
> lock_acquire(&(l)->dep_map, 0, -1, 0, 2, _THIS_IP_)
> #define spin_unmark_nested(l) \
> lock_release(&(l)->dep_map, 1, _THIS_IP_)
>
> and ep_poll_safewake() can do:
>
> /* Do really wake up now */
> spin_mark_nested(&wq->lock);
> wake_up(wq);
> spin_unmark_nested(&wq->lock);
I tested the patch above with the following code,
wait_queue_head_t w1, w2, w3;
init_waitqueue_head(&w1);
init_waitqueue_head(&w2);
init_waitqueue_head(&w3);
local_irq_disable();
spin_lock(&w1.lock);
spin_mark_nested(&w2.lock);
spin_lock(&w2.lock);
spin_mark_nested(&w3.lock);
wake_up(&w3);
spin_unmark_nested(&w3.lock);
spin_unlock(&w2.lock);
spin_unmark_nested(&w2.lock);
spin_unlock(&w1.lock);
local_irq_enable();
seems to work. What do you think?
Oleg.
next prev parent reply other threads:[~2008-01-07 17:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 22:58 Christian Kujau
2008-01-03 23:06 ` Rafael J. Wysocki
2008-01-04 8:30 ` Ingo Molnar
2008-01-05 7:12 ` Herbert Xu
2008-01-05 16:53 ` Peter Zijlstra
2008-01-05 17:01 ` Peter Zijlstra
2008-01-05 21:35 ` Davide Libenzi
2008-01-06 0:20 ` Christian Kujau
2008-01-07 21:35 ` Davide Libenzi
2008-01-06 21:44 ` Cyrill Gorcunov
2008-01-06 21:53 ` Cyrill Gorcunov
2008-01-07 17:22 ` Oleg Nesterov
2008-01-07 17:49 ` Oleg Nesterov [this message]
2008-01-13 16:32 ` Peter Zijlstra
2008-01-14 21:27 ` Oleg Nesterov
2008-01-30 10:34 ` hrtimers and lockdep (was: Re: 2.6.24-rc6: possible recursive locking detected) Peter Zijlstra
2008-01-30 17:36 ` Thomas Gleixner
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=20080107174908.GB14880@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=a.p.zijlstra@chello.nl \
--cc=davidel@xmailserver.org \
--cc=herbert@gondor.apana.org.au \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lists@nerdbynature.de \
--cc=mingo@elte.hu \
--cc=rjw@sisk.pl \
--subject='Re: 2.6.24-rc6: possible recursive locking detected' \
/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
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).