← Documents Documentation/admin-guide/pm/amd-pstate.rst GitHub 원문 ↗

Linux 6.18.37 · Administration / Power Management

AMD P-State CPU Performance Scaling Driver

AMD CPPC 기반 frequency scaling, mode, sysfs, preferred core, 진단과 selftest를 설명합니다.

Source pathDocumentation/admin-guide/pm/amd-pstate.rst
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

운영 요약

amd-pstate.rst:1-802

`amd-pstate`는 연속 CPPC performance scale을 generic governor와 연결합니다. Hardware 구현과 mode를 확인하고 policy/전역 sysfs로 범위를 제어한 뒤 trace와 kselftest로 동작을 검증합니다.

관점핵심
기반ACPI CPPC의 연속적이고 단위 없는 performance scale
장점기존 3단계 ACPI hardware P-State보다 세밀하고 지연이 낮은 제어
구현Full MSR 또는 ACPI shared-memory CPPC
Governor`schedutil`, `ondemand` 등 generic scaling governor
Mode`active`, `passive`, `guided`, `disable`
정책Policy별 sysfs와 전역 `/sys/devices/system/cpu/amd_pstate/`
진단`cpupower`, trace event, `amd_pstate_tracer.py`
검증`amd-pstate-ut` kselftest의 basic/tbench/gitsource

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

소개

1-33

이 문서는 `SPDX-License-Identifier: GPL-2.0`을 따르며 Advanced Micro Devices, Inc.의 2021년 저작물입니다. 작성자는 Huang Rui `<[email protected]>`입니다.

`amd-pstate`는 최신 AMD APU와 CPU 계열에 새로운 CPU frequency 제어 방식을 도입한 Linux kernel 성능 scaling driver입니다. Collaborative Processor Performance Control(CPPC)에 기반하여, 3개 P-state만 전환하던 기존 ACPI hardware P-State보다 훨씬 세밀하게 frequency를 관리합니다.

CPPC는 kernel이 performance hint를 hardware에 직접 전달할 수 있는 유연하고 지연이 낮은 interface입니다. `amd-pstate`는 `schedutil`, `ondemand` 같은 Linux governor가 만든 hint를 사용하고, hardware는 AMD64 Architecture Programmer's Manual Volume 2의 사양에 따라 이를 처리합니다.

현재 문서 기준으로 일부 Zen2와 Zen3 processor에서 governor 기반 기본 frequency 제어를 지원하며, hardware와 SBIOS 검증 후 AMD 전용 기능을 계속 확장할 예정입니다.

AMD CPPC 개요와 성능 눈금

34-85

CPPC interface는 특정 frequency나 performance state에 묶이지 않은 연속적이고 추상적이며 단위 없는 성능값을 열거합니다. Software는 ACPI 표준을 통해 platform 한계에 대한 상대 목표와 hint를 지정할 수 있습니다.

AMD processor는 performance 조정을 위해 AML interpreter 대신 지연이 낮은 MSR register model을 제공합니다. `amd-pstate`는 각 performance update 동작을 관리하는 callback과 함께 `struct cpufreq_driver` instance인 `amd_pstate_driver`를 초기화합니다.

AMD P-State performance scale
Capability scaleControl scale상대 위치
Highest PerfMax Perf절대 상단
Nominal PerfDesired Perf지속 가능 기준과 목표
Lowest non-linear PerfMin Perf효율 경계 부근
Lowest Perf / 0-절대 하단

원문의 두 세로 눈금을 capability 값과 control 요청값의 상대 위치로 다시 구성했습니다.

CPPC performance capability

86-126

`Highest Performance`는 이상적 조건에서 개별 processor가 도달할 수 있는 절대 최대 성능입니다. 다른 processor의 idle 같은 platform 상태가 필요할 수 있어 오래 지속되지 않을 수 있으며, processor가 지원하는 최고 frequency에 해당합니다.

`Nominal (Guaranteed) Performance`는 외부 전력·열 제약이 없을 때 지속 가능한 최대 성능입니다. 모든 core/processor가 nominal 상태를 동시에 유지할 수 있어야 합니다.

`Lowest non-linear Performance`는 전압과 frequency scaling의 결합 효과로 비선형 절전이 생기는 최저 성능입니다. 이 값 위에서는 낮은 성능이 일반적으로 더 효율적이며, `amd-pstate`에 가장 효율적인 지점을 알려 줍니다.

