Lines Matching +full:current +full:- +full:boost +full:- +full:limit

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 | | Min 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
153 if current operating conditions allow.
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*
252 table, so we need to expose it to sysfs. If boost is not active, but
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.
268 enabled. This attribute is read-only.
274 runtime based on platform conditions. This attribute is read-only.
281 to the low-level firmware about the user's desired energy vs efficiency
283 firmware. This attribute is read-only.
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
293 This attribute is read-write.
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
301 When the boost feature is enabled, the CPU can dynamically increase its frequency
303 On the other hand, disabling the boost feature restricts the CPU to operate at the
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.
315 ``amd-pstate`` vs ``acpi-cpufreq``
318 On the majority of AMD platforms supported by ``acpi-cpufreq``, the ACPI tables
320 only provide 3 P-states on AMD processors.
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
330 ``amd-pstate`` Driver Operation Modes
334 non-autonomous (passive) mode and guided autonomous (guided) mode.
337 - In autonomous mode, platform ignores the desired performance level request
340 - In non-autonomous mode, platform gets desired performance level
342 - In guided-autonomous mode, platform sets operating performance level
343 autonomously according to the current workload and within the limits set by
347 ------------
351 This is the low-level firmware control mode which is implemented by ``amd_pstate_epp``
360 ------------
370 processor must provide at least nominal performance requested and go higher if current
374 -----------
381 and appropriate to the current workload.
383 ``amd-pstate`` Preferred Core
394 ``amd-pstate`` preferred core enables the scheduler to prefer scheduling on
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
403 ``amd-pstate`` driver will provide an initial core ordering when the system boots.
406 with highest performance firstly for scheduling the process. When ``amd-pstate``
410 ``amd-pstate`` Preferred Core Switch
413 -----------------
415 ``amd-pstate`` peferred core`` has two states: enable and disable.
417 Default enable ``amd-pstate`` preferred core.
421 For systems that support ``amd-pstate`` preferred core, the core rankings will
425 User Space Interface in ``sysfs`` - General
429 -----------------
431 ``amd-pstate`` exposes several global attributes (files) in ``sysfs`` to
454 to the operation mode represented by that string - or to be
461 Enable the ``amd-pstate`` preferred core.
464 Disable the ``amd-pstate`` preferred core
467 This attribute is read-only to check the state of preferred core set
470 ``cpupower`` tool support for ``amd-pstate``
473 ``amd-pstate`` is supported by the ``cpupower`` tool, which can be used to dump
475 operations for the new ``amd-pstate`` module with this tool. ::
477 root@hr-test1:/home/ray# cpupower frequency-info
479 driver: amd-pstate
483 hardware limits: 400 MHz - 4.68 GHz
485 current policy: frequency should be within 400 MHz and 4.68 GHz.
488 current CPU frequency: Unable to call hardware
489 current CPU frequency: 4.02 GHz (asserted by call to kernel)
490 boost state support:
495 AMD PSTATE Lowest Non-linear Performance: 39. Lowest Non-linear Frequency: 1.10 GHz.
503 --------------
505 There are two static trace events that can be used for ``amd-pstate``
508 specific to ``amd-pstate``. The following sequence of shell commands can
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
517 # entries-in-buffer/entries-written: 47827/42233061 #P:2
519 # _-----=> irqs-off
520 # / _----=> need-resched
521 # | / _---=> hardirq/softirq
522 # || / _--=> preempt-depth
524 # TASK-PID CPU# |||| TIMESTAMP FUNCTION
526 …<idle>-0 [015] dN... 4995.979886: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
527 …<idle>-0 [007] d.h.. 4995.979893: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
528 …cat-2161 [000] d.... 4995.980841: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_per…
529 …sshd-2125 [004] d.s.. 4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_pe…
530 …<idle>-0 [007] d.s.. 4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
531 …<idle>-0 [003] d.s.. 4995.980971: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
532 …<idle>-0 [011] d.s.. 4995.980996: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
540 -------------
542 ``amd_pstate_tracer.py`` can record and parse ``amd-pstate`` trace log, then
544 performance of ``amd-pstate`` driver. The tracer tool needs to import intel
551 ./amd_pstate_trace.py [-c cpus] -t <trace_file> -n <test_name>
555 sudo ./amd_pstate_trace.py [-c cpus] -n <test_name> -i <interval> [-m kbytes]
561 … 0.7565 9645075 2214891 38431470 25.1 11.646 469 2.496 kworker/5:0-40
562 … 0.6769 8950227 1839034 37192089 24.06 11.272 470 2.496 kworker/6:0-1264
564 Unit Tests for amd-pstate
565 -------------------------
567 ``amd-pstate-ut`` is a test module for testing the ``amd-pstate`` driver.
579 Test prerequisite and basic functions for the ``amd-pstate`` driver.
581 …+---------+--------------------------------+------------------------------------------------------…
587 …+---------+--------------------------------+------------------------------------------------------…
588 …| 2 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. …
590 …| | || AMD P-States and ACPI hardware P-States always can b…
591 …| | | But AMD P-States has the higher priority and if it is…
593 …| | | request from AMD P-States. …
594 …+---------+--------------------------------+------------------------------------------------------…
597 …+---------+--------------------------------+------------------------------------------------------…
598 …k_freq || Check if the each frequency values and max freq when set support boost mode |
601 …| | || If boost is not active but supported, this maximum f…
603 …+---------+--------------------------------+------------------------------------------------------…
610 Tbench can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
617 Gitsource can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
622 We create ``amd-pstate-ut`` module and tie it into kselftest.(for
633 $ make -C tools/testing/selftests
643 $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest
645 $ sudo ./kselftest/run_kselftest.sh -c amd-pstate
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 -- -
658 [-h <help>]
659 [-o <output-file-for-dump>]
660 [-c <all: All 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>]
690 …+-------------------------------------------------+--------------+----------+---------+----------+
691 …+ Governor | Round | Des-perf | Freq | Load |…
692 …+-------------------------------------------------+--------------+----------+---------+----------+
695 …+ amd-pstate-ondemand | 1 | | | |…
696 …+-------------------------------------------------+--------------+----------+---------+----------+
697 …+ amd-pstate-ondemand | 2 | | | |…
698 …+-------------------------------------------------+--------------+----------+---------+----------+
699 …+ amd-pstate-ondemand | 3 | | | |…
700 …+-------------------------------------------------+--------------+----------+---------+----------+
701 …+ amd-pstate-ondemand | Average | | | |…
702 …+-------------------------------------------------+--------------+----------+---------+----------+
703 …+ amd-pstate-schedutil | 1 | 165.329 | 1.62257 | 99.798 |…
704 …+-------------------------------------------------+--------------+----------+---------+----------+
705 …+ amd-pstate-schedutil | 2 | 166 | 1.49761 | 99.9993 |…
706 …+-------------------------------------------------+--------------+----------+---------+----------+
707 …+ amd-pstate-schedutil | 3 | 166 | 1.47806 | 99.9993 |…
708 …+-------------------------------------------------+--------------+----------+---------+----------+
709 …+ amd-pstate-schedutil | Average | 165.776 | 1.53275 | 99.9322 |…
710 …+-------------------------------------------------+--------------+----------+---------+----------+
711 …+ acpi-cpufreq-ondemand | 1 | | | |…
712 …+-------------------------------------------------+--------------+----------+---------+----------+
713 …+ acpi-cpufreq-ondemand | 2 | | | |…
714 …+-------------------------------------------------+--------------+----------+---------+----------+
715 …+ acpi-cpufreq-ondemand | 3 | | | |…
716 …+-------------------------------------------------+--------------+----------+---------+----------+
717 …+ acpi-cpufreq-ondemand | Average | | | |…
718 …+-------------------------------------------------+--------------+----------+---------+----------+
719 …+ acpi-cpufreq-schedutil | 1 | | | |…
720 …+-------------------------------------------------+--------------+----------+---------+----------+
721 …+ acpi-cpufreq-schedutil | 2 | | | |…
722 …+-------------------------------------------------+--------------+----------+---------+----------+
723 …+ acpi-cpufreq-schedutil | 3 | | | |…
724 …+-------------------------------------------------+--------------+----------+---------+----------+
725 …+ acpi-cpufreq-schedutil | Average | | | |…
726 …+-------------------------------------------------+--------------+----------+---------+----------+
727 …+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | |…
728 …+-------------------------------------------------+--------------+----------+---------+----------+
729 …+ amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | | | |…
730 …+-------------------------------------------------+--------------+----------+---------+----------+
731 …+ acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | |…
732 …+-------------------------------------------------+--------------+----------+---------+----------+
733 …+ acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | |…
734 …+-------------------------------------------------+--------------+----------+---------+----------+
743 …+-------------------------------------------------+--------------+----------+----------+----------
744 …+ Governor | Round | Des-perf | Freq | Load …
745 …+-------------------------------------------------+--------------+----------+----------+----------
748 …+ amd-pstate-ondemand | 1 | 50.119 | 2.10509 | 23.3076 …
749 …+-------------------------------------------------+--------------+----------+----------+----------
750 …+ amd-pstate-ondemand | 2 | 94.8006 | 1.98771 | 56.6533 …
751 …+-------------------------------------------------+--------------+----------+----------+----------
752 …+ amd-pstate-ondemand | 3 | 76.6091 | 2.53251 | 43.7791 …
753 …+-------------------------------------------------+--------------+----------+----------+----------
754 …+ amd-pstate-ondemand | Average | 73.8429 | 2.20844 | 41.2467 …
755 …+-------------------------------------------------+--------------+----------+----------+----------
756 …+ amd-pstate-schedutil | 1 | 165.919 | 1.62319 | 98.3868 …
757 …+-------------------------------------------------+--------------+----------+----------+----------
758 …+ amd-pstate-schedutil | 2 | 165.97 | 1.31309 | 99.5712 …
759 …+-------------------------------------------------+--------------+----------+----------+----------
760 …+ amd-pstate-schedutil | 3 | 165.973 | 1.28448 | 99.9252 …
761 …+-------------------------------------------------+--------------+----------+----------+----------
762 …+ amd-pstate-schedutil | Average | 165.954 | 1.40692 | 99.2944 …
763 …+-------------------------------------------------+--------------+----------+----------+----------
764 …+ acpi-cpufreq-ondemand | 1 | | | …
765 …+-------------------------------------------------+--------------+----------+----------+----------
766 …+ acpi-cpufreq-ondemand | 2 | | | …
767 …+-------------------------------------------------+--------------+----------+----------+----------
768 …+ acpi-cpufreq-ondemand | 3 | | | …
769 …+-------------------------------------------------+--------------+----------+----------+----------
770 …+ acpi-cpufreq-ondemand | Average | | | …
771 …+-------------------------------------------------+--------------+----------+----------+----------
772 …+ acpi-cpufreq-schedutil | 1 | | | …
773 …+-------------------------------------------------+--------------+----------+----------+----------
774 …+ acpi-cpufreq-schedutil | 2 | | | …
775 …+-------------------------------------------------+--------------+----------+----------+----------
776 …+ acpi-cpufreq-schedutil | 3 | | | …
777 …+-------------------------------------------------+--------------+----------+----------+----------
778 …+ acpi-cpufreq-schedutil | Average | | | …
779 …+-------------------------------------------------+--------------+----------+----------+----------
780 …+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | …
781 …+-------------------------------------------------+--------------+----------+----------+----------
782 …+ amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | 124.7392 | -36.2934 | 140.7329 …
783 …+-------------------------------------------------+--------------+----------+----------+----------
784 …+ acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | …
785 …+-------------------------------------------------+--------------+----------+----------+----------
786 …+ acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | …
787 …+-------------------------------------------------+--------------+----------+----------+----------
799 https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip
802 https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html