mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Clark Williams <williams@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	RT <linux-rt-users@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"greg@kroah.com" <greg@kroah.com>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	Kay Sievers <kay.sievers@vrfy.org>
Subject: Re: [RT] Lockdep warning on boot with 2.6.31-rc5-rt1.1
Date: Sat, 8 Aug 2009 17:06:04 +0800	[thread overview]
Message-ID: <d82e647a0908080206j78a49674i99ba80801398055d@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0908071154530.3063-100000@iolanthe.rowland.org>

2009/8/8 Alan Stern <stern@rowland.harvard.edu>:
> On Fri, 7 Aug 2009, Peter Zijlstra wrote:

>> It used to be that _all_ dev->sem instances were taken on suspend or
>> something like that, I think that got fixed a long while back.
>>
>> I'd have to look at what the current locking requirements for dev->sem
>> are.
>
> It is supposed to be locked whenever the driver core invokes a probe,
> remove, or PM-related callback.  Under some circumstances, the parent's
> semaphore is supposed to be locked as well.  Individual subsystems may
> have their own requirements in addition to these.
>
> The ordering requirement is: Don't try to acquire a device's lock if
> you already hold the lock for a non-ancestor device.  More generally
> (if more obscurely): If you already hold device A's lock, then don't
> try to acquire the lock for device B unless you already hold the lock
> for A & B's most recent common ancestor.
>

It seems that the following case is very common, and A and B have no
common ancestor, but we can hold device A and B's lock at the same
time, can't we?

Thanks.

device A  comes in one bus:
	device_add()
         ->bus_attach_device()
            ->device_attach():drivers/base/dd.c /*holding device A's lock*/
               ->...drv->probe()		/*sleep here some time*/

then device B comes in another bus:
	device_add()
         ->bus_attach_device()
            ->device_attach():drivers/base/dd.c /*holding device B's lock*/
               ->...drv->probe()		/*sleep here some time*/

-- 
Lei Ming

  parent reply	other threads:[~2009-08-08  9:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 14:46 Clark Williams
2009-08-07 15:09 ` Peter Zijlstra
2009-08-07 16:04   ` Alan Stern
2009-08-07 16:15     ` Peter Zijlstra
2009-08-07 16:45       ` Alan Stern
2009-08-07 16:49         ` Peter Zijlstra
2009-08-07 21:30           ` Alan Stern
2009-08-08  9:06     ` Ming Lei [this message]
2009-08-08 15:19       ` Alan Stern
2009-08-08  3:20   ` Dave Young
2009-08-08  8:33   ` Ming Lei
2009-08-08 12:00 ` Theodore Tso
2009-08-08 14:07   ` Dave Young

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=d82e647a0908080206j78a49674i99ba80801398055d@mail.gmail.com \
    --to=tom.leiming@gmail.com \
    --cc=greg@kroah.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rjw@sisk.pl \
    --cc=stern@rowland.harvard.edu \
    --cc=tglx@linutronix.de \
    --cc=williams@redhat.com \
    /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

all inboxes | Powered by JetHome®