`Lowest Performance`는 processor의 절대 최저 성능입니다. Lowest nonlinear 아래를 선택하면 효율 손실이 생길 수 있지만 순간 전력 소비는 줄어듭니다.

Capability의미
Highest Performance이상적 조건에서 가능한 절대 최대값; 장시간 유지되지 않을 수 있음
Nominal Performance외부 전력·열 제약이 없을 때 모든 core가 동시에 지속 가능한 최대값
Lowest non-linear Performance전압·주파수 scaling의 비선형 절전 효과가 시작되는 가장 효율적인 값
Lowest Performance절대 최저값; 전력은 줄지만 nonlinear 지점 아래에서는 효율 손실 가능

CPPC performance control

127-160

`amd-pstate`는 CPPC register를 통해 performance 목표를 전달합니다. Minimum requested performance는 허용 성능 하한, Maximum requested performance는 hardware가 제공할 성능 상한입니다.

Desired performance target은 CPPC scale의 상대값이며 nominal performance의 백분율로 표현할 수 있습니다. Nominal 아래에서는 hardware 조건을 따르는 평균 성능을 뜻하고, nominal 위에서는 최소 nominal을 제공하면서 운용 조건이 허용하면 더 높여야 합니다.

Energy Performance Preference(EPP)는 software가 performance 쪽(`0x0`)과 energy efficiency 쪽(`0xff`) 중 어디에 무게를 두는지 hardware에 알려 주는 hint입니다.

Control의미
Minimum requested performanceHardware가 내려갈 수 있는 하한
Maximum requested performanceHardware가 제공할 성능의 상한
Desired performance targetNominal을 기준으로 한 상대 목표값
Energy Performance Preference`0x0` performance 우선, `0xff` energy efficiency 우선

Scaling governor 지원

161-184

`amd-pstate`는 sysfs policy attribute `scaling_available_governors`에 열거되는 모든 generic scaling governor와 함께 사용할 수 있습니다. CPU별 policy object를 구성하고 hardware의 최소·최대 frequency 정보를 CPUFreq core와 연결된 governor에 정확히 제공합니다. `scaling_cur_freq` 값은 CPUFreq core에서 옵니다.

동적 frequency 제어의 주 대상은 `schedutil`과 `ondemand`입니다. `schedutil`과 CFS scheduler에 맞춰 `adjust_perf` callback을 등록하며, `sugov_start`가 CPU의 `update_util_data`에 `sugov_update_single_perf`를 utilization update callback으로 설정합니다.

CPU scheduler는 `cpufreq_update_util`을 호출하고 해당 utilization의 `struct sugov_cpu`에 따라 목표 performance를 지정합니다. `amd-pstate`는 이 scheduler 결정을 desired performance에 반영합니다.

Processor와 hardware 구현 지원

185-232

감지한 processor의 ACPI SBIOS에 `_CPC` entry가 없으면 `amd-pstate` 초기화가 실패합니다. `acpi_cpc_valid`로 이를 검사하며, 모든 Zen processor가 legacy ACPI hardware P-State를 지원하므로 실패 시 kernel은 `acpi-cpufreq`로 fallback합니다.

Hardware 구현은 Full MSR Support와 Shared Memory Support 두 종류입니다. :c:macro:`X86_FEATURE_CPPC` feature flag로 구분하고 구현별 `static_call` instance를 등록합니다. 문서 시점에는 일부 Zen2/Zen3를 지원하며 범위를 확대할 예정입니다.

Cezanne 같은 일부 Zen3는 :c:macro:`X86_FEATURE_CPPC`가 설정된 상태에서 MSR register를 직접 제공합니다. `amd-pstate`는 MSR을 이용해 interrupt context에서 frequency 제어 지연을 줄이는 CPUFreq fast switch를 구현하며, 관련 함수는 `pstate_xxx` prefix를 사용합니다.

`X86_FEATURE_CPPC`가 없으면 shared-memory 해법을 지원합니다. 이때 `cppc_acpi` helper가 `static_call` callback을 구현하고 함수는 `cppc_xxx` prefix를 사용합니다.

한 processor가 AMD P-States와 ACPI hardware P-States를 모두 지원할 수 있지만 AMD P-States가 우선합니다. :c:macro:`MSR_AMD_CPPC_ENABLE` 또는 `cppc_set_enable`로 활성화하면 AMD P-States 요청에 응답합니다.

