~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/pm/amd-pstate.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/admin-guide/pm/amd-pstate.rst (Version linux-6.12-rc7) and /Documentation/admin-guide/pm/amd-pstate.rst (Version linux-6.11.7)


  1 .. SPDX-License-Identifier: GPL-2.0                 1 .. SPDX-License-Identifier: GPL-2.0
  2 .. include:: <isonum.txt>                           2 .. include:: <isonum.txt>
  3                                                     3 
  4 ==============================================      4 ===============================================
  5 ``amd-pstate`` CPU Performance Scaling Driver       5 ``amd-pstate`` CPU Performance Scaling Driver
  6 ==============================================      6 ===============================================
  7                                                     7 
  8 :Copyright: |copy| 2021 Advanced Micro Devices      8 :Copyright: |copy| 2021 Advanced Micro Devices, Inc.
  9                                                     9 
 10 :Author: Huang Rui <ray.huang@amd.com>              10 :Author: Huang Rui <ray.huang@amd.com>
 11                                                    11 
 12                                                    12 
 13 Introduction                                       13 Introduction
 14 ===================                                14 ===================
 15                                                    15 
 16 ``amd-pstate`` is the AMD CPU performance scal     16 ``amd-pstate`` is the AMD CPU performance scaling driver that introduces a
 17 new CPU frequency control mechanism on modern      17 new CPU frequency control mechanism on modern AMD APU and CPU series in
 18 Linux kernel. The new mechanism is based on Co     18 Linux kernel. The new mechanism is based on Collaborative Processor
 19 Performance Control (CPPC) which provides fine     19 Performance Control (CPPC) which provides finer grain frequency management
 20 than legacy ACPI hardware P-States. Current AM     20 than legacy ACPI hardware P-States. Current AMD CPU/APU platforms are using
 21 the ACPI P-states driver to manage CPU frequen     21 the ACPI P-states driver to manage CPU frequency and clocks with switching
 22 only in 3 P-states. CPPC replaces the ACPI P-s     22 only in 3 P-states. CPPC replaces the ACPI P-states controls and allows a
 23 flexible, low-latency interface for the Linux      23 flexible, low-latency interface for the Linux kernel to directly
 24 communicate the performance hints to hardware.     24 communicate the performance hints to hardware.
 25                                                    25 
 26 ``amd-pstate`` leverages the Linux kernel gove     26 ``amd-pstate`` leverages the Linux kernel governors such as ``schedutil``,
 27 ``ondemand``, etc. to manage the performance h     27 ``ondemand``, etc. to manage the performance hints which are provided by
 28 CPPC hardware functionality that internally fo     28 CPPC hardware functionality that internally follows the hardware
 29 specification (for details refer to AMD64 Arch     29 specification (for details refer to AMD64 Architecture Programmer's Manual
 30 Volume 2: System Programming [1]_). Currently,     30 Volume 2: System Programming [1]_). Currently, ``amd-pstate`` supports basic
 31 frequency control function according to kernel     31 frequency control function according to kernel governors on some of the
 32 Zen2 and Zen3 processors, and we will implemen     32 Zen2 and Zen3 processors, and we will implement more AMD specific functions
 33 in future after we verify them on the hardware     33 in future after we verify them on the hardware and SBIOS.
 34                                                    34 
 35                                                    35 
 36 AMD CPPC Overview                                  36 AMD CPPC Overview
 37 =======================                            37 =======================
 38                                                    38 
 39 Collaborative Processor Performance Control (C     39 Collaborative Processor Performance Control (CPPC) interface enumerates a
 40 continuous, abstract, and unit-less performanc     40 continuous, abstract, and unit-less performance value in a scale that is
 41 not tied to a specific performance state / fre     41 not tied to a specific performance state / frequency. This is an ACPI
 42 standard [2]_ which software can specify appli     42 standard [2]_ which software can specify application performance goals and
 43 hints as a relative target to the infrastructu     43 hints as a relative target to the infrastructure limits. AMD processors
 44 provide the low latency register model (MSR) i     44 provide the low latency register model (MSR) instead of an AML code
 45 interpreter for performance adjustments. ``amd     45 interpreter for performance adjustments. ``amd-pstate`` will initialize a
 46 ``struct cpufreq_driver`` instance, ``amd_psta     46 ``struct cpufreq_driver`` instance, ``amd_pstate_driver``, with the callbacks
 47 to manage each performance update behavior. ::     47 to manage each performance update behavior. ::
 48                                                    48 
 49  Highest Perf ------>+-----------------------+     49  Highest Perf ------>+-----------------------+                         +-----------------------+
 50                      |                       |     50                      |                       |                         |                       |
 51                      |                       |     51                      |                       |                         |                       |
 52                      |                       |     52                      |                       |          Max Perf  ---->|                       |
 53                      |                       |     53                      |                       |                         |                       |
 54                      |                       |     54                      |                       |                         |                       |
 55  Nominal Perf ------>+-----------------------+     55  Nominal Perf ------>+-----------------------+                         +-----------------------+
 56                      |                       |     56                      |                       |                         |                       |
 57                      |                       |     57                      |                       |                         |                       |
 58                      |                       |     58                      |                       |                         |                       |
 59                      |                       |     59                      |                       |                         |                       |
 60                      |                       |     60                      |                       |                         |                       |
 61                      |                       |     61                      |                       |                         |                       |
 62                      |                       |     62                      |                       |      Desired Perf  ---->|                       |
 63                      |                       |     63                      |                       |                         |                       |
 64                      |                       |     64                      |                       |                         |                       |
 65                      |                       |     65                      |                       |                         |                       |
 66                      |                       |     66                      |                       |                         |                       |
 67                      |                       |     67                      |                       |                         |                       |
 68                      |                       |     68                      |                       |                         |                       |
 69                      |                       |     69                      |                       |                         |                       |
 70                      |                       |     70                      |                       |                         |                       |
 71                      |                       |     71                      |                       |                         |                       |
 72   Lowest non-        |                       |     72   Lowest non-        |                       |                         |                       |
 73   linear perf ------>+-----------------------+     73   linear perf ------>+-----------------------+                         +-----------------------+
 74                      |                       |     74                      |                       |                         |                       |
 75                      |                       |     75                      |                       |       Lowest perf  ---->|                       |
 76                      |                       |     76                      |                       |                         |                       |
 77   Lowest perf ------>+-----------------------+     77   Lowest perf ------>+-----------------------+                         +-----------------------+
 78                      |                       |     78                      |                       |                         |                       |
 79                      |                       |     79                      |                       |                         |                       |
 80                      |                       |     80                      |                       |                         |                       |
 81           0   ------>+-----------------------+     81           0   ------>+-----------------------+                         +-----------------------+
 82                                                    82 
 83                                      AMD P-Sta     83                                      AMD P-States Performance Scale
 84                                                    84 
 85                                                    85 
 86 .. _perf_cap:                                      86 .. _perf_cap:
 87                                                    87 
 88 AMD CPPC Performance Capability                    88 AMD CPPC Performance Capability
 89 --------------------------------                   89 --------------------------------
 90                                                    90 
 91 Highest Performance (RO)                           91 Highest Performance (RO)
 92 .........................                          92 .........................
 93                                                    93 
 94 This is the absolute maximum performance an in     94 This is the absolute maximum performance an individual processor may reach,
 95 assuming ideal conditions. This performance le     95 assuming ideal conditions. This performance level may not be sustainable
 96 for long durations and may only be achievable      96 for long durations and may only be achievable if other platform components
 97 are in a specific state; for example, it may r     97 are in a specific state; for example, it may require other processors to be in
 98 an idle state. This would be equivalent to the     98 an idle state. This would be equivalent to the highest frequencies
 99 supported by the processor.                        99 supported by the processor.
100                                                   100 
101 Nominal (Guaranteed) Performance (RO)             101 Nominal (Guaranteed) Performance (RO)
102 ......................................            102 ......................................
103                                                   103 
104 This is the maximum sustained performance leve    104 This is the maximum sustained performance level of the processor, assuming
105 ideal operating conditions. In the absence of     105 ideal operating conditions. In the absence of an external constraint (power,
106 thermal, etc.), this is the performance level     106 thermal, etc.), this is the performance level the processor is expected to
107 be able to maintain continuously. All cores/pr    107 be able to maintain continuously. All cores/processors are expected to be
108 able to sustain their nominal performance stat    108 able to sustain their nominal performance state simultaneously.
109                                                   109 
110 Lowest non-linear Performance (RO)                110 Lowest non-linear Performance (RO)
111 ...................................               111 ...................................
112                                                   112 
113 This is the lowest performance level at which     113 This is the lowest performance level at which nonlinear power savings are
114 achieved, for example, due to the combined eff    114 achieved, for example, due to the combined effects of voltage and frequency
115 scaling. Above this threshold, lower performan    115 scaling. Above this threshold, lower performance levels should be generally
116 more energy efficient than higher performance     116 more energy efficient than higher performance levels. This register
117 effectively conveys the most efficient perform    117 effectively conveys the most efficient performance level to ``amd-pstate``.
118                                                   118 
119 Lowest Performance (RO)                           119 Lowest Performance (RO)
120 ........................                          120 ........................
121                                                   121 
122 This is the absolute lowest performance level     122 This is the absolute lowest performance level of the processor. Selecting a
123 performance level lower than the lowest nonlin    123 performance level lower than the lowest nonlinear performance level may
124 cause an efficiency penalty but should reduce     124 cause an efficiency penalty but should reduce the instantaneous power
125 consumption of the processor.                     125 consumption of the processor.
126                                                   126 
127 AMD CPPC Performance Control                      127 AMD CPPC Performance Control
128 ------------------------------                    128 ------------------------------
129                                                   129 
130 ``amd-pstate`` passes performance goals throug    130 ``amd-pstate`` passes performance goals through these registers. The
131 register drives the behavior of the desired pe    131 register drives the behavior of the desired performance target.
132                                                   132 
133 Minimum requested performance (RW)                133 Minimum requested performance (RW)
134 ...................................               134 ...................................
135                                                   135 
136 ``amd-pstate`` specifies the minimum allowed p    136 ``amd-pstate`` specifies the minimum allowed performance level.
137                                                   137 
138 Maximum requested performance (RW)                138 Maximum requested performance (RW)
139 ...................................               139 ...................................
140                                                   140 
141 ``amd-pstate`` specifies a limit the maximum p    141 ``amd-pstate`` specifies a limit the maximum performance that is expected
142 to be supplied by the hardware.                   142 to be supplied by the hardware.
143                                                   143 
144 Desired performance target (RW)                   144 Desired performance target (RW)
145 ...................................               145 ...................................
146                                                   146 
147 ``amd-pstate`` specifies a desired target in t    147 ``amd-pstate`` specifies a desired target in the CPPC performance scale as
148 a relative number. This can be expressed as pe    148 a relative number. This can be expressed as percentage of nominal
149 performance (infrastructure max). Below the no    149 performance (infrastructure max). Below the nominal sustained performance
150 level, desired performance expresses the avera    150 level, desired performance expresses the average performance level of the
151 processor subject to hardware. Above the nomin    151 processor subject to hardware. Above the nominal performance level,
152 the processor must provide at least nominal pe    152 the processor must provide at least nominal performance requested and go higher
153 if current operating conditions allow.            153 if current operating conditions allow.
154                                                   154 
155 Energy Performance Preference (EPP) (RW)          155 Energy Performance Preference (EPP) (RW)
156 .........................................         156 .........................................
157                                                   157 
158 This attribute provides a hint to the hardware    158 This attribute provides a hint to the hardware if software wants to bias
159 toward performance (0x0) or energy efficiency     159 toward performance (0x0) or energy efficiency (0xff).
160                                                   160 
161                                                   161 
162 Key Governors Support                             162 Key Governors Support
163 =======================                           163 =======================
164                                                   164 
165 ``amd-pstate`` can be used with all the (gener    165 ``amd-pstate`` can be used with all the (generic) scaling governors listed
166 by the ``scaling_available_governors`` policy     166 by the ``scaling_available_governors`` policy attribute in ``sysfs``. Then,
167 it is responsible for the configuration of pol    167 it is responsible for the configuration of policy objects corresponding to
168 CPUs and provides the ``CPUFreq`` core (and th    168 CPUs and provides the ``CPUFreq`` core (and the scaling governors attached
169 to the policy objects) with accurate informati    169 to the policy objects) with accurate information on the maximum and minimum
170 operating frequencies supported by the hardwar    170 operating frequencies supported by the hardware. Users can check the
171 ``scaling_cur_freq`` information comes from th    171 ``scaling_cur_freq`` information comes from the ``CPUFreq`` core.
172                                                   172 
173 ``amd-pstate`` mainly supports ``schedutil`` a    173 ``amd-pstate`` mainly supports ``schedutil`` and ``ondemand`` for dynamic
174 frequency control. It is to fine tune the proc    174 frequency control. It is to fine tune the processor configuration on
175 ``amd-pstate`` to the ``schedutil`` with CPU C    175 ``amd-pstate`` to the ``schedutil`` with CPU CFS scheduler. ``amd-pstate``
176 registers the adjust_perf callback to implemen    176 registers the adjust_perf callback to implement performance update behavior
177 similar to CPPC. It is initialized by ``sugov_    177 similar to CPPC. It is initialized by ``sugov_start`` and then populates the
178 CPU's update_util_data pointer to assign ``sug    178 CPU's update_util_data pointer to assign ``sugov_update_single_perf`` as the
179 utilization update callback function in the CP    179 utilization update callback function in the CPU scheduler. The CPU scheduler
180 will call ``cpufreq_update_util`` and assigns     180 will call ``cpufreq_update_util`` and assigns the target performance according
181 to the ``struct sugov_cpu`` that the utilizati    181 to the ``struct sugov_cpu`` that the utilization update belongs to.
182 Then, ``amd-pstate`` updates the desired perfo    182 Then, ``amd-pstate`` updates the desired performance according to the CPU
183 scheduler assigned.                               183 scheduler assigned.
184                                                   184 
185 .. _processor_support:                            185 .. _processor_support:
186                                                   186 
187 Processor Support                                 187 Processor Support
188 =======================                           188 =======================
189                                                   189 
190 The ``amd-pstate`` initialization will fail if    190 The ``amd-pstate`` initialization will fail if the ``_CPC`` entry in the ACPI
191 SBIOS does not exist in the detected processor    191 SBIOS does not exist in the detected processor. It uses ``acpi_cpc_valid``
192 to check the existence of ``_CPC``. All Zen ba    192 to check the existence of ``_CPC``. All Zen based processors support the legacy
193 ACPI hardware P-States function, so when ``amd    193 ACPI hardware P-States function, so when ``amd-pstate`` fails initialization,
194 the kernel will fall back to initialize the ``    194 the kernel will fall back to initialize the ``acpi-cpufreq`` driver.
195                                                   195 
196 There are two types of hardware implementation    196 There are two types of hardware implementations for ``amd-pstate``: one is
197 `Full MSR Support <perf_cap_>`_ and another is    197 `Full MSR Support <perf_cap_>`_ and another is `Shared Memory Support
198 <perf_cap_>`_. It can use the :c:macro:`X86_FE    198 <perf_cap_>`_. It can use the :c:macro:`X86_FEATURE_CPPC` feature flag to
199 indicate the different types. (For details, re    199 indicate the different types. (For details, refer to the Processor Programming
200 Reference (PPR) for AMD Family 19h Model 51h,     200 Reference (PPR) for AMD Family 19h Model 51h, Revision A1 Processors [3]_.)
201 ``amd-pstate`` is to register different ``stat    201 ``amd-pstate`` is to register different ``static_call`` instances for different
202 hardware implementations.                         202 hardware implementations.
203                                                   203 
204 Currently, some of the Zen2 and Zen3 processor    204 Currently, some of the Zen2 and Zen3 processors support ``amd-pstate``. In the
205 future, it will be supported on more and more     205 future, it will be supported on more and more AMD processors.
206                                                   206 
207 Full MSR Support                                  207 Full MSR Support
208 -----------------                                 208 -----------------
209                                                   209 
210 Some new Zen3 processors such as Cezanne provi    210 Some new Zen3 processors such as Cezanne provide the MSR registers directly
211 while the :c:macro:`X86_FEATURE_CPPC` CPU feat    211 while the :c:macro:`X86_FEATURE_CPPC` CPU feature flag is set.
212 ``amd-pstate`` can handle the MSR register to     212 ``amd-pstate`` can handle the MSR register to implement the fast switch
213 function in ``CPUFreq`` that can reduce the la    213 function in ``CPUFreq`` that can reduce the latency of frequency control in
214 interrupt context. The functions with a ``psta    214 interrupt context. The functions with a ``pstate_xxx`` prefix represent the
215 operations on MSR registers.                      215 operations on MSR registers.
216                                                   216 
217 Shared Memory Support                             217 Shared Memory Support
218 ----------------------                            218 ----------------------
219                                                   219 
220 If the :c:macro:`X86_FEATURE_CPPC` CPU feature    220 If the :c:macro:`X86_FEATURE_CPPC` CPU feature flag is not set, the
221 processor supports the shared memory solution.    221 processor supports the shared memory solution. In this case, ``amd-pstate``
222 uses the ``cppc_acpi`` helper methods to imple    222 uses the ``cppc_acpi`` helper methods to implement the callback functions
223 that are defined on ``static_call``. The funct    223 that are defined on ``static_call``. The functions with the ``cppc_xxx`` prefix
224 represent the operations of ACPI CPPC helpers     224 represent the operations of ACPI CPPC helpers for the shared memory solution.
225                                                   225 
226                                                   226 
227 AMD P-States and ACPI hardware P-States always    227 AMD P-States and ACPI hardware P-States always can be supported in one
228 processor. But AMD P-States has the higher pri    228 processor. But AMD P-States has the higher priority and if it is enabled
229 with :c:macro:`MSR_AMD_CPPC_ENABLE` or ``cppc_    229 with :c:macro:`MSR_AMD_CPPC_ENABLE` or ``cppc_set_enable``, it will respond
230 to the request from AMD P-States.                 230 to the request from AMD P-States.
231                                                   231 
232                                                   232 
233 User Space Interface in ``sysfs`` - Per-policy    233 User Space Interface in ``sysfs`` - Per-policy control
234 ==============================================    234 ======================================================
235                                                   235 
236 ``amd-pstate`` exposes several global attribut    236 ``amd-pstate`` exposes several global attributes (files) in ``sysfs`` to
237 control its functionality at the system level.    237 control its functionality at the system level. They are located in the
238 ``/sys/devices/system/cpu/cpufreq/policyX/`` d    238 ``/sys/devices/system/cpu/cpufreq/policyX/`` directory and affect all CPUs. ::
239                                                   239 
240  root@hr-test1:/home/ray# ls /sys/devices/syst    240  root@hr-test1:/home/ray# ls /sys/devices/system/cpu/cpufreq/policy0/*amd*
241  /sys/devices/system/cpu/cpufreq/policy0/amd_p    241  /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf
242  /sys/devices/system/cpu/cpufreq/policy0/amd_p    242  /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq
243  /sys/devices/system/cpu/cpufreq/policy0/amd_p    243  /sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq
244                                                   244 
245                                                   245 
246 ``amd_pstate_highest_perf / amd_pstate_max_fre    246 ``amd_pstate_highest_perf / amd_pstate_max_freq``
247                                                   247 
248 Maximum CPPC performance and CPU frequency tha    248 Maximum CPPC performance and CPU frequency that the driver is allowed to
249 set, in percent of the maximum supported CPPC     249 set, in percent of the maximum supported CPPC performance level (the highest
250 performance supported in `AMD CPPC Performance    250 performance supported in `AMD CPPC Performance Capability <perf_cap_>`_).
251 In some ASICs, the highest CPPC performance is    251 In some ASICs, the highest CPPC performance is not the one in the ``_CPC``
252 table, so we need to expose it to sysfs. If bo    252 table, so we need to expose it to sysfs. If boost is not active, but
253 still supported, this maximum frequency will b    253 still supported, this maximum frequency will be larger than the one in
254 ``cpuinfo``. On systems that support preferred !! 254 ``cpuinfo``.
255 different values for some cores than others an << 
256 advertised by the platform at bootup.          << 
257 This attribute is read-only.                      255 This attribute is read-only.
258                                                   256 
259 ``amd_pstate_lowest_nonlinear_freq``              257 ``amd_pstate_lowest_nonlinear_freq``
260                                                   258 
261 The lowest non-linear CPPC CPU frequency that     259 The lowest non-linear CPPC CPU frequency that the driver is allowed to set,
262 in percent of the maximum supported CPPC perfo    260 in percent of the maximum supported CPPC performance level. (Please see the
263 lowest non-linear performance in `AMD CPPC Per    261 lowest non-linear performance in `AMD CPPC Performance Capability
264 <perf_cap_>`_.)                                   262 <perf_cap_>`_.)
265 This attribute is read-only.                      263 This attribute is read-only.
266                                                << 
267 ``amd_pstate_hw_prefcore``                     << 
268                                                << 
269 Whether the platform supports the preferred co << 
270 enabled. This attribute is read-only.          << 
271                                                << 
272 ``amd_pstate_prefcore_ranking``                << 
273                                                << 
274 The performance ranking of the core. This numb << 
275 larger numbers are preferred at the time of re << 
276 runtime based on platform conditions. This att << 
277                                                   264 
278 ``energy_performance_available_preferences``      265 ``energy_performance_available_preferences``
279                                                   266 
280 A list of all the supported EPP preferences th    267 A list of all the supported EPP preferences that could be used for
281 ``energy_performance_preference`` on this syst    268 ``energy_performance_preference`` on this system.
282 These profiles represent different hints that     269 These profiles represent different hints that are provided
283 to the low-level firmware about the user's des    270 to the low-level firmware about the user's desired energy vs efficiency
284 tradeoff.  ``default`` represents the epp valu    271 tradeoff.  ``default`` represents the epp value is set by platform
285 firmware. This attribute is read-only.            272 firmware. This attribute is read-only.
286                                                   273 
287 ``energy_performance_preference``                 274 ``energy_performance_preference``
288                                                   275 
289 The current energy performance preference can     276 The current energy performance preference can be read from this attribute.
290 and user can change current preference accordi    277 and user can change current preference according to energy or performance needs
291 Please get all support profiles list from         278 Please get all support profiles list from
292 ``energy_performance_available_preferences`` a    279 ``energy_performance_available_preferences`` attribute, all the profiles are
293 integer values defined between 0 to 255 when E    280 integer values defined between 0 to 255 when EPP feature is enabled by platform
294 firmware, if EPP feature is disabled, driver w    281 firmware, if EPP feature is disabled, driver will ignore the written value
295 This attribute is read-write.                     282 This attribute is read-write.
296                                                   283 
297 ``boost``                                         284 ``boost``
298 The `boost` sysfs attribute provides control o    285 The `boost` sysfs attribute provides control over the CPU core
299 performance boost, allowing users to manage th    286 performance boost, allowing users to manage the maximum frequency limitation
300 of the CPU. This attribute can be used to enab    287 of the CPU. This attribute can be used to enable or disable the boost feature
301 on individual CPUs.                               288 on individual CPUs.
302                                                   289 
303 When the boost feature is enabled, the CPU can    290 When the boost feature is enabled, the CPU can dynamically increase its frequency
304 beyond the base frequency, providing enhanced     291 beyond the base frequency, providing enhanced performance for demanding workloads.
305 On the other hand, disabling the boost feature    292 On the other hand, disabling the boost feature restricts the CPU to operate at the
306 base frequency, which may be desirable in cert    293 base frequency, which may be desirable in certain scenarios to prioritize power
307 efficiency or manage temperature.                 294 efficiency or manage temperature.
308                                                   295 
309 To manipulate the `boost` attribute, users can    296 To manipulate the `boost` attribute, users can write a value of `0` to disable the
310 boost or `1` to enable it, for the respective     297 boost or `1` to enable it, for the respective CPU using the sysfs path
311 `/sys/devices/system/cpu/cpuX/cpufreq/boost`,     298 `/sys/devices/system/cpu/cpuX/cpufreq/boost`, where `X` represents the CPU number.
312                                                   299 
313 Other performance and frequency values can be     300 Other performance and frequency values can be read back from
314 ``/sys/devices/system/cpu/cpuX/acpi_cppc/``, s    301 ``/sys/devices/system/cpu/cpuX/acpi_cppc/``, see :ref:`cppc_sysfs`.
315                                                   302 
316                                                   303 
317 ``amd-pstate`` vs ``acpi-cpufreq``                304 ``amd-pstate`` vs ``acpi-cpufreq``
318 ======================================            305 ======================================
319                                                   306 
320 On the majority of AMD platforms supported by     307 On the majority of AMD platforms supported by ``acpi-cpufreq``, the ACPI tables
321 provided by the platform firmware are used for    308 provided by the platform firmware are used for CPU performance scaling, but
322 only provide 3 P-states on AMD processors.        309 only provide 3 P-states on AMD processors.
323 However, on modern AMD APU and CPU series, har    310 However, on modern AMD APU and CPU series, hardware provides the Collaborative
324 Processor Performance Control according to the    311 Processor Performance Control according to the ACPI protocol and customizes this
325 for AMD platforms. That is, fine-grained and c    312 for AMD platforms. That is, fine-grained and continuous frequency ranges
326 instead of the legacy hardware P-states. ``amd    313 instead of the legacy hardware P-states. ``amd-pstate`` is the kernel
327 module which supports the new AMD P-States mec    314 module which supports the new AMD P-States mechanism on most of the future AMD
328 platforms. The AMD P-States mechanism is the m    315 platforms. The AMD P-States mechanism is the more performance and energy
329 efficiency frequency management method on AMD     316 efficiency frequency management method on AMD processors.
330                                                   317 
331                                                   318 
332 ``amd-pstate`` Driver Operation Modes             319 ``amd-pstate`` Driver Operation Modes
333 ======================================            320 ======================================
334                                                   321 
335 ``amd_pstate`` CPPC has 3 operation modes: aut    322 ``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode,
336 non-autonomous (passive) mode and guided auton    323 non-autonomous (passive) mode and guided autonomous (guided) mode.
337 Active/passive/guided mode can be chosen by di    324 Active/passive/guided mode can be chosen by different kernel parameters.
338                                                   325 
339 - In autonomous mode, platform ignores the des    326 - In autonomous mode, platform ignores the desired performance level request
340   and takes into account only the values set t    327   and takes into account only the values set to the minimum, maximum and energy
341   performance preference registers.               328   performance preference registers.
342 - In non-autonomous mode, platform gets desire    329 - In non-autonomous mode, platform gets desired performance level
343   from OS directly through Desired Performance    330   from OS directly through Desired Performance Register.
344 - In guided-autonomous mode, platform sets ope    331 - In guided-autonomous mode, platform sets operating performance level
345   autonomously according to the current worklo    332   autonomously according to the current workload and within the limits set by
346   OS through min and max performance registers    333   OS through min and max performance registers.
347                                                   334 
348 Active Mode                                       335 Active Mode
349 ------------                                      336 ------------
350                                                   337 
351 ``amd_pstate=active``                             338 ``amd_pstate=active``
352                                                   339 
353 This is the low-level firmware control mode wh    340 This is the low-level firmware control mode which is implemented by ``amd_pstate_epp``
354 driver with ``amd_pstate=active`` passed to th    341 driver with ``amd_pstate=active`` passed to the kernel in the command line.
355 In this mode, ``amd_pstate_epp`` driver provid    342 In this mode, ``amd_pstate_epp`` driver provides a hint to the hardware if software
356 wants to bias toward performance (0x0) or ener    343 wants to bias toward performance (0x0) or energy efficiency (0xff) to the CPPC firmware.
357 then CPPC power algorithm will calculate the r    344 then CPPC power algorithm will calculate the runtime workload and adjust the realtime
358 cores frequency according to the power supply     345 cores frequency according to the power supply and thermal, core voltage and some other
359 hardware conditions.                              346 hardware conditions.
360                                                   347 
361 Passive Mode                                      348 Passive Mode
362 ------------                                      349 ------------
363                                                   350 
364 ``amd_pstate=passive``                            351 ``amd_pstate=passive``
365                                                   352 
366 It will be enabled if the ``amd_pstate=passive    353 It will be enabled if the ``amd_pstate=passive`` is passed to the kernel in the command line.
367 In this mode, ``amd_pstate`` driver software s    354 In this mode, ``amd_pstate`` driver software specifies a desired QoS target in the CPPC
368 performance scale as a relative number. This c    355 performance scale as a relative number. This can be expressed as percentage of nominal
369 performance (infrastructure max). Below the no    356 performance (infrastructure max). Below the nominal sustained performance level,
370 desired performance expresses the average perf    357 desired performance expresses the average performance level of the processor subject
371 to the Performance Reduction Tolerance registe    358 to the Performance Reduction Tolerance register. Above the nominal performance level,
372 processor must provide at least nominal perfor    359 processor must provide at least nominal performance requested and go higher if current
373 operating conditions allow.                       360 operating conditions allow.
374                                                   361 
375 Guided Mode                                       362 Guided Mode
376 -----------                                       363 -----------
377                                                   364 
378 ``amd_pstate=guided``                             365 ``amd_pstate=guided``
379                                                   366 
380 If ``amd_pstate=guided`` is passed to kernel c    367 If ``amd_pstate=guided`` is passed to kernel command line option then this mode
381 is activated.  In this mode, driver requests m    368 is activated.  In this mode, driver requests minimum and maximum performance
382 level and the platform autonomously selects a     369 level and the platform autonomously selects a performance level in this range
383 and appropriate to the current workload.          370 and appropriate to the current workload.
384                                                   371 
385 ``amd-pstate`` Preferred Core                     372 ``amd-pstate`` Preferred Core
386 =================================                 373 =================================
387                                                   374 
388 The core frequency is subjected to the process    375 The core frequency is subjected to the process variation in semiconductors.
389 Not all cores are able to reach the maximum fr    376 Not all cores are able to reach the maximum frequency respecting the
390 infrastructure limits. Consequently, AMD has r    377 infrastructure limits. Consequently, AMD has redefined the concept of
391 maximum frequency of a part. This means that a    378 maximum frequency of a part. This means that a fraction of cores can reach
392 maximum frequency. To find the best process sc    379 maximum frequency. To find the best process scheduling policy for a given
393 scenario, OS needs to know the core ordering i    380 scenario, OS needs to know the core ordering informed by the platform through
394 highest performance capability register of the    381 highest performance capability register of the CPPC interface.
395                                                   382 
396 ``amd-pstate`` preferred core enables the sche    383 ``amd-pstate`` preferred core enables the scheduler to prefer scheduling on
397 cores that can achieve a higher frequency with    384 cores that can achieve a higher frequency with lower voltage. The preferred
398 core rankings can dynamically change based on     385 core rankings can dynamically change based on the workload, platform conditions,
399 thermals and ageing.                              386 thermals and ageing.
400                                                   387 
401 The priority metric will be initialized by the    388 The priority metric will be initialized by the ``amd-pstate`` driver. The ``amd-pstate``
402 driver will also determine whether or not ``am    389 driver will also determine whether or not ``amd-pstate`` preferred core is
403 supported by the platform.                        390 supported by the platform.
404                                                   391 
405 ``amd-pstate`` driver will provide an initial     392 ``amd-pstate`` driver will provide an initial core ordering when the system boots.
406 The platform uses the CPPC interfaces to commu    393 The platform uses the CPPC interfaces to communicate the core ranking to the
407 operating system and scheduler to make sure th    394 operating system and scheduler to make sure that OS is choosing the cores
408 with highest performance firstly for schedulin    395 with highest performance firstly for scheduling the process. When ``amd-pstate``
409 driver receives a message with the highest per    396 driver receives a message with the highest performance change, it will
410 update the core ranking and set the cpu's prio    397 update the core ranking and set the cpu's priority.
411                                                   398 
412 ``amd-pstate`` Preferred Core Switch              399 ``amd-pstate`` Preferred Core Switch
413 =====================================             400 =====================================
414 Kernel Parameters                                 401 Kernel Parameters
415 -----------------                                 402 -----------------
416                                                   403 
417 ``amd-pstate`` peferred core`` has two states:    404 ``amd-pstate`` peferred core`` has two states: enable and disable.
418 Enable/disable states can be chosen by differe    405 Enable/disable states can be chosen by different kernel parameters.
419 Default enable ``amd-pstate`` preferred core.     406 Default enable ``amd-pstate`` preferred core.
420                                                   407 
421 ``amd_prefcore=disable``                          408 ``amd_prefcore=disable``
422                                                   409 
423 For systems that support ``amd-pstate`` prefer    410 For systems that support ``amd-pstate`` preferred core, the core rankings will
424 always be advertised by the platform. But OS c    411 always be advertised by the platform. But OS can choose to ignore that via the
425 kernel parameter ``amd_prefcore=disable``.        412 kernel parameter ``amd_prefcore=disable``.
426                                                   413 
427 User Space Interface in ``sysfs`` - General       414 User Space Interface in ``sysfs`` - General
428 ===========================================       415 ===========================================
429                                                   416 
430 Global Attributes                                 417 Global Attributes
431 -----------------                                 418 -----------------
432                                                   419 
433 ``amd-pstate`` exposes several global attribut    420 ``amd-pstate`` exposes several global attributes (files) in ``sysfs`` to
434 control its functionality at the system level.    421 control its functionality at the system level.  They are located in the
435 ``/sys/devices/system/cpu/amd_pstate/`` direct    422 ``/sys/devices/system/cpu/amd_pstate/`` directory and affect all CPUs.
436                                                   423 
437 ``status``                                        424 ``status``
438         Operation mode of the driver: "active"    425         Operation mode of the driver: "active", "passive", "guided" or "disable".
439                                                   426 
440         "active"                                  427         "active"
441                 The driver is functional and i    428                 The driver is functional and in the ``active mode``
442                                                   429 
443         "passive"                                 430         "passive"
444                 The driver is functional and i    431                 The driver is functional and in the ``passive mode``
445                                                   432 
446         "guided"                                  433         "guided"
447                 The driver is functional and i    434                 The driver is functional and in the ``guided mode``
448                                                   435 
449         "disable"                                 436         "disable"
450                 The driver is unregistered and    437                 The driver is unregistered and not functional now.
451                                                   438 
452         This attribute can be written to in or    439         This attribute can be written to in order to change the driver's
453         operation mode or to unregister it.  T    440         operation mode or to unregister it.  The string written to it must be
454         one of the possible values of it and,     441         one of the possible values of it and, if successful, writing one of
455         these values to the sysfs file will ca    442         these values to the sysfs file will cause the driver to switch over
456         to the operation mode represented by t    443         to the operation mode represented by that string - or to be
457         unregistered in the "disable" case.       444         unregistered in the "disable" case.
458                                                   445 
459 ``prefcore``                                      446 ``prefcore``
460         Preferred core state of the driver: "e    447         Preferred core state of the driver: "enabled" or "disabled".
461                                                   448 
462         "enabled"                                 449         "enabled"
463                 Enable the ``amd-pstate`` pref    450                 Enable the ``amd-pstate`` preferred core.
464                                                   451 
465         "disabled"                                452         "disabled"
466                 Disable the ``amd-pstate`` pre    453                 Disable the ``amd-pstate`` preferred core
467                                                   454 
468                                                   455 
469         This attribute is read-only to check t    456         This attribute is read-only to check the state of preferred core set
470         by the kernel parameter.                  457         by the kernel parameter.
471                                                   458 
472 ``cpupower`` tool support for ``amd-pstate``      459 ``cpupower`` tool support for ``amd-pstate``
473 ==============================================    460 ===============================================
474                                                   461 
475 ``amd-pstate`` is supported by the ``cpupower`    462 ``amd-pstate`` is supported by the ``cpupower`` tool, which can be used to dump
476 frequency information. Development is in progr    463 frequency information. Development is in progress to support more and more
477 operations for the new ``amd-pstate`` module w    464 operations for the new ``amd-pstate`` module with this tool. ::
478                                                   465 
479  root@hr-test1:/home/ray# cpupower frequency-i    466  root@hr-test1:/home/ray# cpupower frequency-info
480  analyzing CPU 0:                                 467  analyzing CPU 0:
481    driver: amd-pstate                             468    driver: amd-pstate
482    CPUs which run at the same hardware frequen    469    CPUs which run at the same hardware frequency: 0
483    CPUs which need to have their frequency coo    470    CPUs which need to have their frequency coordinated by software: 0
484    maximum transition latency: 131 us             471    maximum transition latency: 131 us
485    hardware limits: 400 MHz - 4.68 GHz            472    hardware limits: 400 MHz - 4.68 GHz
486    available cpufreq governors: ondemand conse    473    available cpufreq governors: ondemand conservative powersave userspace performance schedutil
487    current policy: frequency should be within     474    current policy: frequency should be within 400 MHz and 4.68 GHz.
488                    The governor "schedutil" ma    475                    The governor "schedutil" may decide which speed to use
489                    within this range.             476                    within this range.
490    current CPU frequency: Unable to call hardw    477    current CPU frequency: Unable to call hardware
491    current CPU frequency: 4.02 GHz (asserted b    478    current CPU frequency: 4.02 GHz (asserted by call to kernel)
492    boost state support:                           479    boost state support:
493      Supported: yes                               480      Supported: yes
494      Active: yes                                  481      Active: yes
495      AMD PSTATE Highest Performance: 166. Maxi    482      AMD PSTATE Highest Performance: 166. Maximum Frequency: 4.68 GHz.
496      AMD PSTATE Nominal Performance: 117. Nomi    483      AMD PSTATE Nominal Performance: 117. Nominal Frequency: 3.30 GHz.
497      AMD PSTATE Lowest Non-linear Performance:    484      AMD PSTATE Lowest Non-linear Performance: 39. Lowest Non-linear Frequency: 1.10 GHz.
498      AMD PSTATE Lowest Performance: 15. Lowest    485      AMD PSTATE Lowest Performance: 15. Lowest Frequency: 400 MHz.
499                                                   486 
500                                                   487 
501 Diagnostics and Tuning                            488 Diagnostics and Tuning
502 =======================                           489 =======================
503                                                   490 
504 Trace Events                                      491 Trace Events
505 --------------                                    492 --------------
506                                                   493 
507 There are two static trace events that can be     494 There are two static trace events that can be used for ``amd-pstate``
508 diagnostics. One of them is the ``cpu_frequenc    495 diagnostics. One of them is the ``cpu_frequency`` trace event generally used
509 by ``CPUFreq``, and the other one is the ``amd    496 by ``CPUFreq``, and the other one is the ``amd_pstate_perf`` trace event
510 specific to ``amd-pstate``.  The following seq    497 specific to ``amd-pstate``.  The following sequence of shell commands can
511 be used to enable them and see their output (i    498 be used to enable them and see their output (if the kernel is
512 configured to support event tracing). ::          499 configured to support event tracing). ::
513                                                   500 
514  root@hr-test1:/home/ray# cd /sys/kernel/traci    501  root@hr-test1:/home/ray# cd /sys/kernel/tracing/
515  root@hr-test1:/sys/kernel/tracing# echo 1 > e    502  root@hr-test1:/sys/kernel/tracing# echo 1 > events/amd_cpu/enable
516  root@hr-test1:/sys/kernel/tracing# cat trace     503  root@hr-test1:/sys/kernel/tracing# cat trace
517  # tracer: nop                                    504  # tracer: nop
518  #                                                505  #
519  # entries-in-buffer/entries-written: 47827/42    506  # entries-in-buffer/entries-written: 47827/42233061   #P:2
520  #                                                507  #
521  #                                _-----=> irq    508  #                                _-----=> irqs-off
522  #                               / _----=> nee    509  #                               / _----=> need-resched
523  #                              | / _---=> har    510  #                              | / _---=> hardirq/softirq
524  #                              || / _--=> pre    511  #                              || / _--=> preempt-depth
525  #                              ||| /     dela    512  #                              ||| /     delay
526  #           TASK-PID     CPU#  ||||   TIMESTA    513  #           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
527  #              | |         |   ||||      |       514  #              | |         |   ||||      |         |
528           <idle>-0       [015] dN...  4995.979    515           <idle>-0       [015] dN...  4995.979886: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_perf=166 cpu_id=15 changed=false fast_switch=true
529           <idle>-0       [007] d.h..  4995.979    516           <idle>-0       [007] d.h..  4995.979893: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_perf=166 cpu_id=7 changed=false fast_switch=true
530              cat-2161    [000] d....  4995.980    517              cat-2161    [000] d....  4995.980841: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_perf=166 cpu_id=0 changed=false fast_switch=true
531             sshd-2125    [004] d.s..  4995.980    518             sshd-2125    [004] d.s..  4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_perf=166 cpu_id=4 changed=false fast_switch=true
532           <idle>-0       [007] d.s..  4995.980    519           <idle>-0       [007] d.s..  4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_perf=166 cpu_id=7 changed=false fast_switch=true
533           <idle>-0       [003] d.s..  4995.980    520           <idle>-0       [003] d.s..  4995.980971: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_perf=166 cpu_id=3 changed=false fast_switch=true
534           <idle>-0       [011] d.s..  4995.980    521           <idle>-0       [011] d.s..  4995.980996: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_perf=166 cpu_id=11 changed=false fast_switch=true
535                                                   522 
536 The ``cpu_frequency`` trace event will be trig    523 The ``cpu_frequency`` trace event will be triggered either by the ``schedutil`` scaling
537 governor (for the policies it is attached to),    524 governor (for the policies it is attached to), or by the ``CPUFreq`` core (for the
538 policies with other scaling governors).           525 policies with other scaling governors).
539                                                   526 
540                                                   527 
541 Tracer Tool                                       528 Tracer Tool
542 -------------                                     529 -------------
543                                                   530 
544 ``amd_pstate_tracer.py`` can record and parse     531 ``amd_pstate_tracer.py`` can record and parse ``amd-pstate`` trace log, then
545 generate performance plots. This utility can b    532 generate performance plots. This utility can be used to debug and tune the
546 performance of ``amd-pstate`` driver. The trac    533 performance of ``amd-pstate`` driver. The tracer tool needs to import intel
547 pstate tracer.                                    534 pstate tracer.
548                                                   535 
549 Tracer tool located in ``linux/tools/power/x86    536 Tracer tool located in ``linux/tools/power/x86/amd_pstate_tracer``. It can be
550 used in two ways. If trace file is available,     537 used in two ways. If trace file is available, then directly parse the file
551 with command ::                                   538 with command ::
552                                                   539 
553  ./amd_pstate_trace.py [-c cpus] -t <trace_fil    540  ./amd_pstate_trace.py [-c cpus] -t <trace_file> -n <test_name>
554                                                   541 
555 Or generate trace file with root privilege, th    542 Or generate trace file with root privilege, then parse and plot with command ::
556                                                   543 
557  sudo ./amd_pstate_trace.py [-c cpus] -n <test    544  sudo ./amd_pstate_trace.py [-c cpus] -n <test_name> -i <interval> [-m kbytes]
558                                                   545 
559 The test result can be found in ``results/test    546 The test result can be found in ``results/test_name``. Following is the example
560 about part of the output. ::                      547 about part of the output. ::
561                                                   548 
562  common_cpu  common_secs  common_usecs  min_pe    549  common_cpu  common_secs  common_usecs  min_perf  des_perf  max_perf  freq    mperf   apef    tsc       load   duration_ms  sample_num  elapsed_time  common_comm
563  CPU_005     712          116384        39        550  CPU_005     712          116384        39        49        166       0.7565  9645075 2214891 38431470  25.1   11.646       469         2.496         kworker/5:0-40
564  CPU_006     712          116408        39        551  CPU_006     712          116408        39        49        166       0.6769  8950227 1839034 37192089  24.06  11.272       470         2.496         kworker/6:0-1264
565                                                   552 
566 Unit Tests for amd-pstate                         553 Unit Tests for amd-pstate
567 -------------------------                         554 -------------------------
568                                                   555 
569 ``amd-pstate-ut`` is a test module for testing    556 ``amd-pstate-ut`` is a test module for testing the ``amd-pstate`` driver.
570                                                   557 
571  * It can help all users to verify their proce    558  * It can help all users to verify their processor support (SBIOS/Firmware or Hardware).
572                                                   559 
573  * Kernel can have a basic function test to av    560  * Kernel can have a basic function test to avoid the kernel regression during the update.
574                                                   561 
575  * We can introduce more functional or perform    562  * We can introduce more functional or performance tests to align the result together, it will benefit power and performance scale optimization.
576                                                   563 
577 1. Test case descriptions                         564 1. Test case descriptions
578                                                   565 
579     1). Basic tests                               566     1). Basic tests
580                                                   567 
581         Test prerequisite and basic functions     568         Test prerequisite and basic functions for the ``amd-pstate`` driver.
582                                                   569 
583         +---------+---------------------------    570         +---------+--------------------------------+------------------------------------------------------------------------------------+
584         | Index   | Functions                     571         | Index   | Functions                      | Description                                                                        |
585         +=========+===========================    572         +=========+================================+====================================================================================+
586         | 1       | amd_pstate_ut_acpi_cpc_val    573         | 1       | amd_pstate_ut_acpi_cpc_valid   || Check whether the _CPC object is present in SBIOS.                                |
587         |         |                               574         |         |                                ||                                                                                   |
588         |         |                               575         |         |                                || The detail refer to `Processor Support <processor_support_>`_.                    |
589         +---------+---------------------------    576         +---------+--------------------------------+------------------------------------------------------------------------------------+
590         | 2       | amd_pstate_ut_check_enable    577         | 2       | amd_pstate_ut_check_enabled    || Check whether AMD P-State is enabled.                                             |
591         |         |                               578         |         |                                ||                                                                                   |
592         |         |                               579         |         |                                || AMD P-States and ACPI hardware P-States always can be supported in one processor. |
593         |         |                               580         |         |                                | But AMD P-States has the higher priority and if it is enabled with                 |
594         |         |                               581         |         |                                | :c:macro:`MSR_AMD_CPPC_ENABLE` or ``cppc_set_enable``, it will respond to the      |
595         |         |                               582         |         |                                | request from AMD P-States.                                                         |
596         +---------+---------------------------    583         +---------+--------------------------------+------------------------------------------------------------------------------------+
597         | 3       | amd_pstate_ut_check_perf      584         | 3       | amd_pstate_ut_check_perf       || Check if the each performance values are reasonable.                              |
598         |         |                               585         |         |                                || highest_perf >= nominal_perf > lowest_nonlinear_perf > lowest_perf > 0.           |
599         +---------+---------------------------    586         +---------+--------------------------------+------------------------------------------------------------------------------------+
600         | 4       | amd_pstate_ut_check_freq      587         | 4       | amd_pstate_ut_check_freq       || Check if the each frequency values and max freq when set support boost mode       |
601         |         |                               588         |         |                                | are reasonable.                                                                    |
602         |         |                               589         |         |                                || max_freq >= nominal_freq > lowest_nonlinear_freq > min_freq > 0                   |
603         |         |                               590         |         |                                || If boost is not active but supported, this maximum frequency will be larger than  |
604         |         |                               591         |         |                                | the one in ``cpuinfo``.                                                            |
605         +---------+---------------------------    592         +---------+--------------------------------+------------------------------------------------------------------------------------+
606                                                   593 
607     2). Tbench test                               594     2). Tbench test
608                                                   595 
609         Test and monitor the cpu changes when     596         Test and monitor the cpu changes when running tbench benchmark under the specified governor.
610         These changes include desire performan    597         These changes include desire performance, frequency, load, performance, energy etc.
611         The specified governor is ondemand or     598         The specified governor is ondemand or schedutil.
612         Tbench can also be tested on the ``acp    599         Tbench can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
613                                                   600 
614     3). Gitsource test                            601     3). Gitsource test
615                                                   602 
616         Test and monitor the cpu changes when     603         Test and monitor the cpu changes when running gitsource benchmark under the specified governor.
617         These changes include desire performan    604         These changes include desire performance, frequency, load, time, energy etc.
618         The specified governor is ondemand or     605         The specified governor is ondemand or schedutil.
619         Gitsource can also be tested on the ``    606         Gitsource can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
620                                                   607 
621 #. How to execute the tests                       608 #. How to execute the tests
622                                                   609 
623    We use test module in the kselftest framewo    610    We use test module in the kselftest frameworks to implement it.
624    We create ``amd-pstate-ut`` module and tie     611    We create ``amd-pstate-ut`` module and tie it into kselftest.(for
625    details refer to Linux Kernel Selftests [4]    612    details refer to Linux Kernel Selftests [4]_).
626                                                   613 
627     1). Build                                     614     1). Build
628                                                   615 
629         + open the :c:macro:`CONFIG_X86_AMD_PS    616         + open the :c:macro:`CONFIG_X86_AMD_PSTATE` configuration option.
630         + set the :c:macro:`CONFIG_X86_AMD_PST    617         + set the :c:macro:`CONFIG_X86_AMD_PSTATE_UT` configuration option to M.
631         + make project                            618         + make project
632         + make selftest ::                        619         + make selftest ::
633                                                   620 
634             $ cd linux                            621             $ cd linux
635             $ make -C tools/testing/selftests     622             $ make -C tools/testing/selftests
636                                                   623 
637         + make perf ::                            624         + make perf ::
638                                                   625 
639             $ cd tools/perf/                      626             $ cd tools/perf/
640             $ make                                627             $ make
641                                                   628 
642                                                   629 
643     2). Installation & Steps ::                   630     2). Installation & Steps ::
644                                                   631 
645         $ make -C tools/testing/selftests inst    632         $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest
646         $ cp tools/perf/perf /usr/bin/perf        633         $ cp tools/perf/perf /usr/bin/perf
647         $ sudo ./kselftest/run_kselftest.sh -c    634         $ sudo ./kselftest/run_kselftest.sh -c amd-pstate
648                                                   635 
649     3). Specified test case ::                    636     3). Specified test case ::
650                                                   637 
651         $ cd ~/kselftest/amd-pstate               638         $ cd ~/kselftest/amd-pstate
652         $ sudo ./run.sh -t basic                  639         $ sudo ./run.sh -t basic
653         $ sudo ./run.sh -t tbench                 640         $ sudo ./run.sh -t tbench
654         $ sudo ./run.sh -t tbench -m acpi-cpuf    641         $ sudo ./run.sh -t tbench -m acpi-cpufreq
655         $ sudo ./run.sh -t gitsource              642         $ sudo ./run.sh -t gitsource
656         $ sudo ./run.sh -t gitsource -m acpi-c    643         $ sudo ./run.sh -t gitsource -m acpi-cpufreq
657         $ ./run.sh --help                         644         $ ./run.sh --help
658         ./run.sh: illegal option -- -             645         ./run.sh: illegal option -- -
659         Usage: ./run.sh [OPTION...]               646         Usage: ./run.sh [OPTION...]
660                 [-h <help>]                       647                 [-h <help>]
661                 [-o <output-file-for-dump>]       648                 [-o <output-file-for-dump>]
662                 [-c <all: All testing,            649                 [-c <all: All testing,
663                      basic: Basic testing,        650                      basic: Basic testing,
664                      tbench: Tbench testing,      651                      tbench: Tbench testing,
665                      gitsource: Gitsource test    652                      gitsource: Gitsource testing.>]
666                 [-t <tbench time limit>]          653                 [-t <tbench time limit>]
667                 [-p <tbench process number>]      654                 [-p <tbench process number>]
668                 [-l <loop times for tbench>]      655                 [-l <loop times for tbench>]
669                 [-i <amd tracer interval>]        656                 [-i <amd tracer interval>]
670                 [-m <comparative test: acpi-cp    657                 [-m <comparative test: acpi-cpufreq>]
671                                                   658 
672                                                   659 
673     4). Results                                   660     4). Results
674                                                   661 
675         + basic                                   662         + basic
676                                                   663 
677          When you finish test, you will get th    664          When you finish test, you will get the following log info ::
678                                                   665 
679           $ dmesg | grep "amd_pstate_ut" | tee    666           $ dmesg | grep "amd_pstate_ut" | tee log.txt
680           [12977.570663] amd_pstate_ut: 1    a    667           [12977.570663] amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid  success!
681           [12977.570673] amd_pstate_ut: 2    a    668           [12977.570673] amd_pstate_ut: 2    amd_pstate_ut_check_enabled   success!
682           [12977.571207] amd_pstate_ut: 3    a    669           [12977.571207] amd_pstate_ut: 3    amd_pstate_ut_check_perf      success!
683           [12977.571212] amd_pstate_ut: 4    a    670           [12977.571212] amd_pstate_ut: 4    amd_pstate_ut_check_freq      success!
684                                                   671 
685         + tbench                                  672         + tbench
686                                                   673 
687          When you finish test, you will get se    674          When you finish test, you will get selftest.tbench.csv and png images.
688          The selftest.tbench.csv file contains    675          The selftest.tbench.csv file contains the raw data and the drop of the comparative test.
689          The png images shows the performance,    676          The png images shows the performance, energy and performan per watt of each test.
690          Open selftest.tbench.csv :               677          Open selftest.tbench.csv :
691                                                   678 
692          +------------------------------------    679          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
693          + Governor                               680          + Governor                                        | Round        | Des-perf | Freq    | Load     | Performance | Energy  | Performance Per Watt |
694          +------------------------------------    681          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
695          + Unit                                   682          + Unit                                            |              |          | GHz     |          | MB/s        | J       | MB/J                 |
696          +====================================    683          +=================================================+==============+==========+=========+==========+=============+=========+======================+
697          + amd-pstate-ondemand                    684          + amd-pstate-ondemand                             | 1            |          |         |          | 2504.05     | 1563.67 | 158.5378             |
698          +------------------------------------    685          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
699          + amd-pstate-ondemand                    686          + amd-pstate-ondemand                             | 2            |          |         |          | 2243.64     | 1430.32 | 155.2941             |
700          +------------------------------------    687          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
701          + amd-pstate-ondemand                    688          + amd-pstate-ondemand                             | 3            |          |         |          | 2183.88     | 1401.32 | 154.2860             |
702          +------------------------------------    689          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
703          + amd-pstate-ondemand                    690          + amd-pstate-ondemand                             | Average      |          |         |          | 2310.52     | 1465.1  | 156.1268             |
704          +------------------------------------    691          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
705          + amd-pstate-schedutil                   692          + amd-pstate-schedutil                            | 1            | 165.329  | 1.62257 | 99.798   | 2136.54     | 1395.26 | 151.5971             |
706          +------------------------------------    693          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
707          + amd-pstate-schedutil                   694          + amd-pstate-schedutil                            | 2            | 166      | 1.49761 | 99.9993  | 2100.56     | 1380.5  | 150.6377             |
708          +------------------------------------    695          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
709          + amd-pstate-schedutil                   696          + amd-pstate-schedutil                            | 3            | 166      | 1.47806 | 99.9993  | 2084.12     | 1375.76 | 149.9737             |
710          +------------------------------------    697          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
711          + amd-pstate-schedutil                   698          + amd-pstate-schedutil                            | Average      | 165.776  | 1.53275 | 99.9322  | 2107.07     | 1383.84 | 150.7399             |
712          +------------------------------------    699          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
713          + acpi-cpufreq-ondemand                  700          + acpi-cpufreq-ondemand                           | 1            |          |         |          | 2529.9      | 1564.4  | 160.0997             |
714          +------------------------------------    701          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
715          + acpi-cpufreq-ondemand                  702          + acpi-cpufreq-ondemand                           | 2            |          |         |          | 2249.76     | 1432.97 | 155.4297             |
716          +------------------------------------    703          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
717          + acpi-cpufreq-ondemand                  704          + acpi-cpufreq-ondemand                           | 3            |          |         |          | 2181.46     | 1406.88 | 153.5060             |
718          +------------------------------------    705          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
719          + acpi-cpufreq-ondemand                  706          + acpi-cpufreq-ondemand                           | Average      |          |         |          | 2320.37     | 1468.08 | 156.4741             |
720          +------------------------------------    707          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
721          + acpi-cpufreq-schedutil                 708          + acpi-cpufreq-schedutil                          | 1            |          |         |          | 2137.64     | 1385.24 | 152.7723             |
722          +------------------------------------    709          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
723          + acpi-cpufreq-schedutil                 710          + acpi-cpufreq-schedutil                          | 2            |          |         |          | 2107.05     | 1372.23 | 152.0138             |
724          +------------------------------------    711          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
725          + acpi-cpufreq-schedutil                 712          + acpi-cpufreq-schedutil                          | 3            |          |         |          | 2085.86     | 1365.35 | 151.2433             |
726          +------------------------------------    713          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
727          + acpi-cpufreq-schedutil                 714          + acpi-cpufreq-schedutil                          | Average      |          |         |          | 2110.18     | 1374.27 | 152.0136             |
728          +------------------------------------    715          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
729          + acpi-cpufreq-ondemand VS acpi-cpufr    716          + acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) |          |         |          | -9.0584     | -6.3899 | -2.8506              |
730          +------------------------------------    717          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
731          + amd-pstate-ondemand VS amd-pstate-s    718          + amd-pstate-ondemand VS amd-pstate-schedutil     | Comprison(%) |          |         |          | 8.8053      | -5.5463 | -3.4503              |
732          +------------------------------------    719          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
733          + acpi-cpufreq-ondemand VS amd-pstate    720          + acpi-cpufreq-ondemand VS amd-pstate-ondemand    | Comprison(%) |          |         |          | -0.4245     | -0.2029 | -0.2219              |
734          +------------------------------------    721          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
735          + acpi-cpufreq-schedutil VS amd-pstat    722          + acpi-cpufreq-schedutil VS amd-pstate-schedutil  | Comprison(%) |          |         |          | -0.1473     | 0.6963  | -0.8378              |
736          +------------------------------------    723          +-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
737                                                   724 
738         + gitsource                               725         + gitsource
739                                                   726 
740          When you finish test, you will get se    727          When you finish test, you will get selftest.gitsource.csv and png images.
741          The selftest.gitsource.csv file conta    728          The selftest.gitsource.csv file contains the raw data and the drop of the comparative test.
742          The png images shows the performance,    729          The png images shows the performance, energy and performan per watt of each test.
743          Open selftest.gitsource.csv :            730          Open selftest.gitsource.csv :
744                                                   731 
745          +------------------------------------    732          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
746          + Governor                               733          + Governor                                        | Round        | Des-perf | Freq     | Load     | Time        | Energy  | Performance Per Watt |
747          +------------------------------------    734          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
748          + Unit                                   735          + Unit                                            |              |          | GHz      |          | s           | J       | 1/J                  |
749          +====================================    736          +=================================================+==============+==========+==========+==========+=============+=========+======================+
750          + amd-pstate-ondemand                    737          + amd-pstate-ondemand                             | 1            | 50.119   | 2.10509  | 23.3076  | 475.69      | 865.78  | 0.001155027          |
751          +------------------------------------    738          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
752          + amd-pstate-ondemand                    739          + amd-pstate-ondemand                             | 2            | 94.8006  | 1.98771  | 56.6533  | 467.1       | 839.67  | 0.001190944          |
753          +------------------------------------    740          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
754          + amd-pstate-ondemand                    741          + amd-pstate-ondemand                             | 3            | 76.6091  | 2.53251  | 43.7791  | 467.69      | 855.85  | 0.001168429          |
755          +------------------------------------    742          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
756          + amd-pstate-ondemand                    743          + amd-pstate-ondemand                             | Average      | 73.8429  | 2.20844  | 41.2467  | 470.16      | 853.767 | 0.001171279          |
757          +------------------------------------    744          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
758          + amd-pstate-schedutil                   745          + amd-pstate-schedutil                            | 1            | 165.919  | 1.62319  | 98.3868  | 464.17      | 866.8   | 0.001153668          |
759          +------------------------------------    746          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
760          + amd-pstate-schedutil                   747          + amd-pstate-schedutil                            | 2            | 165.97   | 1.31309  | 99.5712  | 480.15      | 880.4   | 0.001135847          |
761          +------------------------------------    748          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
762          + amd-pstate-schedutil                   749          + amd-pstate-schedutil                            | 3            | 165.973  | 1.28448  | 99.9252  | 481.79      | 867.02  | 0.001153375          |
763          +------------------------------------    750          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
764          + amd-pstate-schedutil                   751          + amd-pstate-schedutil                            | Average      | 165.954  | 1.40692  | 99.2944  | 475.37      | 871.407 | 0.001147569          |
765          +------------------------------------    752          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
766          + acpi-cpufreq-ondemand                  753          + acpi-cpufreq-ondemand                           | 1            |          |          |          | 2379.62     | 742.96  | 0.001345967          |
767          +------------------------------------    754          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
768          + acpi-cpufreq-ondemand                  755          + acpi-cpufreq-ondemand                           | 2            |          |          |          | 441.74      | 817.49  | 0.001223256          |
769          +------------------------------------    756          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
770          + acpi-cpufreq-ondemand                  757          + acpi-cpufreq-ondemand                           | 3            |          |          |          | 455.48      | 820.01  | 0.001219497          |
771          +------------------------------------    758          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
772          + acpi-cpufreq-ondemand                  759          + acpi-cpufreq-ondemand                           | Average      |          |          |          | 425.613     | 793.487 | 0.001260260          |
773          +------------------------------------    760          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
774          + acpi-cpufreq-schedutil                 761          + acpi-cpufreq-schedutil                          | 1            |          |          |          | 459.69      | 838.54  | 0.001192548          |
775          +------------------------------------    762          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
776          + acpi-cpufreq-schedutil                 763          + acpi-cpufreq-schedutil                          | 2            |          |          |          | 466.55      | 830.89  | 0.001203528          |
777          +------------------------------------    764          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
778          + acpi-cpufreq-schedutil                 765          + acpi-cpufreq-schedutil                          | 3            |          |          |          | 470.38      | 837.32  | 0.001194286          |
779          +------------------------------------    766          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
780          + acpi-cpufreq-schedutil                 767          + acpi-cpufreq-schedutil                          | Average      |          |          |          | 465.54      | 835.583 | 0.001196769          |
781          +------------------------------------    768          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
782          + acpi-cpufreq-ondemand VS acpi-cpufr    769          + acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) |          |          |          | 9.3810      | 5.3051  | -5.0379              |
783          +------------------------------------    770          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
784          + amd-pstate-ondemand VS amd-pstate-s    771          + amd-pstate-ondemand VS amd-pstate-schedutil     | Comprison(%) | 124.7392 | -36.2934 | 140.7329 | 1.1081      | 2.0661  | -2.0242              |
785          +------------------------------------    772          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
786          + acpi-cpufreq-ondemand VS amd-pstate    773          + acpi-cpufreq-ondemand VS amd-pstate-ondemand    | Comprison(%) |          |          |          | 10.4665     | 7.5968  | -7.0605              |
787          +------------------------------------    774          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
788          + acpi-cpufreq-schedutil VS amd-pstat    775          + acpi-cpufreq-schedutil VS amd-pstate-schedutil  | Comprison(%) |          |          |          | 2.1115      | 4.2873  | -4.1110              |
789          +------------------------------------    776          +-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
790                                                   777 
791 Reference                                         778 Reference
792 ===========                                       779 ===========
793                                                   780 
794 .. [1] AMD64 Architecture Programmer's Manual     781 .. [1] AMD64 Architecture Programmer's Manual Volume 2: System Programming,
795        https://www.amd.com/system/files/TechDo    782        https://www.amd.com/system/files/TechDocs/24593.pdf
796                                                   783 
797 .. [2] Advanced Configuration and Power Interf    784 .. [2] Advanced Configuration and Power Interface Specification,
798        https://uefi.org/sites/default/files/re    785        https://uefi.org/sites/default/files/resources/ACPI_Spec_6_4_Jan22.pdf
799                                                   786 
800 .. [3] Processor Programming Reference (PPR) f    787 .. [3] Processor Programming Reference (PPR) for AMD Family 19h Model 51h, Revision A1 Processors
801        https://www.amd.com/system/files/TechDo    788        https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip
802                                                   789 
803 .. [4] Linux Kernel Selftests,                    790 .. [4] Linux Kernel Selftests,
804        https://www.kernel.org/doc/html/latest/    791        https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php