From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Alan Stern <stern@rowland.harvard.edu>
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: Mon, 21 Nov 2011 22:23:15 +0100 [thread overview]
Message-ID: <201111212223.15878.rjw@sisk.pl> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1111211552450.1848-100000@iolanthe.rowland.org>
On Monday, November 21, 2011, Alan Stern wrote:
> On Mon, 21 Nov 2011, Rafael J. Wysocki wrote:
>
> > > > * @freeze: Hibernation-specific, executed before creating a hibernation image.
> > > > - * Quiesce operations so that a consistent image can be created, but do NOT
> > > > - * otherwise put the device into a low power device state and do NOT emit
> > > > - * system wakeup events. Save in main memory the device settings to be
> > > > - * used by @restore() during the subsequent resume from hibernation or by
> > > > - * the subsequent @thaw(), if the creation of the image or the restoration
> > > > - * of main memory contents from it fails.
> > > > + * Analogous to @suspend(), but it should not enable the device to signal
> > > > + * wakeup events. The majority of subsystems (with the notable exception
> > > > + * of the PCI bus type) expect the driver-level @freeze() to save the
> > > > + * device settings in memory to be used by @restore() during the subsequent
> > > > + * resume from hibernation.
> > > > + * Subsystem-level @freeze() is executed for all devices after invoking
> > > > + * subsystem-level @prepare() for all of them.
> > >
> > > The first three lines you removed contain some important points which I
> > > think should be retained.
> >
> > Well, not really, because in fact what the callback is supposed to do depends
> > on the subsystem. For example, on PCI freeze is not supposed to save the
> > the device state even and generally those routines don't emit any events.
>
> But you removed the part saying that the freeze callback should quiesce
> the device but doesn't necessarily have to put the device into a
> low-power state (in fact, it should avoid changing the power state if
> possible). And you removed the explanation that this is needed in
> order to guarantee a consistent memory image. These two points are
> true for all subsystems, including PCI.
I said "Analogous to @suspend()" instead. I'm not sure why this is not
sufficient?
> > > > @@ -174,29 +198,32 @@ typedef struct pm_message {
> > > > * their children.
> > > > *
> > > > * It is allowed to unregister devices while the above callbacks are being
> > > > - * executed. However, it is not allowed to unregister a device from within any
> > > > - * of its own callbacks.
> > > > + * executed. However, it is NOT allowed to unregister a device from within any
> > > > + * of its driver's callbacks.
> > >
> > > Please be a little more precise here. If driver D manages two devices,
> > > A and B, then D _is_ allowed to unregister A from within a callback for
> > > B (except if A is an ancestor of B or something like that). It's just
> > > not allowed to unregister B from within a callback for B.
> >
> > I can leave that as is, but devices (or device objects to be precise) don't
> > have any callbacks. Their drivers do.
> >
> > I can add "(unless they are being executed for a different device)" or
> > something like this, but I'm not sure if that makes things any clearer.
>
> "A callback routine must NOT try to unregister the device for which it
> was called, however it may unregister children of that device (for
> example, if it detects that a child was hot-unplugged while the system
> was asleep)."
That sounds good, thanks!
> > Do you know any situation in which that matters?
>
> Not offhand, but I'm not familiar with too many subsystems.
Well, it seems quite extreme to me to be honest. :-)
Thanks,
Rafael
next prev parent reply other threads:[~2011-11-21 21:20 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 [this message]
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
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=201111212223.15878.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--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®