Policy별 sysfs interface

233-314

Policy별 attribute는 `/sys/devices/system/cpu/cpufreq/policyX/`에 있으며 해당 policy의 모든 CPU에 영향을 줍니다. 다음 출력은 policy0의 AMD 전용 파일을 보여 줍니다.

root@hr-test1:/home/ray# ls /sys/devices/system/cpu/cpufreq/policy0/*amd*
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_highest_perf
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_lowest_nonlinear_freq
/sys/devices/system/cpu/cpufreq/policy0/amd_pstate_max_freq

`amd_pstate_highest_perf`와 `amd_pstate_max_freq`는 driver가 설정할 수 있는 최대 CPPC performance와 CPU frequency입니다. 일부 ASIC은 `_CPC` 표의 highest 값과 실제 값이 달라 sysfs 노출이 필요합니다. Boost가 비활성이지만 지원되는 경우 최대 frequency가 `cpuinfo`보다 클 수 있습니다.

`amd_pstate_lowest_nonlinear_freq`는 허용되는 최저 nonlinear CPPC CPU frequency입니다. `amd_pstate_hw_prefcore`는 preferred core 기능의 지원·활성 상태, `amd_pstate_prefcore_ranking`은 단위 없는 core 성능 순위이며 platform 조건에 따라 runtime에 바뀔 수 있습니다.

`energy_performance_available_preferences`는 지원 EPP profile 목록입니다. Profile은 firmware에 원하는 energy/efficiency 절충을 전달하며 `default`는 platform firmware 값을 뜻합니다. `energy_performance_preference`는 현재 값을 읽고 지원 profile 또는 0-255로 변경합니다. Firmware가 EPP를 끄면 쓰기 값은 무시됩니다.

CPU별 `boost`는 `/sys/devices/system/cpu/cpuX/cpufreq/boost`에 `0` 또는 `1`을 써서 끄거나 켭니다. 활성화하면 base frequency를 넘어 동적으로 상승하고, 비활성화하면 전력·온도 관리를 위해 base frequency로 제한합니다. 다른 값은 `/sys/devices/system/cpu/cpuX/acpi_cppc/`에서 읽습니다.

Attribute동작
`amd_pstate_highest_perf`허용할 최대 CPPC performance; read-only
`amd_pstate_max_freq`허용할 최대 CPU frequency; read-only
`amd_pstate_lowest_nonlinear_freq`최저 nonlinear CPPC frequency; read-only
`amd_pstate_hw_prefcore`Preferred core 지원 및 활성 상태; read-only
`amd_pstate_prefcore_ranking`Runtime에 바뀔 수 있는 core performance 순위; read-only
`energy_performance_available_preferences`지원 EPP profile 목록; read-only
`energy_performance_preference`현재 EPP를 읽고 0-255 값/profile로 변경; read-write
`boost`CPU별 boost를 `0`/`1`로 비활성화/활성화

acpi-cpufreq 비교와 세 운용 mode

315-382

대부분의 `acpi-cpufreq` 지원 AMD platform은 firmware ACPI table의 3개 P-state만 사용합니다. 최신 AMD APU/CPU의 CPPC는 세밀하고 연속적인 frequency 범위를 제공하며, `amd-pstate`는 향후 AMD platform을 위한 더 높은 성능·energy efficiency의 관리 방식입니다.

CPPC에는 autonomous(active), non-autonomous(passive), guided autonomous(guided) 세 mode가 있고 kernel parameter로 선택합니다. Active에서는 desired request를 무시하고 min/max/EPP만 고려합니다. Passive에서는 OS가 Desired Performance Register로 목표를 직접 줍니다. Guided에서는 OS가 min/max를 주고 platform이 workload에 맞춰 자율 선택합니다.

`amd_pstate=active`는 `amd_pstate_epp`가 구현하는 firmware control mode입니다. EPP hint를 받은 CPPC power algorithm이 workload, 전력 공급, 열, core 전압 등 hardware 조건에 따라 실시간 frequency를 조정합니다.

`amd_pstate=passive`에서는 software가 CPPC scale의 상대 QoS 목표를 지정합니다. Nominal 아래의 desired 값은 Performance Reduction Tolerance를 따르는 평균 성능이고, 위에서는 최소 nominal을 보장하며 조건이 허용하면 더 올라갑니다.

