Lines Matching +full:- +full:- +full:- +full:-
1 .. SPDX-License-Identifier: GPL-2.0
5 ``amd-pstate`` CPU Performance Scaling Driver
16 ``amd-pstate`` is the AMD CPU performance scaling driver that introduces a
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
26 ``amd-pstate`` leverages the Linux kernel governors such as ``schedutil``,
30 Volume 2: System Programming [1]_). Currently, ``amd-pstate`` supports basic
40 continuous, abstract, and unit-less performance value in a scale that is
45 interpreter for performance adjustments. ``amd-pstate`` will initialize a
49 Highest Perf ------>+-----------------------+ +-----------------------+
52 | | Max Perf ---->| |
55 Nominal Perf ------>+-----------------------+ +-----------------------+
62 | | Desired Perf ---->| |
72 Lowest non- | | | |
73 linear perf ------>+-----------------------+ +-----------------------+
75 | | Lowest perf ---->| |
77 Lowest perf ------>+-----------------------+ +-----------------------+
81 0 ------>+-----------------------+ +-----------------------+
83 AMD P-States Performance Scale
89 --------------------------------
110 Lowest non-linear Performance (RO)
117 effectively conveys the most efficient performance level to ``amd-pstate``.
128 ------------------------------
130 ``amd-pstate`` passes performance goals through these registers. The
136 ``amd-pstate`` specifies the minimum allowed performance level.
141 ``amd-pstate`` specifies a limit the maximum performance that is expected
147 ``amd-pstate`` specifies a desired target in the CPPC performance scale as
165 ``amd-pstate`` can be used with all the (generic) scaling governors listed
173 ``amd-pstate`` mainly supports ``schedutil`` and ``ondemand`` for dynamic
175 ``amd-pstate`` to the ``schedutil`` with CPU CFS scheduler. ``amd-pstate``
182 Then, ``amd-pstate`` updates the desired performance according to the CPU
190 The ``amd-pstate`` initialization will fail if the ``_CPC`` entry in the ACPI
193 ACPI hardware P-States function, so when ``amd-pstate`` fails initialization,
194 the kernel will fall back to initialize the ``acpi-cpufreq`` driver.
196 There are two types of hardware implementations for ``amd-pstate``: one is
201 ``amd-pstate`` is to register different ``static_call`` instances for different
204 Currently, some of the Zen2 and Zen3 processors support ``amd-pstate``. In the
208 -----------------
212 ``amd-pstate`` can handle the MSR register to implement the fast switch
218 ----------------------
221 processor supports the shared memory solution. In this case, ``amd-pstate``
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
230 to the request from AMD P-States.
233 User Space Interface in ``sysfs`` - Per-policy control
236 ``amd-pstate`` exposes several global attributes (files) in ``sysfs`` to
240 root@hr-test1:/home/ray# ls /sys/devices/system/cpu/cpufreq/policy0/*amd*
255 This attribute is read-only.
259 The lowest non-linear CPPC CPU frequency that the driver is allowed to set,
261 lowest non-linear performance in `AMD CPPC Performance Capability
263 This attribute is read-only.
270 to the low-level firmware about the user's desired energy vs efficiency
272 firmware. This attribute is read-only.
282 This attribute is read-write.
288 ``amd-pstate`` vs ``acpi-cpufreq``
291 On the majority of AMD platforms supported by ``acpi-cpufreq``, the ACPI tables
293 only provide 3 P-states on AMD processors.
296 for AMD platforms. That is, fine-grained and continuous frequency ranges
297 instead of the legacy hardware P-states. ``amd-pstate`` is the kernel
298 module which supports the new AMD P-States mechanism on most of the future AMD
299 platforms. The AMD P-States mechanism is the more performance and energy
307 non-autonomous (passive) mode and guided autonomous (guided) mode.
310 - In autonomous mode, platform ignores the desired performance level request
313 - In non-autonomous mode, platform gets desired performance level
315 - In guided-autonomous mode, platform sets operating performance level
320 ------------
324 This is the low-level firmware control mode which is implemented by ``amd_pstate_epp``
333 ------------
347 -----------
356 User Space Interface in ``sysfs`` - General
360 -----------------
362 ``amd-pstate`` exposes several global attributes (files) in ``sysfs`` to
364 ``/sys/devices/system/cpu/amd-pstate/`` directory and affect all CPUs.
385 to the operation mode represented by that string - or to be
388 ``cpupower`` tool support for ``amd-pstate``
391 ``amd-pstate`` is supported by the ``cpupower`` tool, which can be used to dump
393 operations for the new ``amd-pstate`` module with this tool. ::
395 root@hr-test1:/home/ray# cpupower frequency-info
397 driver: amd-pstate
401 hardware limits: 400 MHz - 4.68 GHz
413 AMD PSTATE Lowest Non-linear Performance: 39. Lowest Non-linear Frequency: 1.10 GHz.
421 --------------
423 There are two static trace events that can be used for ``amd-pstate``
426 specific to ``amd-pstate``. The following sequence of shell commands can
430 root@hr-test1:/home/ray# cd /sys/kernel/tracing/
431 root@hr-test1:/sys/kernel/tracing# echo 1 > events/amd_cpu/enable
432 root@hr-test1:/sys/kernel/tracing# cat trace
435 # entries-in-buffer/entries-written: 47827/42233061 #P:2
437 # _-----=> irqs-off
438 # / _----=> need-resched
439 # | / _---=> hardirq/softirq
440 # || / _--=> preempt-depth
442 # TASK-PID CPU# |||| TIMESTAMP FUNCTION
444 …<idle>-0 [015] dN... 4995.979886: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
445 …<idle>-0 [007] d.h.. 4995.979893: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
446 …cat-2161 [000] d.... 4995.980841: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_per…
447 …sshd-2125 [004] d.s.. 4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_pe…
448 …<idle>-0 [007] d.s.. 4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
449 …<idle>-0 [003] d.s.. 4995.980971: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
450 …<idle>-0 [011] d.s.. 4995.980996: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
458 -------------
460 ``amd_pstate_tracer.py`` can record and parse ``amd-pstate`` trace log, then
462 performance of ``amd-pstate`` driver. The tracer tool needs to import intel
469 ./amd_pstate_trace.py [-c cpus] -t <trace_file> -n <test_name>
473 sudo ./amd_pstate_trace.py [-c cpus] -n <test_name> -i <interval> [-m kbytes]
479 … 0.7565 9645075 2214891 38431470 25.1 11.646 469 2.496 kworker/5:0-40
480 … 0.6769 8950227 1839034 37192089 24.06 11.272 470 2.496 kworker/6:0-1264
482 Unit Tests for amd-pstate
483 -------------------------
485 ``amd-pstate-ut`` is a test module for testing the ``amd-pstate`` driver.
497 Test prerequisite and basic functions for the ``amd-pstate`` driver.
499 …+---------+--------------------------------+------------------------------------------------------…
505 …+---------+--------------------------------+------------------------------------------------------…
506 …| 2 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. …
508 …| | || AMD P-States and ACPI hardware P-States always can b…
509 …| | | But AMD P-States has the higher priority and if it is…
511 …| | | request from AMD P-States. …
512 …+---------+--------------------------------+------------------------------------------------------…
515 …+---------+--------------------------------+------------------------------------------------------…
521 …+---------+--------------------------------+------------------------------------------------------…
528 Tbench can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
535 Gitsource can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
540 We create ``amd-pstate-ut`` module and tie it into kselftest.(for
551 $ make -C tools/testing/selftests
561 $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest
563 $ sudo ./kselftest/run_kselftest.sh -c amd-pstate
567 $ cd ~/kselftest/amd-pstate
568 $ sudo ./run.sh -t basic
569 $ sudo ./run.sh -t tbench
570 $ sudo ./run.sh -t tbench -m acpi-cpufreq
571 $ sudo ./run.sh -t gitsource
572 $ sudo ./run.sh -t gitsource -m acpi-cpufreq
573 $ ./run.sh --help
574 ./run.sh: illegal option -- -
576 [-h <help>]
577 [-o <output-file-for-dump>]
578 [-c <all: All testing,
582 [-t <tbench time limit>]
583 [-p <tbench process number>]
584 [-l <loop times for tbench>]
585 [-i <amd tracer interval>]
586 [-m <comparative test: acpi-cpufreq>]
608 …+-------------------------------------------------+--------------+----------+---------+----------+…
609 …+ Governor | Round | Des-perf | Freq | Load |…
610 …+-------------------------------------------------+--------------+----------+---------+----------+…
613 …+ amd-pstate-ondemand | 1 | | | |…
614 …+-------------------------------------------------+--------------+----------+---------+----------+…
615 …+ amd-pstate-ondemand | 2 | | | |…
616 …+-------------------------------------------------+--------------+----------+---------+----------+…
617 …+ amd-pstate-ondemand | 3 | | | |…
618 …+-------------------------------------------------+--------------+----------+---------+----------+…
619 …+ amd-pstate-ondemand | Average | | | |…
620 …+-------------------------------------------------+--------------+----------+---------+----------+…
621 …+ amd-pstate-schedutil | 1 | 165.329 | 1.62257 | 99.798 |…
622 …+-------------------------------------------------+--------------+----------+---------+----------+…
623 …+ amd-pstate-schedutil | 2 | 166 | 1.49761 | 99.9993 |…
624 …+-------------------------------------------------+--------------+----------+---------+----------+…
625 …+ amd-pstate-schedutil | 3 | 166 | 1.47806 | 99.9993 |…
626 …+-------------------------------------------------+--------------+----------+---------+----------+…
627 …+ amd-pstate-schedutil | Average | 165.776 | 1.53275 | 99.9322 |…
628 …+-------------------------------------------------+--------------+----------+---------+----------+…
629 …+ acpi-cpufreq-ondemand | 1 | | | |…
630 …+-------------------------------------------------+--------------+----------+---------+----------+…
631 …+ acpi-cpufreq-ondemand | 2 | | | |…
632 …+-------------------------------------------------+--------------+----------+---------+----------+…
633 …+ acpi-cpufreq-ondemand | 3 | | | |…
634 …+-------------------------------------------------+--------------+----------+---------+----------+…
635 …+ acpi-cpufreq-ondemand | Average | | | |…
636 …+-------------------------------------------------+--------------+----------+---------+----------+…
637 …+ acpi-cpufreq-schedutil | 1 | | | |…
638 …+-------------------------------------------------+--------------+----------+---------+----------+…
639 …+ acpi-cpufreq-schedutil | 2 | | | |…
640 …+-------------------------------------------------+--------------+----------+---------+----------+…
641 …+ acpi-cpufreq-schedutil | 3 | | | |…
642 …+-------------------------------------------------+--------------+----------+---------+----------+…
643 …+ acpi-cpufreq-schedutil | Average | | | |…
644 …+-------------------------------------------------+--------------+----------+---------+----------+…
645 …+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | |…
646 …+-------------------------------------------------+--------------+----------+---------+----------+…
647 …+ amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | | | |…
648 …+-------------------------------------------------+--------------+----------+---------+----------+…
649 …+ acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | |…
650 …+-------------------------------------------------+--------------+----------+---------+----------+…
651 …+ acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | |…
652 …+-------------------------------------------------+--------------+----------+---------+----------+…
661 …+-------------------------------------------------+--------------+----------+----------+----------…
662 …+ Governor | Round | Des-perf | Freq | Load …
663 …+-------------------------------------------------+--------------+----------+----------+----------…
666 …+ amd-pstate-ondemand | 1 | 50.119 | 2.10509 | 23.3076 …
667 …+-------------------------------------------------+--------------+----------+----------+----------…
668 …+ amd-pstate-ondemand | 2 | 94.8006 | 1.98771 | 56.6533 …
669 …+-------------------------------------------------+--------------+----------+----------+----------…
670 …+ amd-pstate-ondemand | 3 | 76.6091 | 2.53251 | 43.7791 …
671 …+-------------------------------------------------+--------------+----------+----------+----------…
672 …+ amd-pstate-ondemand | Average | 73.8429 | 2.20844 | 41.2467 …
673 …+-------------------------------------------------+--------------+----------+----------+----------…
674 …+ amd-pstate-schedutil | 1 | 165.919 | 1.62319 | 98.3868 …
675 …+-------------------------------------------------+--------------+----------+----------+----------…
676 …+ amd-pstate-schedutil | 2 | 165.97 | 1.31309 | 99.5712 …
677 …+-------------------------------------------------+--------------+----------+----------+----------…
678 …+ amd-pstate-schedutil | 3 | 165.973 | 1.28448 | 99.9252 …
679 …+-------------------------------------------------+--------------+----------+----------+----------…
680 …+ amd-pstate-schedutil | Average | 165.954 | 1.40692 | 99.2944 …
681 …+-------------------------------------------------+--------------+----------+----------+----------…
682 …+ acpi-cpufreq-ondemand | 1 | | | …
683 …+-------------------------------------------------+--------------+----------+----------+----------…
684 …+ acpi-cpufreq-ondemand | 2 | | | …
685 …+-------------------------------------------------+--------------+----------+----------+----------…
686 …+ acpi-cpufreq-ondemand | 3 | | | …
687 …+-------------------------------------------------+--------------+----------+----------+----------…
688 …+ acpi-cpufreq-ondemand | Average | | | …
689 …+-------------------------------------------------+--------------+----------+----------+----------…
690 …+ acpi-cpufreq-schedutil | 1 | | | …
691 …+-------------------------------------------------+--------------+----------+----------+----------…
692 …+ acpi-cpufreq-schedutil | 2 | | | …
693 …+-------------------------------------------------+--------------+----------+----------+----------…
694 …+ acpi-cpufreq-schedutil | 3 | | | …
695 …+-------------------------------------------------+--------------+----------+----------+----------…
696 …+ acpi-cpufreq-schedutil | Average | | | …
697 …+-------------------------------------------------+--------------+----------+----------+----------…
698 …+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | …
699 …+-------------------------------------------------+--------------+----------+----------+----------…
700 …+ amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | 124.7392 | -36.2934 | 140.7329 …
701 …+-------------------------------------------------+--------------+----------+----------+----------…
702 …+ acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | …
703 …+-------------------------------------------------+--------------+----------+----------+----------…
704 …+ acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | …
705 …+-------------------------------------------------+--------------+----------+----------+----------…
717 https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip
720 https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html