From: Peter Zijlstra <peterz@infradead.org>
To: David Howells <dhowells@redhat.com>
Cc: Takashi Iwai <tiwai@suse.de>, Ingo Molnar <mingo@elte.hu>,
Linux filesystem caching discussion list
<linux-cachefs@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
Johannes Berg <johannes@sipsolutions.net>, oleg <oleg@redhat.com>
Subject: Re: Incorrect circular locking dependency?
Date: Tue, 04 Aug 2009 18:08:52 +0200 [thread overview]
Message-ID: <1249402132.4762.9.camel@laptop> (raw)
In-Reply-To: <18723.1249401004@redhat.com>
On Tue, 2009-08-04 at 16:50 +0100, David Howells wrote:
> Peter Zijlstra <peterz@infradead.org> wrote:
>
> > Creating a new class for your second workqueue might help,
>
> I only have one workqueue. The problem is there are two waitqueues, but
> init_waitqueue_head() always sets q->lock to the same class.
Ah, right, I read it backwards then.
> > we'd have to pass a second key through __create_workqueue_key() and pass
> > that into init_cpu_workqueue() and apply it to cwq->lock using
> > lockdep_set_class() and co.
>
> Actually, wouldn't just making init_cpu_workqueue() apply a class to
> cwq->more_work that's common to all workqueues suffice?
That's the default behaviour.
> Or even, have
> init_waitqueue_head() apply an alternate class to q->lock?
Right, that would work. Something akin to all the other per instance
classes would do I guess.
Utterly untested..
---
include/linux/wait.h | 9 ++++++++-
kernel/wait.c | 5 +++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 6788e1a..cf3c2f5 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -77,7 +77,14 @@ struct task_struct;
#define __WAIT_BIT_KEY_INITIALIZER(word, bit) \
{ .flags = word, .bit_nr = bit, }
-extern void init_waitqueue_head(wait_queue_head_t *q);
+extern void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *);
+
+#define init_waitqueue_head(q) \
+ do { \
+ static struct lock_class_key __key; \
+ \
+ __init_waitqueue_head((q), &__key); \
+ } while (0)
#ifdef CONFIG_LOCKDEP
# define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \
diff --git a/kernel/wait.c b/kernel/wait.c
index ea7c3b4..c4bd3d8 100644
--- a/kernel/wait.c
+++ b/kernel/wait.c
@@ -10,13 +10,14 @@
#include <linux/wait.h>
#include <linux/hash.h>
-void init_waitqueue_head(wait_queue_head_t *q)
+void __init_waitqueue_head(wait_queue_head_t *q, struct lock_class_key *key)
{
spin_lock_init(&q->lock);
+ lockdep_set_class(&q->lock, key);
INIT_LIST_HEAD(&q->task_list);
}
-EXPORT_SYMBOL(init_waitqueue_head);
+EXPORT_SYMBOL(__init_waitqueue_head);
void add_wait_queue(wait_queue_head_t *q, wait_queue_t *wait)
{
next prev parent reply other threads:[~2009-08-04 16:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 2:37 CacheFiles: Readpage failed on backing file Christian Kujau
2009-06-22 8:58 ` [Linux-cachefs] " David Howells
2009-06-22 14:54 ` Takashi Iwai
2009-06-22 15:21 ` David Howells
2009-06-22 15:45 ` Takashi Iwai
2009-07-07 7:21 ` Takashi Iwai
2009-07-07 13:00 ` David Howells
2009-07-07 13:05 ` Takashi Iwai
2009-07-27 14:37 ` Incorrect circular locking dependency? David Howells
2009-08-04 14:51 ` Peter Zijlstra
2009-08-04 15:50 ` David Howells
2009-08-04 16:08 ` Peter Zijlstra [this message]
2009-08-04 15:59 ` Oleg Nesterov
2009-08-04 17:23 ` [Linux-cachefs] CacheFiles: Readpage failed on backing file David Howells
2009-08-05 10:00 ` Takashi Iwai
2009-08-07 12:07 ` Takashi Iwai
2009-08-07 14:26 ` David Howells
2009-06-23 0:36 ` Christian Kujau
2009-06-23 7:49 ` Christian Kujau
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=1249402132.4762.9.camel@laptop \
--to=peterz@infradead.org \
--cc=dhowells@redhat.com \
--cc=johannes@sipsolutions.net \
--cc=linux-cachefs@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.