`amd_pstate=guided`에서는 driver가 최소·최대 성능을 요청하고 platform이 그 범위 안에서 현재 workload에 적절한 값을 자율 선택합니다.

Mode제어 주체와 입력
`active``amd_pstate_epp`; min/max/EPP를 바탕으로 firmware가 자율 선택
`passive`OS가 Desired Performance Register에 QoS 목표를 직접 지정
`guided`OS가 min/max를 주고 platform이 workload에 맞는 값을 자율 선택
`disable`Driver를 unregister하여 기능을 중지

Preferred core와 switch

383-424

반도체 공정 편차 때문에 모든 core가 platform 한계를 지키면서 같은 최대 frequency에 도달하지는 않습니다. AMD는 일부 core만 최대에 도달할 수 있다는 의미로 최대 frequency 개념을 재정의했고, OS는 CPPC highest performance capability register가 알리는 core 순서를 알아야 적절히 scheduling할 수 있습니다.

`amd-pstate` preferred core는 더 낮은 전압으로 더 높은 frequency를 낼 수 있는 core를 scheduler가 우선하도록 합니다. 순위는 workload, platform 조건, 열, 노화에 따라 동적으로 바뀔 수 있습니다.

Driver가 priority metric과 지원 여부를 초기화하고 boot 때 초기 core 순서를 제공합니다. Platform은 CPPC interface로 순위를 OS와 scheduler에 전달하며, highest performance 변경 메시지를 받으면 driver가 순위와 CPU priority를 갱신합니다.

Preferred core는 기본 활성입니다. 지원 system에서도 OS가 순위를 무시하게 하려면 kernel parameter `amd_prefcore=disable`을 사용합니다.

전역 sysfs attribute

425-469

전역 attribute는 `/sys/devices/system/cpu/amd_pstate/`에 있고 모든 CPU에 영향을 줍니다. `status`는 `active`, `passive`, `guided`, `disable` 중 하나입니다.

`status`에 유효한 문자열을 쓰면 해당 mode로 전환하고 `disable`이면 driver를 unregister합니다. `prefcore`는 `enabled` 또는 `disabled`이며 kernel parameter가 정한 preferred core 상태를 확인하는 read-only attribute입니다.

Global attribute의미
`status``active`, `passive`, `guided`, `disable`을 읽거나 써서 mode 전환
`prefcore`Kernel parameter가 정한 preferred core의 `enabled`/`disabled` 상태; read-only

cpupower 정보 출력

470-498

`cpupower`는 `amd-pstate`를 지원하며 frequency 정보를 dump할 수 있습니다. 더 많은 module operation 지원은 개발 중입니다. 예시는 driver, coordination, transition latency, hardware limit, governor, policy, 현재 frequency, boost와 네 CPPC capability/frequency를 보여 줍니다.

root@hr-test1:/home/ray# cpupower frequency-info
analyzing CPU 0:
  driver: amd-pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 131 us
  hardware limits: 400 MHz - 4.68 GHz
  available cpufreq governors: ondemand conservative powersave userspace performance schedutil
  current policy: frequency should be within 400 MHz and 4.68 GHz.
                  The governor "schedutil" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 4.02 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes
    AMD PSTATE Highest Performance: 166. Maximum Frequency: 4.68 GHz.
    AMD PSTATE Nominal Performance: 117. Nominal Frequency: 3.30 GHz.
    AMD PSTATE Lowest Non-linear Performance: 39. Lowest Non-linear Frequency: 1.10 GHz.
    AMD PSTATE Lowest Performance: 15. Lowest Frequency: 400 MHz.

Trace event 진단

499-538

진단에는 CPUFreq 공통 `cpu_frequency`와 AMD 전용 `amd_pstate_perf` 두 static trace event를 사용합니다. Event tracing을 켠 kernel에서 다음 명령으로 AMD CPU event를 활성화하고 trace를 읽습니다.

