From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
Arjan van de Ven <arjan@infradead.org>
Subject: Re: [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6)
Date: Mon, 29 Jun 2009 23:04:01 +0200 [thread overview]
Message-ID: <200906292304.02181.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0906291504050.17436-100000@iolanthe.rowland.org>
On Monday 29 June 2009, Alan Stern wrote:
> On Mon, 29 Jun 2009, Rafael J. Wysocki wrote:
>
> > IMO one can think of pm_request_resume() as a top half of pm_runtime_resume().
>
> Normal top halves don't trigger before the circumstances are
> appropriate. For example, if you enable remote wakeup on a USB device,
> it won't send a wakeup signal before it has been powered down. A
> driver calling pm_request_resume while the device is still resumed is
> like a USB device sending a wakeup request while it is still powered
> up. So IMO the analogy with top halves isn't a good one.
>
> > Thus, it should either queue up a request to run pm_runtime_resume() or leave
> > the status as though pm_runtime_resume() ran. Anything else would be
> > internally inconsistent. So, if pm_runtime_resume() cancels pending suspend
> > requests, pm_request_resume() should do the same or the other way around.
> >
> > Now, arguably, ignoring pending suspend requests is somewhat easier from
> > the core's point of view, but it may not be so for drivers.
>
> The argument I gave in the previous email demonstrates that it doesn't
> make any difference to drivers. Either way, they have to use two I/O
> pathways, they have to do a pm_runtime_get before pm_request_resume,
> and they have to do a pm_request_put after the I/O is done.
>
> Of course, this is all somewhat theoretical. I still don't know of any
> actual drivers that do the equivalent of pm_request_resume.
>
> > My point is that the core should always treat pending suspend requests in the
> > same way. If they are canceled by pm_runtime_resume(), then
> > pm_request_resume() should also cancel them and it shouldn't be possible
> > to schedule a suspend request when the resume counter is greater than 0.
> > In turn, if they are ignored by pm_runtime_resume(), then pm_request_resume()
> > should also ignore them and there's no point to prevent pm_request_suspend()
> > from scheduling a suspend request if the resume counter is greater than 0.
> >
> > Any other type of behavior has a potential to confuse driver writers.
>
> Another possible approach you could take when the call to
> cancel_delayed_work fails (which should be rare) is to turn on RPM_WAKE
> in addition to RPM_IDLE and leave the suspend request queued. When
> __pm_runtime_suspend sees both flags are set, it should abort and set
> the status directly back to RPM_ACTIVE. At that time the idle
> notifications can start up again.
>
> Is this any better? I can't see how drivers would care, though.
There still is the problem that the suspend request is occupying the
work_struct which cannot be used for any other purpose. I don't think this
is avoidable, though. This way or another it is possible to have two requests
pending at a time.
Perhaps the simplest thing to do would be to simply ignore pending suspend
requests in both pm_request_resume() and pm_runtime_resume() and to allow
them to be scheduled at any time. That shouldn't hurt anything as long as
pm_runtime_suspend() is smart enough, but it has to be anyway, because it
can be run synchronously at any time.
The only question is what pm_runtime_suspend() should do when it sees a pending
suspend request and quite frankly I think it can just ignore it as well,
leaving the RPM_IDLE bit set. In which case the name RPM_IDLE will not really
be adequate, so perhaps it can be renamed to RPM_REQUEST or something like
this.
Then, we'll need a separate work structure for suspend requests, but I have no
problem with that.
> P.S.: What do you think should happen if there's a delayed suspend
> request pending, then pm_request_resume is called (and it leaves the
> request queued), and then someone calls pm_runtime_suspend? You've got
> two pending requests and a synchronous call all active at the same
> time!
That's easy, pm_runtime_suspend() sees a pending resume, so it quits and the
other things work out as usual.
Best,
Rafael
next prev parent reply other threads:[~2009-06-29 21:03 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-22 23:21 [PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 3) Rafael J. Wysocki
2009-06-23 17:00 ` Rafael J. Wysocki
2009-06-23 17:10 ` Alan Stern
2009-06-24 0:08 ` Rafael J. Wysocki
2009-06-24 0:36 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 4) Rafael J. Wysocki
2009-06-24 19:24 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 5) Rafael J. Wysocki
2009-06-24 21:30 ` Alan Stern
2009-06-25 16:49 ` [linux-pm] " Alan Stern
2009-06-25 21:58 ` Rafael J. Wysocki
2009-06-25 23:17 ` Rafael J. Wysocki
2009-06-26 18:06 ` Alan Stern
2009-06-26 20:46 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6) Rafael J. Wysocki
2009-06-26 21:13 ` Alan Stern
2009-06-26 22:32 ` Rafael J. Wysocki
2009-06-27 1:25 ` Alan Stern
2009-06-27 14:51 ` Alan Stern
2009-06-27 21:51 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 7) Rafael J. Wysocki
2009-06-28 10:25 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6) Rafael J. Wysocki
2009-06-28 21:07 ` Alan Stern
2009-06-29 0:15 ` Rafael J. Wysocki
2009-06-29 3:05 ` Alan Stern
2009-06-29 14:09 ` Rafael J. Wysocki
2009-06-29 14:29 ` Alan Stern
2009-06-29 14:54 ` Rafael J. Wysocki
2009-06-29 15:27 ` Alan Stern
2009-06-29 15:55 ` Rafael J. Wysocki
2009-06-29 16:10 ` Alan Stern
2009-06-29 16:39 ` Rafael J. Wysocki
2009-06-29 17:29 ` Alan Stern
2009-06-29 18:25 ` Rafael J. Wysocki
2009-06-29 19:25 ` Alan Stern
2009-06-29 21:04 ` Rafael J. Wysocki [this message]
2009-06-29 22:00 ` Alan Stern
2009-06-29 22:50 ` Rafael J. Wysocki
2009-06-30 15:10 ` Alan Stern
2009-06-30 22:30 ` [RFC] Run-time PM framework (was: Re: [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 6)) Rafael J. Wysocki
2009-07-01 15:35 ` Alan Stern
2009-07-01 22:19 ` Rafael J. Wysocki
2009-07-02 15:42 ` Rafael J. Wysocki
2009-07-02 15:55 ` Alan Stern
2009-07-02 17:50 ` Rafael J. Wysocki
2009-07-02 19:53 ` Alan Stern
2009-07-02 23:05 ` Rafael J. Wysocki
2009-07-03 20:58 ` Alan Stern
2009-07-03 23:57 ` Rafael J. Wysocki
2009-07-04 3:12 ` Alan Stern
2009-07-04 21:27 ` Rafael J. Wysocki
2009-07-05 14:50 ` Alan Stern
2009-07-05 21:47 ` Rafael J. Wysocki
2009-06-26 21:49 ` [patch update] PM: Introduce core framework for run-time PM of I/O devices (rev. 5) Rafael J. Wysocki
2009-06-25 14:57 ` Magnus Damm
2009-06-26 22:02 ` Rafael J. Wysocki
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=200906292304.02181.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=arjan@infradead.org \
--cc=gregkh@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=mingo@elte.hu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox