From: "Dave Young" Subject: Re: lockdep whine in 2.6.26-rc2-mm1 Date: Thu, 15 May 2008 13:47:02 +0800 Message-ID: References: <20080514000933.56adc131.akpm@linux-foundation.org> <20080514155639.GB28594@kroah.com> <20080514162442.GO9324@parisc-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from ti-out-0910.google.com ([209.85.142.184]:35801 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751735AbYEOFrE (ORCPT ); Thu, 15 May 2008 01:47:04 -0400 Received: by ti-out-0910.google.com with SMTP id b6so165533tic.23 for ; Wed, 14 May 2008 22:47:02 -0700 (PDT) In-Reply-To: <20080514162442.GO9324@parisc-linux.org> Content-Disposition: inline Sender: linux-scsi-owner@vger.kernel.org List-Id: linux-scsi@vger.kernel.org To: Matthew Wilcox Cc: Greg KH , Andrew Morton , linux-scsi@vger.kernel.org, Kay Sievers On Thu, May 15, 2008 at 12:24 AM, Matthew Wilcox wrote: > On Wed, May 14, 2008 at 08:56:39AM -0700, Greg KH wrote: >> On Wed, May 14, 2008 at 12:09:33AM -0700, Andrew Morton wrote: >> > >> > ============================================= >> > [ INFO: possible recursive locking detected ] >> > 2.6.26-rc2-mm1 #15 >> > --------------------------------------------- >> > modprobe/942 is trying to acquire lock: >> > (&cls->mutex){--..}, at: [] device_add+0x43d/0x57a >> > >> > but task is already holding lock: >> > (&cls->mutex){--..}, at: [] class_interface_register+0x48/0xbd >> > >> > other info that might help us debug this: >> > 1 lock held by modprobe/942: >> > #0: (&cls->mutex){--..}, at: [] class_interface_register+0x48/0xbd >> > >> > stack backtrace: >> > Pid: 942, comm: modprobe Not tainted 2.6.26-rc2-mm1 #15 >> > >> > Call Trace: >> > [] __lock_acquire+0x90d/0xc50 >> > [] ? restore_args+0x0/0x30 >> > [] ? device_add+0x43d/0x57a >> > [] lock_acquire+0x91/0xb7 >> > [] ? device_add+0x43d/0x57a >> > [] mutex_lock_nested+0xf2/0x278 >> > [] ? device_add+0x43d/0x57a >> > [] ? _spin_unlock+0x23/0x28 >> > [] device_add+0x43d/0x57a >> > [] device_register+0x16/0x1b >> > [] device_create+0xdf/0x112 >> > [] ? trace_hardirqs_on+0xd/0xf >> > [] ? trace_hardirqs_on+0xd/0xf >> > [] ? mutex_unlock+0x9/0xb >> > [] ? kobj_map+0x113/0x124 >> > [] ? exact_lock+0x0/0x14 >> > [] ? exact_match+0x0/0x9 >> > [] :sg:sg_add+0x2a3/0x3bd >> > [] class_interface_register+0x77/0xbd >> > [] :scsi_mod:scsi_register_interface+0x11/0x13 >> > [] :sg:init_sg+0xa3/0x155 >> > [] sys_init_module+0x1823/0x197a >> > [] ? seq_release+0x0/0x56 >> > [] system_call_after_swapgs+0x7b/0x80 >> >> I'm guessing that this is due to David's "change the semaphore to a >> mutex" patch that you have in your tree, but I refused to take as I was >> worried about just this issue :) > > Hm, I thought I saw the same patch from Arjan months ago ... anyway. > > class_interface_register() (at least in -rc2) holds &parent->sem (ie the > result of calling class_get() on the class) around calling ->add_dev. > The class in this case is the sg_sysfs_class, so it's calling sg_add(). > sg_add() calls device_create() which calls device_add() which acquires > the &dev->class->sem. The class in this case would _also_ seem to be > sg_sysfs_class. > > So why doesn't this deadlock today? The classes are different here, first sdev_class, then sg_sysfs_class Regards dave