root@hr-test1:/home/ray# cd /sys/kernel/tracing/
root@hr-test1:/sys/kernel/tracing# echo 1 > events/amd_cpu/enable
root@hr-test1:/sys/kernel/tracing# cat trace
# tracer: nop
#
# entries-in-buffer/entries-written: 47827/42233061   #P:2
#
#                                _-----=> irqs-off
#                               / _----=> need-resched
#                              | / _---=> hardirq/softirq
#                              || / _--=> preempt-depth
#                              ||| /     delay
#           TASK-PID     CPU#  ||||   TIMESTAMP  FUNCTION
#              | |         |   ||||      |         |
         <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
         <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
            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
           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
         <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
         <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
         <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

`amd_pstate_perf` 행은 min/desired/max performance, CPU ID, 변경 여부와 fast switch 상태를 기록합니다. `cpu_frequency` event는 연결된 policy가 `schedutil`이면 governor가, 다른 governor이면 CPUFreq core가 발생시킵니다.

amd_pstate_tracer.py

539-563

`amd_pstate_tracer.py`는 trace log를 기록·분석하고 performance plot을 만들어 driver를 debug하고 tune합니다. Intel pstate tracer를 import하며 위치는 `linux/tools/power/x86/amd_pstate_tracer`입니다.

기존 trace file을 분석하는 명령입니다.

./amd_pstate_trace.py [-c cpus] -t <trace_file> -n <test_name>

Root 권한으로 trace를 만들고 분석·plot까지 수행하는 명령입니다.

sudo ./amd_pstate_trace.py [-c cpus] -n <test_name> -i <interval> [-m kbytes]

결과는 `results/test_name`에 저장됩니다. 예시 행에는 CPU, timestamp, min/des/max performance, frequency, `mperf`, `apef`, `tsc`, load, duration, sample 수, elapsed time과 task 이름이 들어 있습니다.

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
CPU_005     712          116384        39        49        166       0.7565  9645075 2214891 38431470  25.1   11.646       469         2.496         kworker/5:0-40
CPU_006     712          116408        39        49        166       0.6769  8950227 1839034 37192089  24.06  11.272       470         2.496         kworker/6:0-1264

Unit test 목적과 test case

564-619

`amd-pstate-ut`는 processor의 SBIOS/firmware/hardware 지원을 사용자가 확인하고, kernel update의 기본 기능 regression을 막으며, 향후 기능·성능 test 결과를 맞춰 power/performance scaling을 최적화하기 위한 module입니다.

Basic test는 `_CPC` 존재, driver 활성화, performance 값 순서, frequency 값과 boost 최대값을 검사합니다.

amd-pstate basic unit tests
함수검사
`amd_pstate_ut_acpi_cpc_valid`SBIOS에 `_CPC` object가 있는지 검사
`amd_pstate_ut_check_enabled`AMD P-State가 활성화됐는지 검사
`amd_pstate_ut_check_perf``highest_perf >= nominal_perf > lowest_nonlinear_perf > lowest_perf > 0` 검사
`amd_pstate_ut_check_freq`Frequency 순서와 boost 지원 시 최대 frequency를 검사

원문의 unit-test 정의표를 함수와 검사 조건으로 구조화했습니다.

Tbench test는 `ondemand` 또는 `schedutil`에서 benchmark를 실행하며 desired performance, frequency, load, performance와 energy 변화를 감시합니다. 비교를 위해 `acpi-cpufreq`에서도 실행할 수 있습니다.

Gitsource test도 두 governor에서 source benchmark의 desired performance, frequency, load, time과 energy를 측정하고 `acpi-cpufreq`와 비교할 수 있습니다.

Kselftest build와 실행

620-670

Test는 kselftest framework의 `amd-pstate-ut` module로 구현됩니다. :c:macro:`CONFIG_X86_AMD_PSTATE`를 켜고 :c:macro:`CONFIG_X86_AMD_PSTATE_UT`를 `M`으로 설정한 뒤 project와 selftest, perf를 build합니다.

$ cd linux
$ make -C tools/testing/selftests
$ cd tools/perf/
$ make

Selftest를 `~/kselftest`에 설치하고 perf binary를 배치한 뒤 amd-pstate collection을 실행합니다. 이어지는 명령은 basic, tbench, gitsource와 `acpi-cpufreq` 비교 mode를 선택하고 help의 option 의미를 보여 줍니다.

    $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest
    $ cp tools/perf/perf /usr/bin/perf
    $ sudo ./kselftest/run_kselftest.sh -c amd-pstate

