diff options
Diffstat (limited to 'Documentation/power')
-rw-r--r-- | Documentation/power/basic-pm-debugging.txt | 106 | ||||
-rw-r--r-- | Documentation/power/drivers-testing.txt | 42 | ||||
-rw-r--r-- | Documentation/power/interface.txt | 8 | ||||
-rw-r--r-- | Documentation/power/pci.txt | 2 | ||||
-rw-r--r-- | Documentation/power/swsusp.txt | 2 | ||||
-rw-r--r-- | Documentation/power/userland-swsusp.txt | 26 |
6 files changed, 170 insertions, 16 deletions
diff --git a/Documentation/power/basic-pm-debugging.txt b/Documentation/power/basic-pm-debugging.txt new file mode 100644 index 000000000000..1a85e2b964dc --- /dev/null +++ b/Documentation/power/basic-pm-debugging.txt | |||
@@ -0,0 +1,106 @@ | |||
1 | Debugging suspend and resume | ||
2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | ||
3 | |||
4 | 1. Testing suspend to disk (STD) | ||
5 | |||
6 | To verify that the STD works, you can try to suspend in the "reboot" mode: | ||
7 | |||
8 | # echo reboot > /sys/power/disk | ||
9 | # echo disk > /sys/power/state | ||
10 | |||
11 | and the system should suspend, reboot, resume and get back to the command prompt | ||
12 | where you have started the transition. If that happens, the STD is most likely | ||
13 | to work correctly, but you need to repeat the test at least a couple of times in | ||
14 | a row for confidence. This is necessary, because some problems only show up on | ||
15 | a second attempt at suspending and resuming the system. You should also test | ||
16 | the "platform" and "shutdown" modes of suspend: | ||
17 | |||
18 | # echo platform > /sys/power/disk | ||
19 | # echo disk > /sys/power/state | ||
20 | |||
21 | or | ||
22 | |||
23 | # echo shutdown > /sys/power/disk | ||
24 | # echo disk > /sys/power/state | ||
25 | |||
26 | in which cases you will have to press the power button to make the system | ||
27 | resume. If that does not work, you will need to identify what goes wrong. | ||
28 | |||
29 | a) Test mode of STD | ||
30 | |||
31 | To verify if there are any drivers that cause problems you can run the STD | ||
32 | in the test mode: | ||
33 | |||
34 | # echo test > /sys/power/disk | ||
35 | # echo disk > /sys/power/state | ||
36 | |||
37 | in which case the system should freeze tasks, suspend devices, disable nonboot | ||
38 | CPUs (if any), wait for 5 seconds, enable nonboot CPUs, resume devices, thaw | ||
39 | tasks and return to your command prompt. If that fails, most likely there is | ||
40 | a driver that fails to either suspend or resume (in the latter case the system | ||
41 | may hang or be unstable after the test, so please take that into consideration). | ||
42 | To find this driver, you can carry out a binary search according to the rules: | ||
43 | - if the test fails, unload a half of the drivers currently loaded and repeat | ||
44 | (that would probably involve rebooting the system, so always note what drivers | ||
45 | have been loaded before the test), | ||
46 | - if the test succeeds, load a half of the drivers you have unloaded most | ||
47 | recently and repeat. | ||
48 | |||
49 | Once you have found the failing driver (there can be more than just one of | ||
50 | them), you have to unload it every time before the STD transition. In that case | ||
51 | please make sure to report the problem with the driver. | ||
52 | |||
53 | It is also possible that a cycle can still fail after you have unloaded | ||
54 | all modules. In that case, you would want to look in your kernel configuration | ||
55 | for the drivers that can be compiled as modules (testing again with them as | ||
56 | modules), and possibly also try boot time options such as "noapic" or "noacpi". | ||
57 | |||
58 | b) Testing minimal configuration | ||
59 | |||
60 | If the test mode of STD works, you can boot the system with "init=/bin/bash" | ||
61 | and attempt to suspend in the "reboot", "shutdown" and "platform" modes. If | ||
62 | that does not work, there probably is a problem with a driver statically | ||
63 | compiled into the kernel and you can try to compile more drivers as modules, | ||
64 | so that they can be tested individually. Otherwise, there is a problem with a | ||
65 | modular driver and you can find it by loading a half of the modules you normally | ||
66 | use and binary searching in accordance with the algorithm: | ||
67 | - if there are n modules loaded and the attempt to suspend and resume fails, | ||
68 | unload n/2 of the modules and try again (that would probably involve rebooting | ||
69 | the system), | ||
70 | - if there are n modules loaded and the attempt to suspend and resume succeeds, | ||
71 | load n/2 modules more and try again. | ||
72 | |||
73 | Again, if you find the offending module(s), it(they) must be unloaded every time | ||
74 | before the STD transition, and please report the problem with it(them). | ||
75 | |||
76 | c) Advanced debugging | ||
77 | |||
78 | In case the STD does not work on your system even in the minimal configuration | ||
79 | and compiling more drivers as modules is not practical or some modules cannot | ||
80 | be unloaded, you can use one of the more advanced debugging techniques to find | ||
81 | the problem. First, if there is a serial port in your box, you can set the | ||
82 | CONFIG_DISABLE_CONSOLE_SUSPEND kernel configuration option and try to log kernel | ||
83 | messages using the serial console. This may provide you with some information | ||
84 | about the reasons of the suspend (resume) failure. Alternatively, it may be | ||
85 | possible to use a FireWire port for debugging with firescope | ||
86 | (ftp://ftp.firstfloor.org/pub/ak/firescope/). On i386 it is also possible to | ||
87 | use the PM_TRACE mechanism documented in Documentation/s2ram.txt . | ||
88 | |||
89 | 2. Testing suspend to RAM (STR) | ||
90 | |||
91 | To verify that the STR works, it is generally more convenient to use the s2ram | ||
92 | tool available from http://suspend.sf.net and documented at | ||
93 | http://en.opensuse.org/s2ram . However, before doing that it is recommended to | ||
94 | carry out the procedure described in section 1. | ||
95 | |||
96 | Assume you have resolved the problems with the STD and you have found some | ||
97 | failing drivers. These drivers are also likely to fail during the STR or | ||
98 | during the resume, so it is better to unload them every time before the STR | ||
99 | transition. Now, you can follow the instructions at | ||
100 | http://en.opensuse.org/s2ram to test the system, but if it does not work | ||
101 | "out of the box", you may need to boot it with "init=/bin/bash" and test | ||
102 | s2ram in the minimal configuration. In that case, you may be able to search | ||
103 | for failing drivers by following the procedure analogous to the one described in | ||
104 | 1b). If you find some failing drivers, you will have to unload them every time | ||
105 | before the STR transition (ie. before you run s2ram), and please report the | ||
106 | problems with them. | ||
diff --git a/Documentation/power/drivers-testing.txt b/Documentation/power/drivers-testing.txt new file mode 100644 index 000000000000..33016c2f18dd --- /dev/null +++ b/Documentation/power/drivers-testing.txt | |||
@@ -0,0 +1,42 @@ | |||
1 | Testing suspend and resume support in device drivers | ||
2 | (C) 2007 Rafael J. Wysocki <rjw@sisk.pl>, GPL | ||
3 | |||
4 | 1. Preparing the test system | ||
5 | |||
6 | Unfortunately, to effectively test the support for the system-wide suspend and | ||
7 | resume transitions in a driver, it is necessary to suspend and resume a fully | ||
8 | functional system with this driver loaded. Moreover, that should be done | ||
9 | several times, preferably several times in a row, and separately for the suspend | ||
10 | to disk (STD) and the suspend to RAM (STR) transitions, because each of these | ||
11 | cases involves different ordering of operations and different interactions with | ||
12 | the machine's BIOS. | ||
13 | |||
14 | Of course, for this purpose the test system has to be known to suspend and | ||
15 | resume without the driver being tested. Thus, if possible, you should first | ||
16 | resolve all suspend/resume-related problems in the test system before you start | ||
17 | testing the new driver. Please see Documents/power/basic-pm-debugging.txt for | ||
18 | more information about the debugging of suspend/resume functionality. | ||
19 | |||
20 | 2. Testing the driver | ||
21 | |||
22 | Once you have resolved the suspend/resume-related problems with your test system | ||
23 | without the new driver, you are ready to test it: | ||
24 | |||
25 | a) Build the driver as a module, load it and try the STD in the test mode (see: | ||
26 | Documents/power/basic-pm-debugging.txt, 1a)). | ||
27 | |||
28 | b) Load the driver and attempt to suspend to disk in the "reboot", "shutdown" | ||
29 | and "platform" modes (see: Documents/power/basic-pm-debugging.txt, 1). | ||
30 | |||
31 | c) Compile the driver directly into the kernel and try the STD in the test mode. | ||
32 | |||
33 | d) Attempt to suspend to disk with the driver compiled directly into the kernel | ||
34 | in the "reboot", "shutdown" and "platform" modes. | ||
35 | |||
36 | e) Attempt to suspend to RAM using the s2ram tool with the driver loaded (see: | ||
37 | Documents/power/basic-pm-debugging.txt, 2). As far as the STR tests are | ||
38 | concerned, it should not matter whether or not the driver is built as a module. | ||
39 | |||
40 | Each of the above tests should be repeated several times and the STD tests | ||
41 | should be mixed with the STR tests. If any of them fails, the driver cannot be | ||
42 | regarded as suspend/resume-safe. | ||
diff --git a/Documentation/power/interface.txt b/Documentation/power/interface.txt index 8c5b41bf3f36..fd5192a8fa8a 100644 --- a/Documentation/power/interface.txt +++ b/Documentation/power/interface.txt | |||
@@ -34,8 +34,12 @@ for 5 seconds, resume devices, unfreeze tasks and enable nonboot CPUs. Then, | |||
34 | we are able to look in the log messages and work out, for example, which code | 34 | we are able to look in the log messages and work out, for example, which code |
35 | is being slow and which device drivers are misbehaving. | 35 | is being slow and which device drivers are misbehaving. |
36 | 36 | ||
37 | Reading from this file will display what the mode is currently set | 37 | Reading from this file will display all supported modes and the currently |
38 | to. Writing to this file will accept one of | 38 | selected one in brackets, for example |
39 | |||
40 | [shutdown] reboot test testproc | ||
41 | |||
42 | Writing to this file will accept one of | ||
39 | 43 | ||
40 | 'platform' (only if the platform supports it) | 44 | 'platform' (only if the platform supports it) |
41 | 'shutdown' | 45 | 'shutdown' |
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt index b6a3cbf7e846..e00b099a4b86 100644 --- a/Documentation/power/pci.txt +++ b/Documentation/power/pci.txt | |||
@@ -203,7 +203,7 @@ resume | |||
203 | 203 | ||
204 | Usage: | 204 | Usage: |
205 | 205 | ||
206 | if (dev->driver && dev->driver->suspend) | 206 | if (dev->driver && dev->driver->resume) |
207 | dev->driver->resume(dev) | 207 | dev->driver->resume(dev) |
208 | 208 | ||
209 | The resume callback may be called from any power state, and is always meant to | 209 | The resume callback may be called from any power state, and is always meant to |
diff --git a/Documentation/power/swsusp.txt b/Documentation/power/swsusp.txt index c55bd5079b90..5b8d6953f05e 100644 --- a/Documentation/power/swsusp.txt +++ b/Documentation/power/swsusp.txt | |||
@@ -48,7 +48,7 @@ before suspend (it is limited to 500 MB by default). | |||
48 | 48 | ||
49 | Article about goals and implementation of Software Suspend for Linux | 49 | Article about goals and implementation of Software Suspend for Linux |
50 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | 50 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
51 | Author: G‚ábor Kuti | 51 | Author: G‚ábor Kuti |
52 | Last revised: 2003-10-20 by Pavel Machek | 52 | Last revised: 2003-10-20 by Pavel Machek |
53 | 53 | ||
54 | Idea and goals to achieve | 54 | Idea and goals to achieve |
diff --git a/Documentation/power/userland-swsusp.txt b/Documentation/power/userland-swsusp.txt index 000556c932e9..e00c6cf09e85 100644 --- a/Documentation/power/userland-swsusp.txt +++ b/Documentation/power/userland-swsusp.txt | |||
@@ -93,21 +93,23 @@ SNAPSHOT_S2RAM - suspend to RAM; using this call causes the kernel to | |||
93 | to resume the system from RAM if there's enough battery power or restore | 93 | to resume the system from RAM if there's enough battery power or restore |
94 | its state on the basis of the saved suspend image otherwise) | 94 | its state on the basis of the saved suspend image otherwise) |
95 | 95 | ||
96 | SNAPSHOT_PMOPS - enable the usage of the pmops->prepare, pmops->enter and | 96 | SNAPSHOT_PMOPS - enable the usage of the hibernation_ops->prepare, |
97 | pmops->finish methods (the in-kernel swsusp knows these as the "platform | 97 | hibernate_ops->enter and hibernation_ops->finish methods (the in-kernel |
98 | method") which are needed on many machines to (among others) speed up | 98 | swsusp knows these as the "platform method") which are needed on many |
99 | the resume by letting the BIOS skip some steps or to let the system | 99 | machines to (among others) speed up the resume by letting the BIOS skip |
100 | recognise the correct state of the hardware after the resume (in | 100 | some steps or to let the system recognise the correct state of the |
101 | particular on many machines this ensures that unplugged AC | 101 | hardware after the resume (in particular on many machines this ensures |
102 | adapters get correctly detected and that kacpid does not run wild after | 102 | that unplugged AC adapters get correctly detected and that kacpid does |
103 | the resume). The last ioctl() argument can take one of the three | 103 | not run wild after the resume). The last ioctl() argument can take one |
104 | values, defined in kernel/power/power.h: | 104 | of the three values, defined in kernel/power/power.h: |
105 | PMOPS_PREPARE - make the kernel carry out the | 105 | PMOPS_PREPARE - make the kernel carry out the |
106 | pm_ops->prepare(PM_SUSPEND_DISK) operation | 106 | hibernation_ops->prepare() operation |
107 | PMOPS_ENTER - make the kernel power off the system by calling | 107 | PMOPS_ENTER - make the kernel power off the system by calling |
108 | pm_ops->enter(PM_SUSPEND_DISK) | 108 | hibernation_ops->enter() |
109 | PMOPS_FINISH - make the kernel carry out the | 109 | PMOPS_FINISH - make the kernel carry out the |
110 | pm_ops->finish(PM_SUSPEND_DISK) operation | 110 | hibernation_ops->finish() operation |
111 | Note that the actual constants are misnamed because they surface | ||
112 | internal kernel implementation details that have changed. | ||
111 | 113 | ||
112 | The device's read() operation can be used to transfer the snapshot image from | 114 | The device's read() operation can be used to transfer the snapshot image from |
113 | the kernel. It has the following limitations: | 115 | the kernel. It has the following limitations: |