Documentation/power/pm_qos_interface.rst

Source file repositories/reference/linux-study-clean/Documentation/power/pm_qos_interface.rst

File Facts

System
Linux kernel
Corpus path
Documentation/power/pm_qos_interface.rst
Extension
.rst
Size
9544 bytes
Lines
213
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

===============================
PM Quality Of Service Interface
===============================

This interface provides a kernel and user mode interface for registering
performance expectations by drivers, subsystems and user space applications on
one of the parameters.

Two different PM QoS frameworks are available:
 * CPU latency QoS.
 * The per-device PM QoS framework provides the API to manage the
   per-device latency constraints and PM QoS flags.

The latency unit used in the PM QoS framework is the microsecond (usec).


1. PM QoS framework
===================

A global list of CPU latency QoS requests is maintained along with an aggregated
(effective) target value.  The aggregated target value is updated with changes
to the request list or elements of the list.  For CPU latency QoS, the
aggregated target value is simply the min of the request values held in the list
elements.

Note: the aggregated target value is implemented as an atomic variable so that
reading the aggregated value does not require any locking mechanism.

From kernel space the use of this interface is simple:

void cpu_latency_qos_add_request(handle, target_value):
  Will insert an element into the CPU latency QoS list with the target value.
  Upon change to this list the new target is recomputed and any registered
  notifiers are called only if the target value is now different.
  Clients of PM QoS need to save the returned handle for future use in other
  PM QoS API functions.

void cpu_latency_qos_update_request(handle, new_target_value):
  Will update the list element pointed to by the handle with the new target
  value and recompute the new aggregated target, calling the notification tree
  if the target is changed.

void cpu_latency_qos_remove_request(handle):
  Will remove the element.  After removal it will update the aggregate target
  and call the notification tree if the target was changed as a result of
  removing the request.

int cpu_latency_qos_limit():
  Returns the aggregated value for the CPU latency QoS.

int cpu_latency_qos_request_active(handle):
  Returns if the request is still active, i.e. it has not been removed from the
  CPU latency QoS list.


From user space:

The infrastructure exposes two separate device nodes, /dev/cpu_dma_latency for
the CPU latency QoS and /dev/cpu_wakeup_latency for the CPU system wakeup
latency QoS.

Only processes can register a PM QoS request.  To provide for automatic
cleanup of a process, the interface requires the process to register its
parameter requests as follows.

To register the default PM QoS target for the CPU latency QoS, the process must
open /dev/cpu_dma_latency.  To register a CPU system wakeup QoS limit, the
process must open /dev/cpu_wakeup_latency.

As long as the device node is held open that process has a registered

Annotation

Implementation Notes