pcc-cpufreq.txt 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*
  2. * pcc-cpufreq.txt - PCC interface documentation
  3. *
  4. * Copyright (C) 2009 Red Hat, Matthew Garrett <mjg@redhat.com>
  5. * Copyright (C) 2009 Hewlett-Packard Development Company, L.P.
  6. * Nagananda Chumbalkar <nagananda.chumbalkar@hp.com>
  7. *
  8. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; version 2 of the License.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or NON
  17. * INFRINGEMENT. See the GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write to the Free Software Foundation, Inc.,
  21. * 675 Mass Ave, Cambridge, MA 02139, USA.
  22. *
  23. * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  24. */
  25. Processor Clocking Control Driver
  26. ---------------------------------
  27. Contents:
  28. ---------
  29. 1. Introduction
  30. 1.1 PCC interface
  31. 1.1.1 Get Average Frequency
  32. 1.1.2 Set Desired Frequency
  33. 1.2 Platforms affected
  34. 2. Driver and /sys details
  35. 2.1 scaling_available_frequencies
  36. 2.2 cpuinfo_transition_latency
  37. 2.3 cpuinfo_cur_freq
  38. 2.4 related_cpus
  39. 3. Caveats
  40. 1. Introduction:
  41. ----------------
  42. Processor Clocking Control (PCC) is an interface between the platform
  43. firmware and OSPM. It is a mechanism for coordinating processor
  44. performance (ie: frequency) between the platform firmware and the OS.
  45. The PCC driver (pcc-cpufreq) allows OSPM to take advantage of the PCC
  46. interface.
  47. OS utilizes the PCC interface to inform platform firmware what frequency the
  48. OS wants for a logical processor. The platform firmware attempts to achieve
  49. the requested frequency. If the request for the target frequency could not be
  50. satisfied by platform firmware, then it usually means that power budget
  51. conditions are in place, and "power capping" is taking place.
  52. 1.1 PCC interface:
  53. ------------------
  54. The complete PCC specification is available here:
  55. http://www.acpica.org/download/Processor-Clocking-Control-v1p0.pdf
  56. PCC relies on a shared memory region that provides a channel for communication
  57. between the OS and platform firmware. PCC also implements a "doorbell" that
  58. is used by the OS to inform the platform firmware that a command has been
  59. sent.
  60. The ACPI PCCH() method is used to discover the location of the PCC shared
  61. memory region. The shared memory region header contains the "command" and
  62. "status" interface. PCCH() also contains details on how to access the platform
  63. doorbell.
  64. The following commands are supported by the PCC interface:
  65. * Get Average Frequency
  66. * Set Desired Frequency
  67. The ACPI PCCP() method is implemented for each logical processor and is
  68. used to discover the offsets for the input and output buffers in the shared
  69. memory region.
  70. When PCC mode is enabled, the platform will not expose processor performance
  71. or throttle states (_PSS, _TSS and related ACPI objects) to OSPM. Therefore,
  72. the native P-state driver (such as acpi-cpufreq for Intel, powernow-k8 for
  73. AMD) will not load.
  74. However, OSPM remains in control of policy. The governor (eg: "ondemand")
  75. computes the required performance for each processor based on server workload.
  76. The PCC driver fills in the command interface, and the input buffer and
  77. communicates the request to the platform firmware. The platform firmware is
  78. responsible for delivering the requested performance.
  79. Each PCC command is "global" in scope and can affect all the logical CPUs in
  80. the system. Therefore, PCC is capable of performing "group" updates. With PCC
  81. the OS is capable of getting/setting the frequency of all the logical CPUs in
  82. the system with a single call to the BIOS.
  83. 1.1.1 Get Average Frequency:
  84. ----------------------------
  85. This command is used by the OSPM to query the running frequency of the
  86. processor since the last time this command was completed. The output buffer
  87. indicates the average unhalted frequency of the logical processor expressed as
  88. a percentage of the nominal (ie: maximum) CPU frequency. The output buffer
  89. also signifies if the CPU frequency is limited by a power budget condition.
  90. 1.1.2 Set Desired Frequency:
  91. ----------------------------
  92. This command is used by the OSPM to communicate to the platform firmware the
  93. desired frequency for a logical processor. The output buffer is currently
  94. ignored by OSPM. The next invocation of "Get Average Frequency" will inform
  95. OSPM if the desired frequency was achieved or not.
  96. 1.2 Platforms affected:
  97. -----------------------
  98. The PCC driver will load on any system where the platform firmware:
  99. * supports the PCC interface, and the associated PCCH() and PCCP() methods
  100. * assumes responsibility for managing the hardware clocking controls in order
  101. to deliver the requested processor performance
  102. Currently, certain HP ProLiant platforms implement the PCC interface. On those
  103. platforms PCC is the "default" choice.
  104. However, it is possible to disable this interface via a BIOS setting. In
  105. such an instance, as is also the case on platforms where the PCC interface
  106. is not implemented, the PCC driver will fail to load silently.
  107. 2. Driver and /sys details:
  108. ---------------------------
  109. When the driver loads, it merely prints the lowest and the highest CPU
  110. frequencies supported by the platform firmware.
  111. The PCC driver loads with a message such as:
  112. pcc-cpufreq: (v1.00.00) driver loaded with frequency limits: 1600 MHz, 2933
  113. MHz
  114. This means that the OPSM can request the CPU to run at any frequency in
  115. between the limits (1600 MHz, and 2933 MHz) specified in the message.
  116. Internally, there is no need for the driver to convert the "target" frequency
  117. to a corresponding P-state.
  118. The VERSION number for the driver will be of the format v.xy.ab.
  119. eg: 1.00.02
  120. ----- --
  121. | |
  122. | -- this will increase with bug fixes/enhancements to the driver
  123. |-- this is the version of the PCC specification the driver adheres to
  124. The following is a brief discussion on some of the fields exported via the
  125. /sys filesystem and how their values are affected by the PCC driver:
  126. 2.1 scaling_available_frequencies:
  127. ----------------------------------
  128. scaling_available_frequencies is not created in /sys. No intermediate
  129. frequencies need to be listed because the BIOS will try to achieve any
  130. frequency, within limits, requested by the governor. A frequency does not have
  131. to be strictly associated with a P-state.
  132. 2.2 cpuinfo_transition_latency:
  133. -------------------------------
  134. The cpuinfo_transition_latency field is 0. The PCC specification does
  135. not include a field to expose this value currently.
  136. 2.3 cpuinfo_cur_freq:
  137. ---------------------
  138. A) Often cpuinfo_cur_freq will show a value different than what is declared
  139. in the scaling_available_frequencies or scaling_cur_freq, or scaling_max_freq.
  140. This is due to "turbo boost" available on recent Intel processors. If certain
  141. conditions are met the BIOS can achieve a slightly higher speed than requested
  142. by OSPM. An example:
  143. scaling_cur_freq : 2933000
  144. cpuinfo_cur_freq : 3196000
  145. B) There is a round-off error associated with the cpuinfo_cur_freq value.
  146. Since the driver obtains the current frequency as a "percentage" (%) of the
  147. nominal frequency from the BIOS, sometimes, the values displayed by
  148. scaling_cur_freq and cpuinfo_cur_freq may not match. An example:
  149. scaling_cur_freq : 1600000
  150. cpuinfo_cur_freq : 1583000
  151. In this example, the nominal frequency is 2933 MHz. The driver obtains the
  152. current frequency, cpuinfo_cur_freq, as 54% of the nominal frequency:
  153. 54% of 2933 MHz = 1583 MHz
  154. Nominal frequency is the maximum frequency of the processor, and it usually
  155. corresponds to the frequency of the P0 P-state.
  156. 2.4 related_cpus:
  157. -----------------
  158. The related_cpus field is identical to affected_cpus.
  159. affected_cpus : 4
  160. related_cpus : 4
  161. Currently, the PCC driver does not evaluate _PSD. The platforms that support
  162. PCC do not implement SW_ALL. So OSPM doesn't need to perform any coordination
  163. to ensure that the same frequency is requested of all dependent CPUs.
  164. 3. Caveats:
  165. -----------
  166. The "cpufreq_stats" module in its present form cannot be loaded and
  167. expected to work with the PCC driver. Since the "cpufreq_stats" module
  168. provides information wrt each P-state, it is not applicable to the PCC driver.