@@ -153,18 +153,21 @@ for the given CPU architecture includes the low-level code for system resume.
153153Basic ``sysfs `` Interfaces for System Suspend and Hibernation
154154=============================================================
155155
156- The following files located in the :file: `/sys/power/ ` directory can be used by
157- user space for sleep states control.
156+ The power management subsystem provides userspace with a unified ``sysfs ``
157+ interface for system sleep regardless of the underlying system architecture or
158+ platform. That interface is located in the :file: `/sys/power/ ` directory
159+ (assuming that ``sysfs `` is mounted at :file: `/sys `) and it consists of the
160+ following attributes (files):
158161
159162``state ``
160163 This file contains a list of strings representing sleep states supported
161164 by the kernel. Writing one of these strings into it causes the kernel
162165 to start a transition of the system into the sleep state represented by
163166 that string.
164167
165- In particular, the strings "disk", "freeze" and "standby" represent the
168+ In particular, the "disk", "freeze" and "standby" strings represent the
166169 :ref: `hibernation <hibernation >`, :ref: `suspend-to-idle <s2idle >` and
167- :ref: `standby <standby >` sleep states, respectively. The string "mem"
170+ :ref: `standby <standby >` sleep states, respectively. The "mem" string
168171 is interpreted in accordance with the contents of the ``mem_sleep `` file
169172 described below.
170173
@@ -177,30 +180,37 @@ user space for sleep states control.
177180 associated with the "mem" string in the ``state `` file described above.
178181
179182 The strings that may be present in this file are "s2idle", "shallow"
180- and "deep". The string "s2idle" always represents :ref: `suspend-to-idle
183+ and "deep". The "s2idle" string always represents :ref: `suspend-to-idle
181184 <s2idle>` and, by convention, "shallow" and "deep" represent
182185 :ref: `standby <standby >` and :ref: `suspend-to-RAM <s2ram >`,
183186 respectively.
184187
185188 Writing one of the listed strings into this file causes the system
186189 suspend variant represented by it to be associated with the "mem" string
187190 in the ``state `` file. The string representing the suspend variant
188- currently associated with the "mem" string in the ``state `` file
189- is listed in square brackets.
191+ currently associated with the "mem" string in the ``state `` file is
192+ shown in square brackets.
190193
191194 If the kernel does not support system suspend, this file is not present.
192195
193196``disk ``
194- This file contains a list of strings representing different operations
195- that can be carried out after the hibernation image has been saved. The
196- possible options are as follows:
197+ This file controls the operating mode of hibernation (Suspend-to-Disk).
198+ Specifically, it tells the kernel what to do after creating a
199+ hibernation image.
200+
201+ Reading from it returns a list of supported options encoded as:
197202
198203 ``platform ``
199204 Put the system into a special low-power state (e.g. ACPI S4) to
200205 make additional wakeup options available and possibly allow the
201206 platform firmware to take a simplified initialization path after
202207 wakeup.
203208
209+ It is only available if the platform provides a special
210+ mechanism to put the system to sleep after creating a
211+ hibernation image (platforms with ACPI do that as a rule, for
212+ example).
213+
204214 ``shutdown ``
205215 Power off the system.
206216
@@ -214,22 +224,53 @@ user space for sleep states control.
214224 the hibernation image and continue. Otherwise, use the image
215225 to restore the previous state of the system.
216226
227+ It is available if system suspend is supported.
228+
217229 ``test_resume ``
218230 Diagnostic operation. Load the image as though the system had
219231 just woken up from hibernation and the currently running kernel
220232 instance was a restore kernel and follow up with full system
221233 resume.
222234
223- Writing one of the listed strings into this file causes the option
235+ Writing one of the strings listed above into this file causes the option
224236 represented by it to be selected.
225237
226- The currently selected option is shown in square brackets which means
238+ The currently selected option is shown in square brackets, which means
227239 that the operation represented by it will be carried out after creating
228- and saving the image next time hibernation is triggered by writing
229- `` disk `` to :file: `/sys/power/state `.
240+ and saving the image when hibernation is triggered by writing `` disk ``
241+ to :file: `/sys/power/state `.
230242
231243 If the kernel does not support hibernation, this file is not present.
232244
245+ ``image_size ``
246+ This file controls the size of hibernation images.
247+
248+ It can be written a string representing a non-negative integer that will
249+ be used as a best-effort upper limit of the image size, in bytes. The
250+ hibernation core will do its best to ensure that the image size will not
251+ exceed that number, but if that turns out to be impossible to achieve, a
252+ hibernation image will still be created and its size will be as small as
253+ possible. In particular, writing '0' to this file causes the size of
254+ hibernation images to be minimum.
255+
256+ Reading from it returns the current image size limit, which is set to
257+ around 2/5 of the available RAM size by default.
258+
259+ ``pm_trace ``
260+ This file controls the "PM trace" mechanism saving the last suspend
261+ or resume event point in the RTC memory across reboots. It helps to
262+ debug hard lockups or reboots due to device driver failures that occur
263+ during system suspend or resume (which is more common) more effectively.
264+
265+ If it contains "1", the fingerprint of each suspend/resume event point
266+ in turn will be stored in the RTC memory (overwriting the actual RTC
267+ information), so it will survive a system crash if one occurs right
268+ after storing it and it can be used later to identify the driver that
269+ caused the crash to happen.
270+
271+ It contains "0" by default, which may be changed to "1" by writing a
272+ string representing a nonzero integer into it.
273+
233274According to the above, there are two ways to make the system go into the
234275:ref: `suspend-to-idle <s2idle >` state. The first one is to write "freeze"
235276directly to :file: `/sys/power/state `. The second one is to write "s2idle" to
@@ -244,6 +285,7 @@ system go into the :ref:`suspend-to-RAM <s2ram>` state (write "deep" into
244285The default suspend variant (ie. the one to be used without writing anything
245286into :file: `/sys/power/mem_sleep `) is either "deep" (on the majority of systems
246287supporting :ref: `suspend-to-RAM <s2ram >`) or "s2idle", but it can be overridden
247- by the value of the "mem_sleep_default" parameter in the kernel command line.
248- On some ACPI-based systems, depending on the information in the ACPI tables, the
249- default may be "s2idle" even if :ref: `suspend-to-RAM <s2ram >` is supported.
288+ by the value of the ``mem_sleep_default `` parameter in the kernel command line.
289+ On some systems with ACPI, depending on the information in the ACPI tables, the
290+ default may be "s2idle" even if :ref: `suspend-to-RAM <s2ram >` is supported in
291+ principle.
0 commit comments