3). Specified test case ::

    $ cd ~/kselftest/amd-pstate
    $ sudo ./run.sh -t basic
    $ sudo ./run.sh -t tbench
    $ sudo ./run.sh -t tbench -m acpi-cpufreq
    $ sudo ./run.sh -t gitsource
    $ sudo ./run.sh -t gitsource -m acpi-cpufreq
    $ ./run.sh --help
    ./run.sh: illegal option -- -
    Usage: ./run.sh [OPTION...]
            [-h <help>]
            [-o <output-file-for-dump>]
            [-c <all: All testing,
                 basic: Basic testing,
                 tbench: Tbench testing,
                 gitsource: Gitsource testing.>]
            [-t <tbench time limit>]
            [-p <tbench process number>]
            [-l <loop times for tbench>]
            [-i <amd tracer interval>]
            [-m <comparative test: acpi-cpufreq>]

Basic, tbench와 gitsource 결과

671-788

Basic test가 끝나면 `dmesg`에서 네 검사 함수의 `success!` 결과를 확인합니다.

$ dmesg | grep "amd_pstate_ut" | tee log.txt
[12977.570663] amd_pstate_ut: 1    amd_pstate_ut_acpi_cpc_valid  success!
[12977.570673] amd_pstate_ut: 2    amd_pstate_ut_check_enabled   success!
[12977.571207] amd_pstate_ut: 3    amd_pstate_ut_check_perf      success!
[12977.571212] amd_pstate_ut: 4    amd_pstate_ut_check_freq      success!

Tbench는 `selftest.tbench.csv`와 PNG를 만듭니다. CSV에는 raw data와 비교 test의 차이가, PNG에는 각 test의 performance, energy, performance per watt가 들어 있습니다. 다음 원문 표는 세 round, average와 driver/governor 조합별 comparison을 보존합니다.

+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ Governor                                        | Round        | Des-perf | Freq    | Load     | Performance | Energy  | Performance Per Watt |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ Unit                                            |              |          | GHz     |          | MB/s        | J       | MB/J                 |
+=================================================+==============+==========+=========+==========+=============+=========+======================+
+ amd-pstate-ondemand                             | 1            |          |         |          | 2504.05     | 1563.67 | 158.5378             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand                             | 2            |          |         |          | 2243.64     | 1430.32 | 155.2941             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand                             | 3            |          |         |          | 2183.88     | 1401.32 | 154.2860             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand                             | Average      |          |         |          | 2310.52     | 1465.1  | 156.1268             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | 1            | 165.329  | 1.62257 | 99.798   | 2136.54     | 1395.26 | 151.5971             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | 2            | 166      | 1.49761 | 99.9993  | 2100.56     | 1380.5  | 150.6377             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | 3            | 166      | 1.47806 | 99.9993  | 2084.12     | 1375.76 | 149.9737             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | Average      | 165.776  | 1.53275 | 99.9322  | 2107.07     | 1383.84 | 150.7399             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | 1            |          |         |          | 2529.9      | 1564.4  | 160.0997             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | 2            |          |         |          | 2249.76     | 1432.97 | 155.4297             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | 3            |          |         |          | 2181.46     | 1406.88 | 153.5060             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | Average      |          |         |          | 2320.37     | 1468.08 | 156.4741             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | 1            |          |         |          | 2137.64     | 1385.24 | 152.7723             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | 2            |          |         |          | 2107.05     | 1372.23 | 152.0138             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | 3            |          |         |          | 2085.86     | 1365.35 | 151.2433             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | Average      |          |         |          | 2110.18     | 1374.27 | 152.0136             |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) |          |         |          | -9.0584     | -6.3899 | -2.8506              |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand VS amd-pstate-schedutil     | Comprison(%) |          |         |          | 8.8053      | -5.5463 | -3.4503              |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand VS amd-pstate-ondemand    | Comprison(%) |          |         |          | -0.4245     | -0.2029 | -0.2219              |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil VS amd-pstate-schedutil  | Comprison(%) |          |         |          | -0.1473     | 0.6963  | -0.8378              |
+-------------------------------------------------+--------------+----------+---------+----------+-------------+---------+----------------------+

Gitsource도 `selftest.gitsource.csv`와 PNG를 만들며 같은 방식으로 raw data, 비교 차이, performance·energy·performance per watt를 기록합니다. 이 workload에서는 performance 열 대신 실행 시간(s)을 사용합니다.

