From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934129AbZHEKAZ (ORCPT ); Wed, 5 Aug 2009 06:00:25 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933331AbZHEKAY (ORCPT ); Wed, 5 Aug 2009 06:00:24 -0400 Received: from cantor.suse.de ([195.135.220.2]:58057 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933345AbZHEKAX (ORCPT ); Wed, 5 Aug 2009 06:00:23 -0400 Date: Wed, 05 Aug 2009 12:00:23 +0200 Message-ID: From: Takashi Iwai To: David Howells Cc: peterz@infradead.org, Linux filesystem caching discussion list , LKML Subject: Re: [Linux-cachefs] CacheFiles: Readpage failed on backing file In-Reply-To: <3776.1249406624@redhat.com> References: <6950.1245661098@redhat.com> <3776.1249406624@redhat.com> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 Emacs/22.3 (x86_64-suse-linux-gnu) MULE/5.0 (SAKAKI) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Tue, 04 Aug 2009 18:23:44 +0100, David Howells wrote: > > > Takashi Iwai wrote: > > > ======================================================= > > [ INFO: possible circular locking dependency detected ] > > 2.6.30-test #7 > > ------------------------------------------------------- > > swapper/0 is trying to acquire lock: > > (&cwq->lock){-.-...}, at: [] __queue_work+0x1f/0x4e > > > > but task is already holding lock: > > (&q->lock){-.-.-.}, at: [] __wake_up+0x26/0x5c > > > > which lock already depends on the new lock. > > ... > > Can you try the attached patch from Peter Zijlstra? It should cause the work > queue's waitqueue spinlock to have a separate lockdep class from the page > bit's waitqueue. I'm willing to test it, but could you clarify which patches to be tested together with this one? There are a few flying around... thanks, Takashi > > David > --- > From: Peter Zijlstra > Subject: [PATCH] Give waitqueue spinlocks their own lockdep classes > > Give waitqueue spinlocks their own lockdep classes when they are initialised > from init_waitqueue_head(). This means that struct wait_queue::func functions > can operate other waitqueues. > > This is used by CacheFiles to catch the page from a backing fs being unlocked > and to wake up another thread to take a copy of it. > --- > > 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 > #include > > -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) > { >