From: Adam Belay <ambx1@neo.rr.com>
To: Alan Stern <stern@rowland.harvard.edu>,
Patrick Mochel <mochel@digitalimplant.org>
Cc: Linux-pm mailing list <linux-pm@lists.osdl.org>
Subject: Re: Re: Runtime PM and device locking
Date: Mon, 8 Aug 2005 16:41:11 +0000 [thread overview]
Message-ID: <20050808164111.GA7276@neo.rr.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0508081600010.4454-100000@iolanthe.rowland.org>
[-- Attachment #1: Type: text/plain, Size: 2223 bytes --]
On Mon, Aug 08, 2005 at 04:03:56PM -0400, Alan Stern wrote:
> On Mon, 8 Aug 2005, Patrick Mochel wrote:
>
> >
> > On Sat, 6 Aug 2005, Alan Stern wrote:
> >
> > > Brief recap: To avoid races, the RTPM code in a driver will need to
> > > lock the device while it does its work. The locking-order
> > > requirement for dev->sem is that locks can only be acquired going
> > > _down_ the device tree: a thread that owns a child's lock may not try
> > > to lock the parent. However RTPM involves notifications that go _up_
> > > the tree. This makes it impossible to acquire the locks we need.
> > >
> > > There doesn't appear to be any way to make this work as stated. So
> > > instead, we add a second semaphore to struct device: dev->power_sem.
> > > The rule for locking is that power_sem's can only be acquired going
> > > _up_ the power DAG. In addition, if a thread holds a device's
> > > power_sem then it may not try to lock any device's regular semaphore.
> > > (That is, first lock dev->sem, then lock dev->power_sem, then go up
> > > the DAG only acquiring power_sem's.)
> >
> > At first thought, it seems Ok with the caveat that it should go in to a
> > separate object (the power object with which to create the power DAG).
> > This should make it a bit easier to understand and follow.
Pat, I'm not using kobjects in my power object code. If we decide it's
necessary, how should we name the power nodes?
>
> Good -- mainly I just wanted to check that the idea wasn't totally
> off-base. Putting the power_sem into the power object makes sense.
This solution is very similar to the power object tree patch I'm currently
working on. The main difference is that I'm using pre-state-change and
post-state-change notification methods. The advantage is that we should
be able to use an iterative algorithm, allowing for deep power trees. I'll
post code soon.
>
> There are still one or two patches pending for USB power management. Once
> those have been submitted and added to Greg's tree, I'll put together
> something that implements most of this RTPM stuff for USB. It'll make a
> good working example to stimulate future discussions.
I think that would be very interesting.
Thanks,
Adam
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2005-08-08 16:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-06 19:28 Runtime PM and device locking Alan Stern
2005-08-08 19:40 ` Patrick Mochel
2005-08-08 20:03 ` Alan Stern
2005-08-08 16:41 ` Adam Belay [this message]
2005-08-08 20:58 ` Alan Stern
2005-08-11 14:10 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2005-08-08 21:15 Woodruff, Richard
2005-08-08 22:17 ` Alan Stern
2005-08-08 22:45 Woodruff, Richard
2005-08-09 14:13 ` Alan Stern
2005-08-11 14:24 Preece Scott-PREECE
2005-08-11 14:32 ` Pavel Machek
2005-08-11 14:52 ` Alan Stern
2005-08-11 14:40 Preece Scott-PREECE
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=20050808164111.GA7276@neo.rr.com \
--to=ambx1@neo.rr.com \
--cc=linux-pm@lists.osdl.org \
--cc=mochel@digitalimplant.org \
--cc=stern@rowland.harvard.edu \
/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.