pm_qos_interface.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. PM Quality Of Service Interface.
  2. This interface provides a kernel and user mode interface for registering
  3. performance expectations by drivers, subsystems and user space applications on
  4. one of the parameters.
  5. Currently we have {cpu_dma_latency, network_latency, network_throughput} as the
  6. initial set of pm_qos parameters.
  7. Each parameters have defined units:
  8. * latency: usec
  9. * timeout: usec
  10. * throughput: kbs (kilo bit / sec)
  11. The infrastructure exposes multiple misc device nodes one per implemented
  12. parameter. The set of parameters implement is defined by pm_qos_power_init()
  13. and pm_qos_params.h. This is done because having the available parameters
  14. being runtime configurable or changeable from a driver was seen as too easy to
  15. abuse.
  16. For each parameter a list of performance requests is maintained along with
  17. an aggregated target value. The aggregated target value is updated with
  18. changes to the request list or elements of the list. Typically the
  19. aggregated target value is simply the max or min of the request values held
  20. in the parameter list elements.
  21. From kernel mode the use of this interface is simple:
  22. handle = pm_qos_add_request(param_class, target_value):
  23. Will insert an element into the list for that identified PM_QOS class with the
  24. target value. Upon change to this list the new target is recomputed and any
  25. registered notifiers are called only if the target value is now different.
  26. Clients of pm_qos need to save the returned handle.
  27. void pm_qos_update_request(handle, new_target_value):
  28. Will update the list element pointed to by the handle with the new target value
  29. and recompute the new aggregated target, calling the notification tree if the
  30. target is changed.
  31. void pm_qos_remove_request(handle):
  32. Will remove the element. After removal it will update the aggregate target and
  33. call the notification tree if the target was changed as a result of removing
  34. the request.
  35. From user mode:
  36. Only processes can register a pm_qos request. To provide for automatic
  37. cleanup of a process, the interface requires the process to register its
  38. parameter requests in the following way:
  39. To register the default pm_qos target for the specific parameter, the process
  40. must open one of /dev/[cpu_dma_latency, network_latency, network_throughput]
  41. As long as the device node is held open that process has a registered
  42. request on the parameter.
  43. To change the requested target value the process needs to write an s32 value to
  44. the open device node. Alternatively the user mode program could write a hex
  45. string for the value using 10 char long format e.g. "0x12345678". This
  46. translates to a pm_qos_update_request call.
  47. To remove the user mode request for a target value simply close the device
  48. node.