/sys/power/ 电源管理 SYS接口

来源:互联网 发布:windows linux mac知乎 编辑:程序博客网 时间:2024/05/20 06:27

http://www.kernel.org/doc/Documentation/ABI/testing/sysfs-power


What:/sys/power/Date:August 2006Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power directory will contain files that willprovide a unified interface to the power managementsubsystem.What:/sys/power/stateDate:August 2006Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power/state file controls the system power state.Reading from this file returns what states are supported,which is hard-coded to 'standby' (Power-On Suspend), 'mem'(Suspend-to-RAM), and 'disk' (Suspend-to-Disk).Writing to this file one of these strings causes the system totransition into that state. Please see the fileDocumentation/power/states.txt for a description of each ofthese states.What:/sys/power/diskDate:September 2006Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power/disk file controls the operating mode of thesuspend-to-disk mechanism.  Reading from this file returnsthe name of the method by which the system will be put tosleep on the next suspend.  There are four methods supported:'firmware' - means that the memory image will be saved to diskby some firmware, in which case we also assume that thefirmware will handle the system suspend.'platform' - the memory image will be saved by the kernel andthe system will be put to sleep by the platform driver (e.g.ACPI or other PM registers).'shutdown' - the memory image will be saved by the kernel andthe system will be powered off.'reboot' - the memory image will be saved by the kernel andthe system will be rebooted.Additionally, /sys/power/disk can be used to turn on one of thetwo testing modes of the suspend-to-disk mechanism: 'testproc'or 'test'.  If the suspend-to-disk mechanism is in the'testproc' mode, writing 'disk' to /sys/power/state will causethe kernel to disable nonboot CPUs and freeze tasks, wait for 5seconds, unfreeze tasks and enable nonboot CPUs.  If it is inthe 'test' mode, writing 'disk' to /sys/power/state will causethe kernel to disable nonboot CPUs and freeze tasks, shrinkmemory, suspend devices, wait for 5 seconds, resume devices,unfreeze tasks and enable nonboot CPUs.  Then, we are able tolook in the log messages and work out, for example, which codeis being slow and which device drivers are misbehaving.The suspend-to-disk method may be chosen by writing to thisfile one of the accepted strings:'firmware''platform''shutdown''reboot''testproc''test'It will only change to 'firmware' or 'platform' if the systemsupports that.What:/sys/power/image_sizeDate:August 2006Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power/image_size file controls the size of the imagecreated by the suspend-to-disk mechanism.  It can be written astring representing a non-negative integer that will be usedas an upper limit of the image size, in bytes.  The kernel'ssuspend-to-disk code will do its best to ensure the image sizewill not exceed this number.  However, if it turns out to beimpossible, the kernel will try to suspend anyway using thesmallest image possible.  In particular, if "0" is written tothis file, the suspend image will be as small as possible.Reading from this file will display the current image sizelimit, which is set to 500 MB by default.What:/sys/power/pm_traceDate:August 2006Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power/pm_trace file controls the code which saves thelast PM event point in the RTC across reboots, so that you candebug a machine that just hangs during suspend (or morecommonly, during resume).  Namely, the RTC is only used to savethe last PM event point if this file contains '1'.  Initiallyit contains '0' which may be changed to '1' by writing astring representing a nonzero integer into it.To use this debugging feature you should attempt to suspendthe machine, then reboot it and rundmesg -s 1000000 | grep 'hash matches'If you do not get any matches (or they appear to be falsepositives), it is possible that the last PM event pointreferred to a device created by a loadable kernel module.  Inthis case cat /sys/power/pm_trace_dev_match (see below) afteryour system is started up and the kernel modules are loaded.CAUTION: Using it will cause your machine's real-time (CMOS)clock to be set to a random invalid time after a resume.What;/sys/power/pm_trace_dev_matchDate:October 2010Contact:James Hogan <james@albanarts.com>Description:The /sys/power/pm_trace_dev_match file contains the name of thedevice associated with the last PM event point saved in the RTCacross reboots when pm_trace has been used.  More precisely itcontains the list of current devices (including thoseregistered by loadable kernel modules since boot) which matchthe device hash in the RTC at boot, with a newline after eachone.The advantage of this file over the hash matches printed to thekernel log (see /sys/power/pm_trace), is that it includesdevices created after boot by loadable kernel modules.Due to the small hash size necessary to fit in the RTC, it ispossible that more than one device matches the hash, in whichcase further investigation is required to determine whichdevice is causing the problem.  Note that genuine RTC clockvalues (such as when pm_trace has not been used), can stillmatch a device and output it's name here.What:/sys/power/pm_asyncDate:January 2009Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power/pm_async file controls the switch allowing theuser space to enable or disable asynchronous suspend and resumeof devices.  If enabled, this feature will cause some devicedrivers' suspend and resume callbacks to be executed in parallelwith each other and with the main suspend thread.  It is enabledif this file contains "1", which is the default.  It may bedisabled by writing "0" to this file, in which case all deviceswill be suspended and resumed synchronously.What:/sys/power/wakeup_countDate:July 2010Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power/wakeup_count file allows user space to put thesystem into a sleep state while taking into account theconcurrent arrival of wakeup events.  Reading from it returnsthe current number of registered wakeup events and it blocks ifsome wakeup events are being processed at the time the file isread from.  Writing to it will only succeed if the currentnumber of wakeup events is equal to the written value and, ifsuccessful, will make the kernel abort a subsequent transitionto a sleep state if any wakeup events are reported after thewrite has returned.What:/sys/power/reserved_sizeDate:May 2011Contact:Rafael J. Wysocki <rjw@sisk.pl>Description:The /sys/power/reserved_size file allows user space to controlthe amount of memory reserved for allocations made by devicedrivers during the "device freeze" stage of hibernation.  It canbe written a string representing a non-negative integer thatwill be used as the amount of memory to reserve for allocationsmade by device drivers' "freeze" callbacks, in bytes.Reading from this file will display the current value, which isset to 1 MB by default.

原创粉丝点击