From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Ming Lei <tom.leiming@gmail.com>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Randy Dunlap <rdunlap@xenotime.net>
Subject: Re: [PATCH 5] PM: Update comments describing device power management callbacks
Date: Tue, 22 Nov 2011 21:41:41 +0100 [thread overview]
Message-ID: <201111222141.41841.rjw@sisk.pl> (raw)
In-Reply-To: <CACVXFVNiCuQdXmjM9meO+Rcf6g8WnV10-wmxsOCwYuwuMfXUAA@mail.gmail.com>
On Tuesday, November 22, 2011, Ming Lei wrote:
> Hi,
>
> On Mon, Nov 21, 2011 at 7:38 AM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > From: Rafael J. Wysocki <rjw@sisk.pl>
>
> > * @prepare: Prepare the device for the upcoming transition, but do NOT change
> > * its hardware state. Prevent new children of the device from being
> > @@ -71,101 +78,118 @@ typedef struct pm_message {
> > * probe method from being made too once @prepare() has succeeded). If
> > * @prepare() detects a situation it cannot handle (e.g. registration of a
> > * child already in progress), it may return -EAGAIN, so that the PM core
> > - * can execute it once again (e.g. after the new child has been registered)
> > + * can execute it once again (e.g. after a new child has been registered)
> > * to recover from the race condition. This method is executed for all
> > * kinds of suspend transitions and is followed by one of the suspend
> > * callbacks: @suspend(), @freeze(), or @poweroff().
> > - * The PM core executes @prepare() for all devices before starting to
> > - * execute suspend callbacks for any of them, so drivers may assume all of
> > - * the other devices to be present and functional while @prepare() is being
> > - * executed. In particular, it is safe to make GFP_KERNEL memory
> > - * allocations from within @prepare(). However, drivers may NOT assume
> > - * anything about the availability of the user space at that time and it
> > - * is not correct to request firmware from within @prepare() (it's too
> > - * late to do that). [To work around this limitation, drivers may
> > - * register suspend and hibernation notifiers that are executed before the
> > + * The PM core executes subsystem-level @prepare() for all devices before
> > + * starting to execute suspend callbacks for any of them, so all devices
> > + * may be assumed to be present and functional while @prepare() is being
>
> Devices aren't functional in runtime suspend state, so maybe the word of
> 'functional' should be removed.
That's kind of complicated, see below.
> > + * executed. However, device drivers may NOT assume anything about the
> > + * availability of user space at that time and it is NOT valid to request
> > + * firmware from within @prepare() (it's too late to do that). It also is
> > + * NOT valid to allocate substantial amounts of memory from @prepare() in
> > + * the GFP_KERNEL mode. [To work around these limitations, drivers may
> > + * register suspend and hibernation notifiers to be executed before the
> > * freezing of tasks.]
>
>
> > * @resume: Executed after waking the system up from a sleep state in which the
> > - * contents of main memory were preserved. Put the device into the
> > - * appropriate state, according to the information saved in memory by the
> > - * preceding @suspend(). The driver starts working again, responding to
> > - * hardware events and software requests. The hardware may have gone
> > - * through a power-off reset, or it may have maintained state from the
> > - * previous suspend() which the driver may rely on while resuming. On most
> > - * platforms, there are no restrictions on availability of resources like
> > - * clocks during @resume().
> > + * contents of main memory were preserved. Undo the changes made by
> > + * the preceding @suspend() and cause the device to become operational
>
> The device may still not be operational if it was runtime suspended
> before running @suspend().
That's correct, but at the same time it's not 100% clear what @resume should
do with devices that have been runtime-suspended before system suspend.
For example, it may depend on what power configuration the device is in
(it may be a member of a power domain that was off before the system suspend or
something like this).
I'm starting to think that it might be better to simply remove those comments
altogether. :-)
Thanks,
Rafael
prev parent reply other threads:[~2011-11-22 20:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-20 0:53 [PATCH 0/3] PM: Documentation updates Rafael J. Wysocki
2011-11-20 0:54 ` [PATCH 1/3] PM / Domains: Document how PM domains are used by the PM core Rafael J. Wysocki
2011-11-20 0:56 ` [PATCH 2/3] PM / Sleep: Correct inaccurate information in devices.txt Rafael J. Wysocki
2011-11-20 0:56 ` [PATCH 3/3] PM / Runtime: Make documentation follow the new behavior of irq_safe Rafael J. Wysocki
2011-11-20 10:13 ` [PATCH 4] Rafael J. Wysocki
2011-11-20 23:38 ` [PATCH 5] PM: Update comments describing device power management callbacks Rafael J. Wysocki
2011-11-21 2:56 ` Alan Stern
2011-11-21 20:02 ` Rafael J. Wysocki
2011-11-21 21:03 ` Alan Stern
2011-11-21 21:23 ` Rafael J. Wysocki
2011-11-21 21:49 ` Alan Stern
2011-11-21 21:57 ` Rafael J. Wysocki
2011-11-21 22:23 ` Alan Stern
2011-11-21 22:33 ` Rafael J. Wysocki
2011-11-22 15:57 ` Alan Stern
2011-11-22 20:47 ` Rafael J. Wysocki
2011-11-22 21:02 ` Alan Stern
2011-11-22 23:40 ` Rafael J. Wysocki
2011-11-23 16:28 ` Alan Stern
2011-11-23 20:01 ` Rafael J. Wysocki
2011-11-22 3:36 ` Ming Lei
2011-11-22 20:41 ` Rafael J. Wysocki [this message]
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=201111222141.41841.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=tom.leiming@gmail.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 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.