From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Oliver Neukum <oliver@neukum.org>,
Magnus Damm <magnus.damm@gmail.com>,
linux-pm@lists.linux-foundation.org,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
Greg KH <gregkh@suse.de>
Subject: Re: [patch update 3] PM: Introduce core framework for run-time PM of I/O devices
Date: Mon, 22 Jun 2009 17:49:49 +0200 [thread overview]
Message-ID: <200906221749.50784.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0906221017420.3081-100000@iolanthe.rowland.org>
On Monday 22 June 2009, Alan Stern wrote:
> On Sun, 21 Jun 2009, Rafael J. Wysocki wrote:
>
> > > Sorry, what I meant was that in each case the counter should be
> > > {inc,dec}remented if a new request had to be queued. If one was
> > > already queued then the counter should be left alone.
> > >
> > > The reason behind this is that a bunch of pm_request_suspend calls
> > > which all end up referring to the same workqueue item will result in a
> > > single async call to the runtime_suspend method.
> >
> > Yes, that's why only the first one results in queuing up a request.
> >
> > There is a problem with that if the later calls are supposed to use shorter
> > delays, but I have no real idea to handle this cleanly.
>
> Nor do I. When the time-of-last-use and delay fields are implemented,
> this should never arise.
OK, so I'd like to leave it as is for now with the assumption that it's going
to be solved in future.
> > > Therefore they should cause a single decrement of the counter. Likewise for
> > > pm_request_resume.
> >
> > Hmm. Why exactly do you think it's necessary to decrease the usage counter
> > in suspend functions? You can't suspend a device more than once and you have
> > to resume it at the first request anyway.
> >
> > I think it makes sense to increase the usage counter on every attempt to
> > resume, even if the device is not woken up as a result, because that means the
> > caller wants the device not to be suspended until the counter is decreased.
> > This way, even if the device is already active, multiple callers can prevent it
> > from suspending by calling pm_request_resume_get() or pm_runtime_resume_get()
> > and then dropping the references.
>
> Again, this boils down to how drivers decide to use the async
> interface. I can see justifications for both pm_request_resume_get
> (which would always increment the counter) and pm_request_resume (which
> would increment the counter only if a work item had to be queued).
OK, so this means we should provide both at the core level and let the drivers
decide which one to use.
I think in both cases the caller would be responsible for decrementing the
counter?
> And of course, synchronous pm_runtime_resume should always increment the
> counter.
Sure.
> > Now, we can also make pm_request_suspend() and pm_runtime_suspend() drop
> > the usage counter (if it's greater than zero), but that implies a usage model
> > in which a resume function called when I/O is started should be balanced with a
> > suspend function called after the I/O has been finished.
> >
> > However, I'd prefer a usage model in which ->runtime_idle() is called when the
> > I/O is finished and the usage counter is zero and it decides whether to call a
> > suspend function.
> >
> > So, perhaps I should make resume functions increase the usage counter
> > unconditionally and introduce pm_runtime_idle() to be called when the I/O is
> > done? That is, pm_runtime_idle() will decrement the usage counter, check if
> > it's zero and call ->runtime_idle() when that's the case (well, this is what
> > pm_runtime_put_notify() does right now, but maybe the name is wrong).
>
> Maybe it should just be called pm_runtime_put. There could be a
> separate pm_runtime_idle that doesn't decrement the counter but invokes
> the callback if the counter is already 0. (This could be useful after
> a runtime_resume method returned -EBUSY.)
OK
> > Also, there should be a function to use when it's only necessary to drop the
> > usage counter, without calling ->runtime_idle() (for example, if another code
> > path is supposed to call a suspend function directly).
>
> I don't see any reason for that. It says: "The device isn't in use any
> more, but even though we support autosuspend we aren't going to try to
> suspend it now." What's the point? And as for the other code path, if
> the device is already suspended when it calls the suspend function
> directly, there's no harm done.
OK
Best,
Rafael
next prev parent reply other threads:[~2009-06-22 15:49 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-13 22:23 [PATCH] PM: Introduce core framework for run-time PM of I/O devices Rafael J. Wysocki
2009-06-14 9:41 ` Magnus Damm
2009-06-14 10:29 ` Rafael J. Wysocki
2009-06-14 9:58 ` [linux-pm] " Rafael J. Wysocki
2009-06-14 22:57 ` [patch update] " Rafael J. Wysocki
2009-06-14 23:18 ` Arjan van de Ven
2009-06-15 20:02 ` Rafael J. Wysocki
2009-06-15 21:08 ` Alan Stern
2009-06-15 23:21 ` Rafael J. Wysocki
2009-06-16 14:30 ` Alan Stern
2009-06-16 21:30 ` [patch update 2] " Rafael J. Wysocki
2009-06-16 22:33 ` [patch update 2 fix] " Rafael J. Wysocki
2009-06-17 20:08 ` Alan Stern
2009-06-17 23:07 ` Rafael J. Wysocki
2009-06-18 18:17 ` Alan Stern
2009-06-19 0:38 ` Rafael J. Wysocki
2009-06-19 16:25 ` Alan Stern
2009-06-19 22:42 ` Rafael J. Wysocki
2009-06-20 2:34 ` Alan Stern
2009-06-20 14:30 ` [linux-pm] " Alan Stern
2009-06-20 23:48 ` Rafael J. Wysocki
2009-06-21 2:30 ` Alan Stern
2009-06-21 11:32 ` Rafael J. Wysocki
2009-06-22 14:16 ` Alan Stern
2009-06-22 15:27 ` Rafael J. Wysocki
2009-06-22 15:39 ` Alan Stern
2009-06-22 15:53 ` Rafael J. Wysocki
2009-06-22 6:20 ` Magnus Damm
2009-06-22 6:43 ` Arjan van de Ven
2009-06-22 7:27 ` Magnus Damm
2009-06-22 13:49 ` [linux-pm] " Arjan van de Ven
2009-06-22 15:39 ` Rafael J. Wysocki
2009-06-22 15:33 ` Rafael J. Wysocki
2009-06-22 8:15 ` Oliver Neukum
2009-06-20 23:38 ` [patch update 3] " Rafael J. Wysocki
2009-06-21 2:23 ` Alan Stern
2009-06-21 12:46 ` Rafael J. Wysocki
2009-06-22 15:01 ` Alan Stern
2009-06-22 15:49 ` Rafael J. Wysocki [this message]
2009-06-22 16:28 ` Alan Stern
2009-06-22 23:02 ` Rafael J. Wysocki
2009-06-23 17:02 ` Alan Stern
2009-06-23 17:45 ` Rafael J. Wysocki
2009-06-23 18:26 ` Alan Stern
2009-06-24 0:17 ` Rafael J. Wysocki
2009-06-24 14:51 ` Alan Stern
2009-06-24 19:14 ` Rafael J. Wysocki
2009-06-24 20:19 ` Alan Stern
2009-06-24 21:23 ` Rafael J. Wysocki
2009-06-24 15:04 ` [patch update] " Pavel Machek
2009-06-27 21:52 ` Rafael J. Wysocki
2009-07-06 8:28 ` Pavel Machek
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=200906221749.50784.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=gregkh@suse.de \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=magnus.damm@gmail.com \
--cc=mingo@elte.hu \
--cc=oliver@neukum.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox