aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-08-12 20:54:04 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-08-12 20:54:04 -0400
commit947d2c2cd3340d11a1737d3f4781170cc3a4b74f (patch)
treea0a21bb89fad010a7fba3c0e99da85a117a4d1ef
parent62822e2ec4ad091ba31f823f577ef80db52e3c2c (diff)
PM / sleep: Update some system sleep documentation
Update some documentation related to system sleep to document new features and remove outdated information from it. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Chen Yu <yu.c.chen@intel.com>
-rw-r--r--Documentation/power/basic-pm-debugging.txt27
-rw-r--r--Documentation/power/interface.txt151
2 files changed, 102 insertions, 76 deletions
diff --git a/Documentation/power/basic-pm-debugging.txt b/Documentation/power/basic-pm-debugging.txt
index b96098ccfe69..708f87f78a75 100644
--- a/Documentation/power/basic-pm-debugging.txt
+++ b/Documentation/power/basic-pm-debugging.txt
@@ -164,7 +164,32 @@ load n/2 modules more and try again.
164Again, if you find the offending module(s), it(they) must be unloaded every time 164Again, if you find the offending module(s), it(they) must be unloaded every time
165before hibernation, and please report the problem with it(them). 165before hibernation, and please report the problem with it(them).
166 166
167c) Advanced debugging 167c) Using the "test_resume" hibernation option
168
169/sys/power/disk generally tells the kernel what to do after creating a
170hibernation image. One of the available options is "test_resume" which
171causes the just created image to be used for immediate restoration. Namely,
172after doing:
173
174# echo test_resume > /sys/power/disk
175# echo disk > /sys/power/state
176
177a hibernation image will be created and a resume from it will be triggered
178immediately without involving the platform firmware in any way.
179
180That test can be used to check if failures to resume from hibernation are
181related to bad interactions with the platform firmware. That is, if the above
182works every time, but resume from actual hibernation does not work or is
183unreliable, the platform firmware may be responsible for the failures.
184
185On architectures and platforms that support using different kernels to restore
186hibernation images (that is, the kernel used to read the image from storage and
187load it into memory is different from the one included in the image) or support
188kernel address space randomization, it also can be used to check if failures
189to resume may be related to the differences between the restore and image
190kernels.
191
192d) Advanced debugging
168 193
169In case that hibernation does not work on your system even in the minimal 194In case that hibernation does not work on your system even in the minimal
170configuration and compiling more drivers as modules is not practical or some 195configuration and compiling more drivers as modules is not practical or some
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt
index f1f0f59a7c47..974916ff6608 100644
--- a/Documentation/power/interface.txt
+++ b/Documentation/power/interface.txt
@@ -1,75 +1,76 @@
1Power Management Interface 1Power Management Interface for System Sleep
2 2
3 3Copyright (c) 2016 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
4The power management subsystem provides a unified sysfs interface to 4
5userspace, regardless of what architecture or platform one is 5The power management subsystem provides userspace with a unified sysfs interface
6running. The interface exists in /sys/power/ directory (assuming sysfs 6for system sleep regardless of the underlying system architecture or platform.
7is mounted at /sys). 7The interface is located in the /sys/power/ directory (assuming that sysfs is
8 8mounted at /sys).
9/sys/power/state controls system power state. Reading from this file 9
10returns what states are supported, which is hard-coded to 'freeze', 10/sys/power/state is the system sleep state control file.
11'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk' 11
12(Suspend-to-Disk). 12Reading from it returns a list of supported sleep states, encoded as:
13 13
14Writing to this file one of those strings causes the system to 14'freeze' (Suspend-to-Idle)
15transition into that state. Please see the file 15'standby' (Power-On Suspend)
16Documentation/power/states.txt for a description of each of those 16'mem' (Suspend-to-RAM)
17states. 17'disk' (Suspend-to-Disk)
18 18
19 19Suspend-to-Idle is always supported. Suspend-to-Disk is always supported
20/sys/power/disk controls the operating mode of the suspend-to-disk 20too as long the kernel has been configured to support hibernation at all
21mechanism. Suspend-to-disk can be handled in several ways. We have a 21(ie. CONFIG_HIBERNATION is set in the kernel configuration file). Support
22few options for putting the system to sleep - using the platform driver 22for Suspend-to-RAM and Power-On Suspend depends on the capabilities of the
23(e.g. ACPI or other suspend_ops), powering off the system or rebooting the 23platform.
24system (for testing). 24
25 25If one of the strings listed in /sys/power/state is written to it, the system
26Additionally, /sys/power/disk can be used to turn on one of the two testing 26will attempt to transition into the corresponding sleep state. Refer to
27modes of the suspend-to-disk mechanism: 'testproc' or 'test'. If the 27Documentation/power/states.txt for a description of each of those states.
28suspend-to-disk mechanism is in the 'testproc' mode, writing 'disk' to 28
29/sys/power/state will cause the kernel to disable nonboot CPUs and freeze 29/sys/power/disk controls the operating mode of hibernation (Suspend-to-Disk).
30tasks, wait for 5 seconds, unfreeze tasks and enable nonboot CPUs. If it is 30Specifically, it tells the kernel what to do after creating a hibernation image.
31in the 'test' mode, writing 'disk' to /sys/power/state will cause the kernel 31
32to disable nonboot CPUs and freeze tasks, shrink memory, suspend devices, wait 32Reading from it returns a list of supported options encoded as:
33for 5 seconds, resume devices, unfreeze tasks and enable nonboot CPUs. Then, 33
34we are able to look in the log messages and work out, for example, which code 34'platform' (put the system into sleep using a platform-provided method)
35is being slow and which device drivers are misbehaving. 35'shutdown' (shut the system down)
36 36'reboot' (reboot the system)
37Reading from this file will display all supported modes and the currently 37'suspend' (trigger a Suspend-to-RAM transition)
38selected one in brackets, for example 38'test_resume' (resume-after-hibernation test mode)
39 39
40 [shutdown] reboot test testproc 40The currently selected option is printed in square brackets.
41 41
42Writing to this file will accept one of 42The 'platform' option is only available if the platform provides a special
43 43mechanism to put the system to sleep after creating a hibernation image (ACPI
44 'platform' (only if the platform supports it) 44does that, for example). The 'suspend' option is available if Suspend-to-RAM
45 'shutdown' 45is supported. Refer to Documentation/power/basic_pm_debugging.txt for the
46 'reboot' 46description of the 'test_resume' option.
47 'testproc' 47
48 'test' 48To select an option, write the string representing it to /sys/power/disk.
49 49
50/sys/power/image_size controls the size of the image created by 50/sys/power/image_size controls the size of hibernation images.
51the suspend-to-disk mechanism. It can be written a string 51
52representing a non-negative integer that will be used as an upper 52It can be written a string representing a non-negative integer that will be
53limit of the image size, in bytes. The suspend-to-disk mechanism will 53used as a best-effort upper limit of the image size, in bytes. The hibernation
54do its best to ensure the image size will not exceed that number. However, 54core will do its best to ensure that the image size will not exceed that number.
55if this turns out to be impossible, it will try to suspend anyway using the 55However, if that turns out to be impossible to achieve, a hibernation image will
56smallest image possible. In particular, if "0" is written to this file, the 56still be created and its size will be as small as possible. In particular,
57suspend image will be as small as possible. 57writing '0' to this file will enforce hibernation images to be as small as
58 58possible.
59Reading from this file will display the current image size limit, which 59
60is set to 2/5 of available RAM by default. 60Reading from this file returns the current image size limit, which is set to
61 61around 2/5 of available RAM by default.
62/sys/power/pm_trace controls the code which saves the last PM event point in 62
63the RTC across reboots, so that you can debug a machine that just hangs 63/sys/power/pm_trace controls the PM trace mechanism saving the last suspend
64during suspend (or more commonly, during resume). Namely, the RTC is only 64or resume event point in the RTC across reboots.
65used to save the last PM event point if this file contains '1'. Initially it 65
66contains '0' which may be changed to '1' by writing a string representing a 66It helps to debug hard lockups or reboots due to device driver failures that
67nonzero integer into it. 67occur during system suspend or resume (which is more common) more effectively.
68 68
69To use this debugging feature you should attempt to suspend the machine, then 69If /sys/power/pm_trace contains '1', the fingerprint of each suspend/resume
70reboot it and run 70event point in turn will be stored in the RTC memory (overwriting the actual
71 71RTC information), so it will survive a system crash if one occurs right after
72 dmesg -s 1000000 | grep 'hash matches' 72storing it and it can be used later to identify the driver that caused the crash
73 73to happen (see Documentation/power/s2ram.txt for more information).
74CAUTION: Using it will cause your machine's real-time (CMOS) clock to be 74
75set to a random invalid time after a resume. 75Initially it contains '0' which may be changed to '1' by writing a string
76representing a nonzero integer into it.