+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ Governor                                        | Round        | Des-perf | Freq     | Load     | Time        | Energy  | Performance Per Watt |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ Unit                                            |              |          | GHz      |          | s           | J       | 1/J                  |
+=================================================+==============+==========+==========+==========+=============+=========+======================+
+ amd-pstate-ondemand                             | 1            | 50.119   | 2.10509  | 23.3076  | 475.69      | 865.78  | 0.001155027          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand                             | 2            | 94.8006  | 1.98771  | 56.6533  | 467.1       | 839.67  | 0.001190944          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand                             | 3            | 76.6091  | 2.53251  | 43.7791  | 467.69      | 855.85  | 0.001168429          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand                             | Average      | 73.8429  | 2.20844  | 41.2467  | 470.16      | 853.767 | 0.001171279          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | 1            | 165.919  | 1.62319  | 98.3868  | 464.17      | 866.8   | 0.001153668          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | 2            | 165.97   | 1.31309  | 99.5712  | 480.15      | 880.4   | 0.001135847          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | 3            | 165.973  | 1.28448  | 99.9252  | 481.79      | 867.02  | 0.001153375          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-schedutil                            | Average      | 165.954  | 1.40692  | 99.2944  | 475.37      | 871.407 | 0.001147569          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | 1            |          |          |          | 2379.62     | 742.96  | 0.001345967          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | 2            |          |          |          | 441.74      | 817.49  | 0.001223256          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | 3            |          |          |          | 455.48      | 820.01  | 0.001219497          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand                           | Average      |          |          |          | 425.613     | 793.487 | 0.001260260          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | 1            |          |          |          | 459.69      | 838.54  | 0.001192548          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | 2            |          |          |          | 466.55      | 830.89  | 0.001203528          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | 3            |          |          |          | 470.38      | 837.32  | 0.001194286          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil                          | Average      |          |          |          | 465.54      | 835.583 | 0.001196769          |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) |          |          |          | 9.3810      | 5.3051  | -5.0379              |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ amd-pstate-ondemand VS amd-pstate-schedutil     | Comprison(%) | 124.7392 | -36.2934 | 140.7329 | 1.1081      | 2.0661  | -2.0242              |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-ondemand VS amd-pstate-ondemand    | Comprison(%) |          |          |          | 10.4665     | 7.5968  | -7.0605              |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
+ acpi-cpufreq-schedutil VS amd-pstate-schedutil  | Comprison(%) |          |          |          | 2.1115      | 4.2873  | -4.1110              |
+-------------------------------------------------+--------------+----------+----------+----------+-------------+---------+----------------------+
Tbench 결과 열
의미
GovernorDriver와 governor 조합
Round반복 번호 또는 Average/Comparison
Des-perfDesired performance
FreqGHz 단위 frequency
LoadCPU load
Performancetbench MB/s 또는 gitsource 실행 시간
EnergyJoule
Performance Per Watttbench MB/J 또는 gitsource 1/J

Tbench CSV 표의 성능·전력 비교 열을 한국어 의미와 대응시켰습니다.

Gitsource 결과 열
의미
GovernorDriver와 governor 조합
Round반복 번호 또는 Average/Comparison
Des-perfDesired performance
FreqGHz 단위 frequency
LoadCPU load
PerformanceGitsource 실행 시간(s)
EnergyJoule
Performance Per Watttbench MB/J 또는 gitsource 1/J

Gitsource CSV 표에서 Performance가 실행 시간으로 기록되는 차이를 포함해 열을 대응시켰습니다.

표의 수치는 특정 test run의 예시입니다. Driver 우열의 일반 결론으로 사용하지 말고 동일 system·kernel·governor 조건에서 새로 측정한 결과를 비교해야 합니다.

참고 문헌

789-802

[1] `AMD64 Architecture Programmer's Manual Volume 2: System Programming`은 AMD64 system programming 사양입니다: `https://www.amd.com/system/files/TechDocs/24593.pdf`.

[2] `Advanced Configuration and Power Interface Specification`은 ACPI 6.4 사양입니다: `https://uefi.org/sites/default/files/resources/ACPI_Spec_6_4_Jan22.pdf`.

[3] `Processor Programming Reference (PPR) for AMD Family 19h Model 51h, Revision A1 Processors`: `https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip`.

[4] `Linux Kernel Selftests`: `https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html`.