1 .. SPDX-License-Identifier: GPL-2.0 2 .. include:: <isonum.txt> 3 4 =================== 5 System Sleep States 6 =================== 7 8 :Copyright: |copy| 2017 Intel Corporation 9 10 :Author: Rafael J. Wysocki <rafael.j.wysocki@in 11 12 13 Sleep states are global low-power states of th 14 space code cannot be executed and the overall 15 reduced. 16 17 18 Sleep States That Can Be Supported 19 ================================== 20 21 Depending on its configuration and the capabil 22 the Linux kernel can support up to four system 23 hibernation and up to three variants of system 24 can be supported by the kernel are listed belo 25 26 .. _s2idle: 27 28 Suspend-to-Idle 29 --------------- 30 31 This is a generic, pure software, light-weight 32 referred to as S2I or S2Idle). It allows more 33 runtime idle by freezing user space, suspendin 34 I/O devices into low-power states (possibly lo 35 working state), such that the processors can s 36 states while the system is suspended. 37 38 The system is woken up from this state by in-b 39 any devices that can cause interrupts to be ge 40 also be set up as wakeup devices for S2Idle. 41 42 This state can be used on platforms without su 43 or :ref:`suspend-to-RAM <s2ram>`, or it can be 44 deeper system suspend variants to provide redu 45 supported if the :c:macro:`CONFIG_SUSPEND` ker 46 47 .. _standby: 48 49 Standby 50 ------- 51 52 This state, if supported, offers moderate, but 53 providing a relatively straightforward transit 54 operating state is lost (the system core logic 55 go back to where it left off easily enough. 56 57 In addition to freezing user space, suspending 58 I/O devices into low-power states, which is do 59 <s2idle>` too, nonboot CPUs are taken offline 60 are suspended during transitions into this sta 61 allow more energy to be saved relative to :ref 62 the resume latency will generally be greater t 63 64 The set of devices that can wake up the system 65 reduced relative to :ref:`suspend-to-idle <s2i 66 rely on the platform for setting up the wakeup 67 68 This state is supported if the :c:macro:`CONFI 69 option is set and the support for it is regist 70 core system suspend subsystem. On ACPI-based 71 the S1 system state defined by ACPI. 72 73 .. _s2ram: 74 75 Suspend-to-RAM 76 -------------- 77 78 This state (also referred to as STR or S2RAM), 79 energy savings as everything in the system is 80 for memory, which should be placed into the se 81 contents. All of the steps carried out when e 82 are also carried out during transitions to S2R 83 take place depending on the platform capabilit 84 systems the kernel passes control to the platf 85 step during S2RAM transitions and that usually 86 more low-level components that are not directl 87 88 The state of devices and CPUs is saved and hel 89 suspended and put into low-power states. In m 90 lose power when entering S2RAM, so devices mus 91 back to the "on" state. 92 93 On ACPI-based systems S2RAM requires some mini 94 platform firmware to resume the system from it 95 platforms too. 96 97 The set of devices that can wake up the system 98 relative to :ref:`suspend-to-idle <s2idle>` an 99 may be necessary to rely on the platform for s 100 as appropriate. 101 102 S2RAM is supported if the :c:macro:`CONFIG_SUS 103 is set and the support for it is registered by 104 suspend subsystem. On ACPI-based systems it i 105 defined by ACPI. 106 107 .. _hibernation: 108 109 Hibernation 110 ----------- 111 112 This state (also referred to as Suspend-to-Dis 113 energy savings and can be used even in the abs 114 for system suspend. However, it requires some 115 system to be present for the underlying CPU ar 116 117 Hibernation is significantly different from an 118 It takes three system state changes to put it 119 state changes to resume it. 120 121 First, when hibernation is triggered, the kern 122 creates a snapshot image of memory to be writt 123 the system goes into a state in which the snap 124 is written out and finally the system goes int 125 which power is cut from almost all of its hard 126 except for a limited set of wakeup devices. 127 128 Once the snapshot image has been written out, 129 special low-power state (like ACPI S4), or it 130 Powering down means minimum power draw and it 131 any system. However, entering a special low-p 132 means of system wakeup to be used (e.g. press 133 opening a laptop lid). 134 135 After wakeup, control goes to the platform fir 136 which boots a fresh instance of the kernel (co 137 the boot loader, depending on the system confi 138 a fresh instance of the kernel to be booted). 139 (referred to as the ``restore kernel``) looks 140 persistent storage and if one is found, it is 141 activity in the system is stopped and the rest 142 the image contents and jumps into a special tr 143 kernel stored in the image (referred to as the 144 the special architecture-specific low-level co 145 image kernel restores the system to the pre-hi 146 space to run again. 147 148 Hibernation is supported if the :c:macro:`CONF 149 configuration option is set. However, this op 150 for the given CPU architecture includes the lo 151 152 153 Basic ``sysfs`` Interfaces for System Suspend 154 ============================================== 155 156 The power management subsystem provides usersp 157 interface for system sleep regardless of the u 158 platform. That interface is located in the :f 159 (assuming that ``sysfs`` is mounted at :file:` 160 following attributes (files): 161 162 ``state`` 163 This file contains a list of strings r 164 by the kernel. Writing one of these s 165 to start a transition of the system in 166 that string. 167 168 In particular, the "disk", "freeze" an 169 :ref:`hibernation <hibernation>`, :ref 170 :ref:`standby <standby>` sleep states, 171 is interpreted in accordance with the 172 described below. 173 174 If the kernel does not support any sys 175 not present. 176 177 ``mem_sleep`` 178 This file contains a list of strings r 179 suspend variants and allows user space 180 associated with the "mem" string in th 181 182 The strings that may be present in thi 183 and "deep". The "s2idle" string alway 184 <s2idle>` and, by convention, "shallow 185 :ref:`standby <standby>` and :ref:`sus 186 respectively. 187 188 Writing one of the listed strings into 189 suspend variant represented by it to b 190 in the ``state`` file. The string rep 191 currently associated with the "mem" st 192 shown in square brackets. 193 194 If the kernel does not support system 195 196 ``disk`` 197 This file controls the operating mode 198 Specifically, it tells the kernel what 199 hibernation image. 200 201 Reading from it returns a list of supp 202 203 ``platform`` 204 Put the system into a special 205 make additional wakeup options 206 platform firmware to take a si 207 wakeup. 208 209 It is only available if the pl 210 mechanism to put the system to 211 hibernation image (platforms w 212 example). 213 214 ``shutdown`` 215 Power off the system. 216 217 ``reboot`` 218 Reboot the system (useful for 219 220 ``suspend`` 221 Hybrid system suspend. Put th 222 state selected through the ``m 223 If the system is successfully 224 the hibernation image and cont 225 to restore the previous state 226 227 It is available if system susp 228 229 ``test_resume`` 230 Diagnostic operation. Load th 231 just woken up from hibernation 232 instance was a restore kernel 233 resume. 234 235 Writing one of the strings listed abov 236 represented by it to be selected. 237 238 The currently selected option is shown 239 that the operation represented by it w 240 and saving the image when hibernation 241 to :file:`/sys/power/state`. 242 243 If the kernel does not support hiberna 244 245 ``image_size`` 246 This file controls the size of hiberna 247 248 It can be written a string representin 249 be used as a best-effort upper limit o 250 hibernation core will do its best to e 251 exceed that number, but if that turns 252 hibernation image will still be create 253 possible. In particular, writing '0' 254 hibernation images to be minimum. 255 256 Reading from it returns the current im 257 around 2/5 of the available RAM size b 258 259 ``pm_trace`` 260 This file controls the "PM trace" mech 261 or resume event point in the RTC memor 262 debug hard lockups or reboots due to d 263 during system suspend or resume (which 264 265 If it contains "1", the fingerprint of 266 in turn will be stored in the RTC memo 267 information), so it will survive a sys 268 after storing it and it can be used la 269 caused the crash to happen. 270 271 It contains "0" by default, which may 272 string representing a nonzero integer 273 274 According to the above, there are two ways to 275 :ref:`suspend-to-idle <s2idle>` state. The fi 276 directly to :file:`/sys/power/state`. The sec 277 :file:`/sys/power/mem_sleep` and then to write 278 :file:`/sys/power/state`. Likewise, there are 279 into the :ref:`standby <standby>` state (the s 280 files in that case are "standby" or "shallow" 281 state is supported by the platform. However, 282 system go into the :ref:`suspend-to-RAM <s2ram 283 :file:`/sys/power/mem_sleep` and "mem" into :f 284 285 The default suspend variant (ie. the one to be 286 into :file:`/sys/power/mem_sleep`) is either " 287 supporting :ref:`suspend-to-RAM <s2ram>`) or " 288 by the value of the ``mem_sleep_default`` para 289 On some systems with ACPI, depending on the in 290 default may be "s2idle" even if :ref:`suspend- 291 principle.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.