History

PM: Wrap documentation to fit in 80 columns

Wrap to 80 columns. No textual change except to correct some "it's" that should be "its".

Bjorn Helgaas committed 6 years ago

Commit 1992b661 parent af42d348 files · +81 −74Browse files

Unified · Split

8 files
  1. Documentation/power/drivers-testing.rst +4 −3
  2. Documentation/power/freezing-of-tasks.rst +19 −18
  3. Documentation/power/opp.rst +17 −15
  4. Documentation/power/pci.rst +14 −14
  5. Documentation/power/pm_qos_interface.rst +13 −13
  6. Documentation/power/runtime_pm.rst +2 −2
  7. Documentation/power/suspend-and-cpuhotplug.rst +4 −3
  8. Documentation/power/swsusp.rst +8 −6
Documentation/power/drivers-testing.rst+4−3
@@ -39,9 +39,10 @@ c) Compile the driver directly into the kernel and try the test modes of · 38 unmodified lines
39d) Attempt to hibernate with the driver compiled directly into the kernel39d) Attempt to hibernate with the driver compiled directly into the kernel
40 in the "reboot", "shutdown" and "platform" modes.40 in the "reboot", "shutdown" and "platform" modes.
41 41
42e) Try the test modes of suspend (see: Documentation/power/basic-pm-debugging.rst,42e) Try the test modes of suspend (see:
43 2). [As far as the STR tests are concerned, it should not matter whether or43 Documentation/power/basic-pm-debugging.rst, 2). [As far as the STR tests are
44 not the driver is built as a module.]44 concerned, it should not matter whether or not the driver is built as a
45 module.]
45 46
46f) Attempt to suspend to RAM using the s2ram tool with the driver loaded47f) Attempt to suspend to RAM using the s2ram tool with the driver loaded
47 (see: Documentation/power/basic-pm-debugging.rst, 2).48 (see: Documentation/power/basic-pm-debugging.rst, 2).
Documentation/power/freezing-of-tasks.rst+19−18
@@ -215,30 +215,31 @@ VI. Are there any precautions to be taken to prevent freezing failures? · 214 unmodified lines
215 215
216Yes, there are.216Yes, there are.
217 217
218First of all, grabbing the 'system_transition_mutex' lock to mutually exclude a piece of code218First of all, grabbing the 'system_transition_mutex' lock to mutually exclude a
219from system-wide sleep such as suspend/hibernation is not encouraged.219piece of code from system-wide sleep such as suspend/hibernation is not
220If possible, that piece of code must instead hook onto the suspend/hibernation220encouraged. If possible, that piece of code must instead hook onto the
221notifiers to achieve mutual exclusion. Look at the CPU-Hotplug code221suspend/hibernation notifiers to achieve mutual exclusion. Look at the
222(kernel/cpu.c) for an example.222CPU-Hotplug code (kernel/cpu.c) for an example.
223 223
224However, if that is not feasible, and grabbing 'system_transition_mutex' is deemed necessary,224However, if that is not feasible, and grabbing 'system_transition_mutex' is
225it is strongly discouraged to directly call mutex_[un]lock(&system_transition_mutex) since225deemed necessary, it is strongly discouraged to directly call
226that could lead to freezing failures, because if the suspend/hibernate code226mutex_[un]lock(&system_transition_mutex) since that could lead to freezing
227successfully acquired the 'system_transition_mutex' lock, and hence that other entity failed227failures, because if the suspend/hibernate code successfully acquired the
228to acquire the lock, then that task would get blocked in TASK_UNINTERRUPTIBLE228'system_transition_mutex' lock, and hence that other entity failed to acquire
229state. As a consequence, the freezer would not be able to freeze that task,229the lock, then that task would get blocked in TASK_UNINTERRUPTIBLE state. As a
230leading to freezing failure.230consequence, the freezer would not be able to freeze that task, leading to
231freezing failure.
231 232
232However, the [un]lock_system_sleep() APIs are safe to use in this scenario,233However, the [un]lock_system_sleep() APIs are safe to use in this scenario,
233since they ask the freezer to skip freezing this task, since it is anyway234since they ask the freezer to skip freezing this task, since it is anyway
234"frozen enough" as it is blocked on 'system_transition_mutex', which will be released235"frozen enough" as it is blocked on 'system_transition_mutex', which will be
235only after the entire suspend/hibernation sequence is complete.236released only after the entire suspend/hibernation sequence is complete. So, to
236So, to summarize, use [un]lock_system_sleep() instead of directly using237summarize, use [un]lock_system_sleep() instead of directly using
237mutex_[un]lock(&system_transition_mutex). That would prevent freezing failures.238mutex_[un]lock(&system_transition_mutex). That would prevent freezing failures.
238 239
239V. Miscellaneous240V. Miscellaneous
240================241================
241 242
242/sys/power/pm_freeze_timeout controls how long it will cost at most to freeze243/sys/power/pm_freeze_timeout controls how long it will cost at most to freeze
243all user space processes or all freezable kernel threads, in unit of millisecond.244all user space processes or all freezable kernel threads, in unit of
244The default value is 20000, with range of unsigned integer.245millisecond. The default value is 20000, with range of unsigned integer.
Documentation/power/opp.rst+17−15
@@ -73,19 +73,21 @@ factors. Example usage: Thermal management or other exceptional situations where · 72 unmodified lines
73SoC framework might choose to disable a higher frequency OPP to safely continue73SoC framework might choose to disable a higher frequency OPP to safely continue
74operations until that OPP could be re-enabled if possible.74operations until that OPP could be re-enabled if possible.
75 75
76OPP library facilitates this concept in it's implementation. The following76OPP library facilitates this concept in its implementation. The following
77operational functions operate only on available opps:77operational functions operate only on available opps:
78opp_find_freq_{ceil, floor}, dev_pm_opp_get_voltage, dev_pm_opp_get_freq, dev_pm_opp_get_opp_count78opp_find_freq_{ceil, floor}, dev_pm_opp_get_voltage, dev_pm_opp_get_freq,
79dev_pm_opp_get_opp_count
79 80
80dev_pm_opp_find_freq_exact is meant to be used to find the opp pointer which can then81dev_pm_opp_find_freq_exact is meant to be used to find the opp pointer
81be used for dev_pm_opp_enable/disable functions to make an opp available as required.82which can then be used for dev_pm_opp_enable/disable functions to make an
83opp available as required.
82 84
83WARNING: Users of OPP library should refresh their availability count using85WARNING: Users of OPP library should refresh their availability count using
84get_opp_count if dev_pm_opp_enable/disable functions are invoked for a device, the86get_opp_count if dev_pm_opp_enable/disable functions are invoked for a
85exact mechanism to trigger these or the notification mechanism to other87device, the exact mechanism to trigger these or the notification mechanism
86dependent subsystems such as cpufreq are left to the discretion of the SoC88to other dependent subsystems such as cpufreq are left to the discretion of
87specific framework which uses the OPP library. Similar care needs to be taken89the SoC specific framework which uses the OPP library. Similar care needs
88care to refresh the cpufreq table in cases of these operations.90to be taken care to refresh the cpufreq table in cases of these operations.
89 91
902. Initial OPP List Registration922. Initial OPP List Registration
91================================93================================
@@ -99,11 +101,11 @@ OPPs dynamically using the dev_pm_opp_enable / disable functions. · 7 unmodified lines
99dev_pm_opp_add101dev_pm_opp_add
100 Add a new OPP for a specific domain represented by the device pointer.102 Add a new OPP for a specific domain represented by the device pointer.
101 The OPP is defined using the frequency and voltage. Once added, the OPP103 The OPP is defined using the frequency and voltage. Once added, the OPP
102 is assumed to be available and control of it's availability can be done104 is assumed to be available and control of its availability can be done
103 with the dev_pm_opp_enable/disable functions. OPP library internally stores105 with the dev_pm_opp_enable/disable functions. OPP library
104 and manages this information in the opp struct. This function may be106 internally stores and manages this information in the opp struct.
105 used by SoC framework to define a optimal list as per the demands of107 This function may be used by SoC framework to define a optimal list
106 SoC usage environment.108 as per the demands of SoC usage environment.
107 109
108 WARNING:110 WARNING:
109 Do not use this function in interrupt context.111 Do not use this function in interrupt context.
@@ -354,7 +356,7 @@ struct dev_pm_opp · 244 unmodified lines
354 356
355struct device357struct device
356 This is used to identify a domain to the OPP layer. The358 This is used to identify a domain to the OPP layer. The
357 nature of the device and it's implementation is left to the user of359 nature of the device and its implementation is left to the user of
358 OPP library such as the SoC framework.360 OPP library such as the SoC framework.
359 361
360Overall, in a simplistic view, the data structure operations is represented as362Overall, in a simplistic view, the data structure operations is represented as
Documentation/power/pci.rst+14−14
@@ -426,12 +426,12 @@ pm->runtime_idle() callback. · 425 unmodified lines
4262.4. System-Wide Power Transitions4262.4. System-Wide Power Transitions
427----------------------------------427----------------------------------
428There are a few different types of system-wide power transitions, described in428There are a few different types of system-wide power transitions, described in
429Documentation/driver-api/pm/devices.rst. Each of them requires devices to be handled429Documentation/driver-api/pm/devices.rst. Each of them requires devices to be
430in a specific way and the PM core executes subsystem-level power management430handled in a specific way and the PM core executes subsystem-level power
431callbacks for this purpose. They are executed in phases such that each phase431management callbacks for this purpose. They are executed in phases such that
432involves executing the same subsystem-level callback for every device belonging432each phase involves executing the same subsystem-level callback for every device
433to the given subsystem before the next phase begins. These phases always run433belonging to the given subsystem before the next phase begins. These phases
434after tasks have been frozen.434always run after tasks have been frozen.
435 435
4362.4.1. System Suspend4362.4.1. System Suspend
437^^^^^^^^^^^^^^^^^^^^^437^^^^^^^^^^^^^^^^^^^^^
@@ -636,12 +636,12 @@ System restore requires a hibernation image to be loaded into memory and the · 198 unmodified lines
636pre-hibernation memory contents to be restored before the pre-hibernation system636pre-hibernation memory contents to be restored before the pre-hibernation system
637activity can be resumed.637activity can be resumed.
638 638
639As described in Documentation/driver-api/pm/devices.rst, the hibernation image is loaded639As described in Documentation/driver-api/pm/devices.rst, the hibernation image
640into memory by a fresh instance of the kernel, called the boot kernel, which in640is loaded into memory by a fresh instance of the kernel, called the boot kernel,
641turn is loaded and run by a boot loader in the usual way. After the boot kernel641which in turn is loaded and run by a boot loader in the usual way. After the
642has loaded the image, it needs to replace its own code and data with the code642boot kernel has loaded the image, it needs to replace its own code and data with
643and data of the "hibernated" kernel stored within the image, called the image643the code and data of the "hibernated" kernel stored within the image, called the
644kernel. For this purpose all devices are frozen just like before creating644image kernel. For this purpose all devices are frozen just like before creating
645the image during hibernation, in the645the image during hibernation, in the
646 646
647 prepare, freeze, freeze_noirq647 prepare, freeze, freeze_noirq
@@ -691,8 +691,8 @@ controlling the runtime power management of their devices. · 43 unmodified lines
691 691
692At the time of this writing there are two ways to define power management692At the time of this writing there are two ways to define power management
693callbacks for a PCI device driver, the recommended one, based on using a693callbacks for a PCI device driver, the recommended one, based on using a
694dev_pm_ops structure described in Documentation/driver-api/pm/devices.rst, and the694dev_pm_ops structure described in Documentation/driver-api/pm/devices.rst, and
695"legacy" one, in which the .suspend(), .suspend_late(), .resume_early(), and695the "legacy" one, in which the .suspend(), .suspend_late(), .resume_early(), and
696.resume() callbacks from struct pci_driver are used. The legacy approach,696.resume() callbacks from struct pci_driver are used. The legacy approach,
697however, doesn't allow one to define runtime power management callbacks and is697however, doesn't allow one to define runtime power management callbacks and is
698not really suitable for any new drivers. Therefore it is not covered by this698not really suitable for any new drivers. Therefore it is not covered by this
Documentation/power/pm_qos_interface.rst+13−13
@@ -8,8 +8,8 @@ one of the parameters. · 7 unmodified lines
8 8
9Two different PM QoS frameworks are available:9Two different PM QoS frameworks are available:
101. PM QoS classes for cpu_dma_latency101. PM QoS classes for cpu_dma_latency
112. the per-device PM QoS framework provides the API to manage the per-device latency112. The per-device PM QoS framework provides the API to manage the
12constraints and PM QoS flags.12 per-device latency constraints and PM QoS flags.
13 13
14Each parameters have defined units:14Each parameters have defined units:
15 15
@@ -47,14 +47,14 @@ void pm_qos_add_request(handle, param_class, target_value): · 31 unmodified lines
47 pm_qos API functions.47 pm_qos API functions.
48 48
49void pm_qos_update_request(handle, new_target_value):49void pm_qos_update_request(handle, new_target_value):
50 Will update the list element pointed to by the handle with the new target value50 Will update the list element pointed to by the handle with the new target
51 and recompute the new aggregated target, calling the notification tree if the51 value and recompute the new aggregated target, calling the notification tree
52 target is changed.52 if the target is changed.
53 53
54void pm_qos_remove_request(handle):54void pm_qos_remove_request(handle):
55 Will remove the element. After removal it will update the aggregate target and55 Will remove the element. After removal it will update the aggregate target
56 call the notification tree if the target was changed as a result of removing56 and call the notification tree if the target was changed as a result of
57 the request.57 removing the request.
58 58
59int pm_qos_request(param_class):59int pm_qos_request(param_class):
60 Returns the aggregated value for a given PM QoS class.60 Returns the aggregated value for a given PM QoS class.
@@ -167,9 +167,9 @@ int dev_pm_qos_expose_flags(device, value) · 106 unmodified lines
167 change the value of the PM_QOS_FLAG_NO_POWER_OFF flag.167 change the value of the PM_QOS_FLAG_NO_POWER_OFF flag.
168 168
169void dev_pm_qos_hide_flags(device)169void dev_pm_qos_hide_flags(device)
170 Drop the request added by dev_pm_qos_expose_flags() from the device's PM QoS list170 Drop the request added by dev_pm_qos_expose_flags() from the device's PM QoS
171 of flags and remove sysfs attribute pm_qos_no_power_off from the device's power171 list of flags and remove sysfs attribute pm_qos_no_power_off from the device's
172 directory.172 power directory.
173 173
174Notification mechanisms:174Notification mechanisms:
175 175
@@ -179,8 +179,8 @@ int dev_pm_qos_add_notifier(device, notifier, type): · 3 unmodified lines
179 Adds a notification callback function for the device for a particular request179 Adds a notification callback function for the device for a particular request
180 type.180 type.
181 181
182 The callback is called when the aggregated value of the device constraints list182 The callback is called when the aggregated value of the device constraints
183 is changed.183 list is changed.
184 184
185int dev_pm_qos_remove_notifier(device, notifier, type):185int dev_pm_qos_remove_notifier(device, notifier, type):
186 Removes the notification callback function for the device.186 Removes the notification callback function for the device.
Documentation/power/runtime_pm.rst+2−2
@@ -268,8 +268,8 @@ defined in include/linux/pm.h: · 267 unmodified lines
268 `unsigned int runtime_auto;`268 `unsigned int runtime_auto;`
269 - if set, indicates that the user space has allowed the device driver to269 - if set, indicates that the user space has allowed the device driver to
270 power manage the device at run time via the /sys/devices/.../power/control270 power manage the device at run time via the /sys/devices/.../power/control
271 `interface;` it may only be modified with the help of the pm_runtime_allow()271 `interface;` it may only be modified with the help of the
272 and pm_runtime_forbid() helper functions272 pm_runtime_allow() and pm_runtime_forbid() helper functions
273 273
274 `unsigned int no_callbacks;`274 `unsigned int no_callbacks;`
275 - indicates that the device does not use the runtime PM callbacks (see275 - indicates that the device does not use the runtime PM callbacks (see
Documentation/power/suspend-and-cpuhotplug.rst+4−3
@@ -106,8 +106,8 @@ execution during resume): · 105 unmodified lines
106* Release system_transition_mutex lock.106* Release system_transition_mutex lock.
107 107
108 108
109It is to be noted here that the system_transition_mutex lock is acquired at the very109It is to be noted here that the system_transition_mutex lock is acquired at the
110beginning, when we are just starting out to suspend, and then released only110very beginning, when we are just starting out to suspend, and then released only
111after the entire cycle is complete (i.e., suspend + resume).111after the entire cycle is complete (i.e., suspend + resume).
112 112
113::113::
@@ -165,7 +165,8 @@ Important files and functions/entry points: · 51 unmodified lines
165 165
166- kernel/power/process.c : freeze_processes(), thaw_processes()166- kernel/power/process.c : freeze_processes(), thaw_processes()
167- kernel/power/suspend.c : suspend_prepare(), suspend_enter(), suspend_finish()167- kernel/power/suspend.c : suspend_prepare(), suspend_enter(), suspend_finish()
168- kernel/cpu.c: cpu_[up|down](), _cpu_[up|down](), [disable|enable]_nonboot_cpus()168- kernel/cpu.c: cpu_[up|down](), _cpu_[up|down](),
169 [disable|enable]_nonboot_cpus()
169 170
170 171
171 172
Documentation/power/swsusp.rst+8−6
@@ -118,7 +118,8 @@ In a really perfect world:: · 117 unmodified lines
118 118
119 echo 1 > /proc/acpi/sleep # for standby119 echo 1 > /proc/acpi/sleep # for standby
120 echo 2 > /proc/acpi/sleep # for suspend to ram120 echo 2 > /proc/acpi/sleep # for suspend to ram
121 echo 3 > /proc/acpi/sleep # for suspend to ram, but with more power conservative121 echo 3 > /proc/acpi/sleep # for suspend to ram, but with more power
122 # conservative
122 echo 4 > /proc/acpi/sleep # for suspend to disk123 echo 4 > /proc/acpi/sleep # for suspend to disk
123 echo 5 > /proc/acpi/sleep # for shutdown unfriendly the system124 echo 5 > /proc/acpi/sleep # for shutdown unfriendly the system
124 125
@@ -192,8 +193,8 @@ Q: · 67 unmodified lines
192 193
193A:194A:
194 The freezing of tasks is a mechanism by which user space processes and some195 The freezing of tasks is a mechanism by which user space processes and some
195 kernel threads are controlled during hibernation or system-wide suspend (on some196 kernel threads are controlled during hibernation or system-wide suspend (on
196 architectures). See freezing-of-tasks.txt for details.197 some architectures). See freezing-of-tasks.txt for details.
197 198
198Q:199Q:
199 What is the difference between "platform" and "shutdown"?200 What is the difference between "platform" and "shutdown"?
@@ -282,7 +283,8 @@ A: · 82 unmodified lines
282 suspend(PMSG_FREEZE): devices are frozen so that they don't interfere283 suspend(PMSG_FREEZE): devices are frozen so that they don't interfere
283 with state snapshot284 with state snapshot
284 285
285 state snapshot: copy of whole used memory is taken with interrupts disabled286 state snapshot: copy of whole used memory is taken with interrupts
287 disabled
286 288
287 resume(): devices are woken up so that we can write image to swap289 resume(): devices are woken up so that we can write image to swap
288 290
@@ -353,8 +355,8 @@ Q: · 64 unmodified lines
353 355
354A:356A:
355 Generally, yes, you can. However, it requires you to use the "resume=" and357 Generally, yes, you can. However, it requires you to use the "resume=" and
356 "resume_offset=" kernel command line parameters, so the resume from a swap file358 "resume_offset=" kernel command line parameters, so the resume from a swap
357 cannot be initiated from an initrd or initramfs image. See359 file cannot be initiated from an initrd or initramfs image. See
358 swsusp-and-swap-files.txt for details.360 swsusp-and-swap-files.txt for details.
359 361
360Q:362Q:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t