sysfs-power 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. What: /sys/power/
  2. Date: August 2006
  3. Contact: Rafael J. Wysocki <[email protected]>
  4. Description:
  5. The /sys/power directory will contain files that will
  6. provide a unified interface to the power management
  7. subsystem.
  8. What: /sys/power/state
  9. Date: November 2016
  10. Contact: Rafael J. Wysocki <[email protected]>
  11. Description:
  12. The /sys/power/state file controls system sleep states.
  13. Reading from this file returns the available sleep state
  14. labels, which may be "mem" (suspend), "standby" (power-on
  15. suspend), "freeze" (suspend-to-idle) and "disk" (hibernation).
  16. Writing one of the above strings to this file causes the system
  17. to transition into the corresponding state, if available.
  18. See Documentation/admin-guide/pm/sleep-states.rst for more
  19. information.
  20. What: /sys/power/mem_sleep
  21. Date: November 2016
  22. Contact: Rafael J. Wysocki <[email protected]>
  23. Description:
  24. The /sys/power/mem_sleep file controls the operating mode of
  25. system suspend. Reading from it returns the available modes
  26. as "s2idle" (always present), "shallow" and "deep" (present if
  27. supported). The mode that will be used on subsequent attempts
  28. to suspend the system (by writing "mem" to the /sys/power/state
  29. file described above) is enclosed in square brackets.
  30. Writing one of the above strings to this file causes the mode
  31. represented by it to be used on subsequent attempts to suspend
  32. the system.
  33. See Documentation/admin-guide/pm/sleep-states.rst for more
  34. information.
  35. What: /sys/power/disk
  36. Date: September 2006
  37. Contact: Rafael J. Wysocki <[email protected]>
  38. Description:
  39. The /sys/power/disk file controls the operating mode of the
  40. suspend-to-disk mechanism. Reading from this file returns
  41. the name of the method by which the system will be put to
  42. sleep on the next suspend. There are four methods supported:
  43. 'firmware' - means that the memory image will be saved to disk
  44. by some firmware, in which case we also assume that the
  45. firmware will handle the system suspend.
  46. 'platform' - the memory image will be saved by the kernel and
  47. the system will be put to sleep by the platform driver (e.g.
  48. ACPI or other PM registers).
  49. 'shutdown' - the memory image will be saved by the kernel and
  50. the system will be powered off.
  51. 'reboot' - the memory image will be saved by the kernel and
  52. the system will be rebooted.
  53. Additionally, /sys/power/disk can be used to turn on one of the
  54. two testing modes of the suspend-to-disk mechanism: 'testproc'
  55. or 'test'. If the suspend-to-disk mechanism is in the
  56. 'testproc' mode, writing 'disk' to /sys/power/state will cause
  57. the kernel to disable nonboot CPUs and freeze tasks, wait for 5
  58. seconds, unfreeze tasks and enable nonboot CPUs. If it is in
  59. the 'test' mode, writing 'disk' to /sys/power/state will cause
  60. the kernel to disable nonboot CPUs and freeze tasks, shrink
  61. memory, suspend devices, wait for 5 seconds, resume devices,
  62. unfreeze tasks and enable nonboot CPUs. Then, we are able to
  63. look in the log messages and work out, for example, which code
  64. is being slow and which device drivers are misbehaving.
  65. The suspend-to-disk method may be chosen by writing to this
  66. file one of the accepted strings:
  67. - 'firmware'
  68. - 'platform'
  69. - 'shutdown'
  70. - 'reboot'
  71. - 'testproc'
  72. - 'test'
  73. It will only change to 'firmware' or 'platform' if the system
  74. supports that.
  75. What: /sys/power/image_size
  76. Date: August 2006
  77. Contact: Rafael J. Wysocki <[email protected]>
  78. Description:
  79. The /sys/power/image_size file controls the size of the image
  80. created by the suspend-to-disk mechanism. It can be written a
  81. string representing a non-negative integer that will be used
  82. as an upper limit of the image size, in bytes. The kernel's
  83. suspend-to-disk code will do its best to ensure the image size
  84. will not exceed this number. However, if it turns out to be
  85. impossible, the kernel will try to suspend anyway using the
  86. smallest image possible. In particular, if "0" is written to
  87. this file, the suspend image will be as small as possible.
  88. Reading from this file will display the current image size
  89. limit, which is set to around 2/5 of available RAM by default.
  90. What: /sys/power/pm_trace
  91. Date: August 2006
  92. Contact: Rafael J. Wysocki <[email protected]>
  93. Description:
  94. The /sys/power/pm_trace file controls the code which saves the
  95. last PM event point in the RTC across reboots, so that you can
  96. debug a machine that just hangs during suspend (or more
  97. commonly, during resume). Namely, the RTC is only used to save
  98. the last PM event point if this file contains '1'. Initially
  99. it contains '0' which may be changed to '1' by writing a
  100. string representing a nonzero integer into it.
  101. To use this debugging feature you should attempt to suspend
  102. the machine, then reboot it and run::
  103. dmesg -s 1000000 | grep 'hash matches'
  104. If you do not get any matches (or they appear to be false
  105. positives), it is possible that the last PM event point
  106. referred to a device created by a loadable kernel module. In
  107. this case cat /sys/power/pm_trace_dev_match (see below) after
  108. your system is started up and the kernel modules are loaded.
  109. CAUTION: Using it will cause your machine's real-time (CMOS)
  110. clock to be set to a random invalid time after a resume.
  111. What; /sys/power/pm_trace_dev_match
  112. Date: October 2010
  113. Contact: James Hogan <[email protected]>
  114. Description:
  115. The /sys/power/pm_trace_dev_match file contains the name of the
  116. device associated with the last PM event point saved in the RTC
  117. across reboots when pm_trace has been used. More precisely it
  118. contains the list of current devices (including those
  119. registered by loadable kernel modules since boot) which match
  120. the device hash in the RTC at boot, with a newline after each
  121. one.
  122. The advantage of this file over the hash matches printed to the
  123. kernel log (see /sys/power/pm_trace), is that it includes
  124. devices created after boot by loadable kernel modules.
  125. Due to the small hash size necessary to fit in the RTC, it is
  126. possible that more than one device matches the hash, in which
  127. case further investigation is required to determine which
  128. device is causing the problem. Note that genuine RTC clock
  129. values (such as when pm_trace has not been used), can still
  130. match a device and output its name here.
  131. What: /sys/power/pm_async
  132. Date: January 2009
  133. Contact: Rafael J. Wysocki <[email protected]>
  134. Description:
  135. The /sys/power/pm_async file controls the switch allowing the
  136. user space to enable or disable asynchronous suspend and resume
  137. of devices. If enabled, this feature will cause some device
  138. drivers' suspend and resume callbacks to be executed in parallel
  139. with each other and with the main suspend thread. It is enabled
  140. if this file contains "1", which is the default. It may be
  141. disabled by writing "0" to this file, in which case all devices
  142. will be suspended and resumed synchronously.
  143. What: /sys/power/wakeup_count
  144. Date: July 2010
  145. Contact: Rafael J. Wysocki <[email protected]>
  146. Description:
  147. The /sys/power/wakeup_count file allows user space to put the
  148. system into a sleep state while taking into account the
  149. concurrent arrival of wakeup events. Reading from it returns
  150. the current number of registered wakeup events and it blocks if
  151. some wakeup events are being processed at the time the file is
  152. read from. Writing to it will only succeed if the current
  153. number of wakeup events is equal to the written value and, if
  154. successful, will make the kernel abort a subsequent transition
  155. to a sleep state if any wakeup events are reported after the
  156. write has returned.
  157. What: /sys/power/reserved_size
  158. Date: May 2011
  159. Contact: Rafael J. Wysocki <[email protected]>
  160. Description:
  161. The /sys/power/reserved_size file allows user space to control
  162. the amount of memory reserved for allocations made by device
  163. drivers during the "device freeze" stage of hibernation. It can
  164. be written a string representing a non-negative integer that
  165. will be used as the amount of memory to reserve for allocations
  166. made by device drivers' "freeze" callbacks, in bytes.
  167. Reading from this file will display the current value, which is
  168. set to 1 MB by default.
  169. What: /sys/power/autosleep
  170. Date: April 2012
  171. Contact: Rafael J. Wysocki <[email protected]>
  172. Description:
  173. The /sys/power/autosleep file can be written one of the strings
  174. returned by reads from /sys/power/state. If that happens, a
  175. work item attempting to trigger a transition of the system to
  176. the sleep state represented by that string is queued up. This
  177. attempt will only succeed if there are no active wakeup sources
  178. in the system at that time. After every execution, regardless
  179. of whether or not the attempt to put the system to sleep has
  180. succeeded, the work item requeues itself until user space
  181. writes "off" to /sys/power/autosleep.
  182. Reading from this file causes the last string successfully
  183. written to it to be returned.
  184. What: /sys/power/wake_lock
  185. Date: February 2012
  186. Contact: Rafael J. Wysocki <[email protected]>
  187. Description:
  188. The /sys/power/wake_lock file allows user space to create
  189. wakeup source objects and activate them on demand (if one of
  190. those wakeup sources is active, reads from the
  191. /sys/power/wakeup_count file block or return false). When a
  192. string without white space is written to /sys/power/wake_lock,
  193. it will be assumed to represent a wakeup source name. If there
  194. is a wakeup source object with that name, it will be activated
  195. (unless active already). Otherwise, a new wakeup source object
  196. will be registered, assigned the given name and activated.
  197. If a string written to /sys/power/wake_lock contains white
  198. space, the part of the string preceding the white space will be
  199. regarded as a wakeup source name and handled as descrived above.
  200. The other part of the string will be regarded as a timeout (in
  201. nanoseconds) such that the wakeup source will be automatically
  202. deactivated after it has expired. The timeout, if present, is
  203. set regardless of the current state of the wakeup source object
  204. in question.
  205. Reads from this file return a string consisting of the names of
  206. wakeup sources created with the help of it that are active at
  207. the moment, separated with spaces.
  208. What: /sys/power/wake_unlock
  209. Date: February 2012
  210. Contact: Rafael J. Wysocki <[email protected]>
  211. Description:
  212. The /sys/power/wake_unlock file allows user space to deactivate
  213. wakeup sources created with the help of /sys/power/wake_lock.
  214. When a string is written to /sys/power/wake_unlock, it will be
  215. assumed to represent the name of a wakeup source to deactivate.
  216. If a wakeup source object of that name exists and is active at
  217. the moment, it will be deactivated.
  218. Reads from this file return a string consisting of the names of
  219. wakeup sources created with the help of /sys/power/wake_lock
  220. that are inactive at the moment, separated with spaces.
  221. What: /sys/power/pm_print_times
  222. Date: May 2012
  223. Contact: Sameer Nanda <[email protected]>
  224. Description:
  225. The /sys/power/pm_print_times file allows user space to
  226. control whether the time taken by devices to suspend and
  227. resume is printed. These prints are useful for hunting down
  228. devices that take too long to suspend or resume.
  229. Writing a "1" enables this printing while writing a "0"
  230. disables it. The default value is "0". Reading from this file
  231. will display the current value.
  232. What: /sys/power/pm_wakeup_irq
  233. Date: April 2015
  234. Contact: Alexandra Yates <[email protected]>
  235. Description:
  236. The /sys/power/pm_wakeup_irq file reports to user space the IRQ
  237. number of the first wakeup interrupt (that is, the first
  238. interrupt from an IRQ line armed for system wakeup) seen by the
  239. kernel during the most recent system suspend/resume cycle.
  240. This output is useful for system wakeup diagnostics of spurious
  241. wakeup interrupts.
  242. What: /sys/power/pm_debug_messages
  243. Date: July 2017
  244. Contact: Rafael J. Wysocki <[email protected]>
  245. Description:
  246. The /sys/power/pm_debug_messages file controls the printing
  247. of debug messages from the system suspend/hiberbation
  248. infrastructure to the kernel log.
  249. Writing a "1" to this file enables the debug messages and
  250. writing a "0" (default) to it disables them. Reads from
  251. this file return the current value.
  252. What: /sys/power/resume_offset
  253. Date: April 2018
  254. Contact: Mario Limonciello <[email protected]>
  255. Description:
  256. This file is used for telling the kernel an offset into a disk
  257. to use when hibernating the system such as with a swap file.
  258. Reads from this file will display the current offset
  259. the kernel will be using on the next hibernation
  260. attempt.
  261. Using this sysfs file will override any values that were
  262. set using the kernel command line for disk offset.
  263. What: /sys/power/suspend_stats
  264. Date: July 2019
  265. Contact: Kalesh Singh <[email protected]>
  266. Description:
  267. The /sys/power/suspend_stats directory contains suspend related
  268. statistics.
  269. What: /sys/power/suspend_stats/success
  270. Date: July 2019
  271. Contact: Kalesh Singh <[email protected]>
  272. Description:
  273. The /sys/power/suspend_stats/success file contains the number
  274. of times entering system sleep state succeeded.
  275. What: /sys/power/suspend_stats/fail
  276. Date: July 2019
  277. Contact: Kalesh Singh <[email protected]>
  278. Description:
  279. The /sys/power/suspend_stats/fail file contains the number
  280. of times entering system sleep state failed.
  281. What: /sys/power/suspend_stats/failed_freeze
  282. Date: July 2019
  283. Contact: Kalesh Singh <[email protected]>
  284. Description:
  285. The /sys/power/suspend_stats/failed_freeze file contains the
  286. number of times freezing processes failed.
  287. What: /sys/power/suspend_stats/failed_prepare
  288. Date: July 2019
  289. Contact: Kalesh Singh <[email protected]>
  290. Description:
  291. The /sys/power/suspend_stats/failed_prepare file contains the
  292. number of times preparing all non-sysdev devices for
  293. a system PM transition failed.
  294. What: /sys/power/suspend_stats/failed_resume
  295. Date: July 2019
  296. Contact: Kalesh Singh <[email protected]>
  297. Description:
  298. The /sys/power/suspend_stats/failed_resume file contains the
  299. number of times executing "resume" callbacks of
  300. non-sysdev devices failed.
  301. What: /sys/power/suspend_stats/failed_resume_early
  302. Date: July 2019
  303. Contact: Kalesh Singh <[email protected]>
  304. Description:
  305. The /sys/power/suspend_stats/failed_resume_early file contains
  306. the number of times executing "early resume" callbacks
  307. of devices failed.
  308. What: /sys/power/suspend_stats/failed_resume_noirq
  309. Date: July 2019
  310. Contact: Kalesh Singh <[email protected]>
  311. Description:
  312. The /sys/power/suspend_stats/failed_resume_noirq file contains
  313. the number of times executing "noirq resume" callbacks
  314. of devices failed.
  315. What: /sys/power/suspend_stats/failed_suspend
  316. Date: July 2019
  317. Contact: Kalesh Singh <[email protected]>
  318. Description:
  319. The /sys/power/suspend_stats/failed_suspend file contains
  320. the number of times executing "suspend" callbacks
  321. of all non-sysdev devices failed.
  322. What: /sys/power/suspend_stats/failed_suspend_late
  323. Date: July 2019
  324. Contact: Kalesh Singh <[email protected]>
  325. Description:
  326. The /sys/power/suspend_stats/failed_suspend_late file contains
  327. the number of times executing "late suspend" callbacks
  328. of all devices failed.
  329. What: /sys/power/suspend_stats/failed_suspend_noirq
  330. Date: July 2019
  331. Contact: Kalesh Singh <[email protected]>
  332. Description:
  333. The /sys/power/suspend_stats/failed_suspend_noirq file contains
  334. the number of times executing "noirq suspend" callbacks
  335. of all devices failed.
  336. What: /sys/power/suspend_stats/last_failed_dev
  337. Date: July 2019
  338. Contact: Kalesh Singh <[email protected]>
  339. Description:
  340. The /sys/power/suspend_stats/last_failed_dev file contains
  341. the last device for which a suspend/resume callback failed.
  342. What: /sys/power/suspend_stats/last_failed_errno
  343. Date: July 2019
  344. Contact: Kalesh Singh <[email protected]>
  345. Description:
  346. The /sys/power/suspend_stats/last_failed_errno file contains
  347. the errno of the last failed attempt at entering
  348. system sleep state.
  349. What: /sys/power/suspend_stats/last_failed_step
  350. Date: July 2019
  351. Contact: Kalesh Singh <[email protected]>
  352. Description:
  353. The /sys/power/suspend_stats/last_failed_step file contains
  354. the last failed step in the suspend/resume path.
  355. What: /sys/power/sync_on_suspend
  356. Date: October 2019
  357. Contact: Jonas Meurer <[email protected]>
  358. Description:
  359. This file controls whether or not the kernel will sync()
  360. filesystems during system suspend (after freezing user space
  361. and before suspending devices).
  362. Writing a "1" to this file enables the sync() and writing a "0"
  363. disables it. Reads from the file return the current value.
  364. The default is "1" if the build-time "SUSPEND_SKIP_SYNC" config
  365. flag is unset, or "0" otherwise.