login
Header Space

 
 

Separating Suspend and Hibernation

April 8, 2008 - 1:39pm
Submitted by Jeremy on April 8, 2008 - 1:39pm.
Linux news

"The following three patches are intended to start the redesign of the suspend and hibernation framework for devices," began Rafael Wysocki. He noted that the first patch introduces new callbacks for suspend and hibernation, while the other two patches implement the new suspend and hibernation callbacks for the platform and PCI bus types. In describing the first patch in the series, he noted that previous callbacks were being phased out, explaining:

"The main purpose of doing this is to separate suspend (aka S2RAM and standby) callbacks from hibernation callbacks in such a way that the new callbacks won't take arguments and the semantics of each of them will be clearly specified. This has been requested for multiple times by many people, including Linus himself, and the reason is that within the current scheme if ->resume() is called, for example, it's difficult to say why it's been called (ie. is it a resume from RAM or from hibernation or a suspend/hibernation failure etc.?).

"The second purpose is to make the suspend/hibernation callbacks more flexible so that device drivers can handle more than they can within the current scheme. For example, some drivers may need to prevent new children of the device from being registered before their ->suspend() callbacks are executed or they may want to carry out some operations requiring the availability of some other devices, not directly bound via the parent-child relationship, in order to prepare for the execution of ->suspend(), etc."


From: Rafael J. Wysocki <rjw@...>
Subject: [RFC][PATCH 0/3] PM: Rework suspend and hibernation code for devices (rev. 3)
Date: Mar 29, 6:17 pm 2008

Hi,

The following three patches are intended to start the redesign of the suspend
and hibernation framework for devices.

The first one is the 5th revision of the patch introducing new callbacks for
suspend and hibernation.

The other two patches implement the new suspend and hibernation callbacks
for the platform and PCI bus types (3rd revision of both).

The main differences between these patches and the previous revision:
* Dropped 'struct pm_noirq_ops' and introduced 'struct pm_ext_ops' that is a
  derivative of 'struct pm_ops' (adds the _noirq operations).
* Made device_pm_add() refuse to add devices for which
  dev->parent->power.status == DPM_INVALID
* Clarified (hopefully) the new platform and pci driver code

Please review.

Thanks,
Rafael

--

From: Rafael J. Wysocki <rjw@...>

Subject: [RFC][PATCH 1/3] PM: Introduce new top level suspend and hibernation callbacks (rev. 5)
Date: Mar 29, 5:20 pm 2008

From: Rafael J. Wysocki <rjw@sisk.pl>

Introduce 'struct pm_ops' and 'struct pm_ext_ops' representing
suspend and hibernation operations for bus types, device classes and
device types.

Modify the PM core to use 'struct pm_ops' and 'struct pm_ext_ops'

objects, if defined, instead of the ->suspend() and ->resume() or,
respectively, ->suspend_late() and ->resume_early() callbacks that
will be considered as legacy and gradually phased out.

The main purpose of doing this is to separate suspend (aka S2RAM and
standby) callbacks from hibernation callbacks in such a way that the
new callbacks won't take arguments and the semantics of each of them
will be clearly specified.  This has been requested for multiple
times by many people, including Linus himself, and the reason is that
within the current scheme if ->resume() is called, for example, it's
difficult to say why it's been called (ie. is it a resume from RAM or
from hibernation or a suspend/hibernation failure etc.?).

The second purpose is to make the suspend/hibernation callbacks more
flexible so that device drivers can handle more than they can within
the current scheme.  For example, some drivers may need to prevent
new children of the device from being registered before their
->suspend() callbacks are executed or they may want to carry out some
operations requiring the availability of some other devices, not
directly bound via the parent-child relationship, in order to prepare
for the execution of ->suspend(), etc.

Ultimately, we'd like to stop using the freezing of tasks for suspend
and therefore the drivers' suspend/hibernation code will have to take
care of the handling of the user space during suspend/hibernation.
That, in turn, would be difficult within the current scheme, without
the new ->prepare() and ->complete() callbacks.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

---

 arch/x86/kernel/apm_32.c   |    4 
 drivers/base/power/main.c  |  693 ++++++++++++++++++++++++++++++++++-----------
 drivers/base/power/power.h |    2 
 drivers/base/power/trace.c |    4 
 include/linux/device.h     |    9 
 include/linux/pm.h         |  318 ++++++++++++++++++--
 kernel/power/disk.c        |   20 -
 kernel/power/main.c        |    6 
 8 files changed, 857 insertions(+), 199 deletions(-)


about time :D

April 8, 2008 - 2:28pm
turn.self.off (not verified)

about time :D

You mean...

April 8, 2008 - 5:17pm
Anonymous coward (not verified)

You mean it could actually start working and applications could stop behaving? :)

Good news!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary