mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>, 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>
Subject: Re: [linux-pm] [patch update 2 fix] PM: Introduce core framework for  run-time PM of I/O devices
Date: Mon, 22 Jun 2009 15:20:43 +0900	[thread overview]
Message-ID: <aec7e5c30906212320v3e3e991fyd028d005675f1e25@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0906201010590.12994-100000@netrider.rowland.org>

On Sat, Jun 20, 2009 at 11:30 PM, Alan Stern<stern@rowland.harvard.edu> wrote:
> Some more thoughts...
>
> Magnus, you might have some insights here.  It occurred to me that some
> devices can switch power levels very quickly, and the drivers might
> therefore want the runtime suspend and resume methods to be called as
> soon as possible, even in interrupt context.

I'd like to call pm_request_suspend() from interrupt context. I don't
depend on it, but being able to perform runtime suspend directly from
the ISR would be convenient from a device driver POV. I'm not sure if
that should result in bus/device ->runtime_suspend() calls from
interrupt context though.

In my case the bus specific code for ->runtime_suspend() may just
decrease the usage count of the powerdomain but refrain from calling
the device ->runtime_suspend() callbacks until all devices in the
powerdomain have been suspended. The bus/device runtime suspend
callbacks do not need to be executed from interrupt context. Just
noting that the device is idle is enough at interrupt time. This could
be handled by generic code IMO.

Runtime resume needs to block until the hardware is woken up though.
Just marking the device as resumed and letting the driver access the
hardware before it is woken up does not seem like a good idea. =) For
my SuperH devices I do not need to resume from interrupt context, at
least at this point.

>From my perspective it's ok to specificy that the ->runtime_suspend()
and ->runtime_resume() callbacks are executed from process context
only and may sleep. Seems like a simple and good interface that can be
accepted by many bus types. My bus and driver code do not need to
sleep though, so a direct-from-interrupt-context design is fine as
well.

> In terms of the current framework, this probably means holding the
> runtime PM lock (i.e., not releasing it) across the calls to
> ->runtime_suspend and ->runtime_resume.  It also means that
> pm_request_suspend and pm_request_resume should carry out their jobs
> immediately instead of queuing a work item.  (Unless the current status
> is RPM_SUSPENDING or RPM_RESUMING, which should never happen.)

No problem holding a per struct device lock. I suspect that executing
the callbacks from interrupt context is the most efficient design, but
it may come with interrupt latency side effects.

> Should there be a flag in dev_pm_info to select this behavior?

I'd say that executing the callbacks from process context is enough
for now. This will probably be a good match together with interrupt
threads as well.

Maybe the ARM guys have more advanced requriements?

Cheers,

/ magnus

  parent reply	other threads:[~2009-06-22  6:20 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-13 22:23 [PATCH] " 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 [this message]
2009-06-22  6:43                                 ` Arjan van de Ven
2009-06-22  7:27                                   ` Magnus Damm
2009-06-22 13:49                                     ` 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
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=aec7e5c30906212320v3e3e991fyd028d005675f1e25@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --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=rjw@sisk.pl \
    --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

all inboxes | Powered by JetHome®