Lines Matching +full:boost +full:- +full:low +full:- +full:freq
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
44 provide the low latency register model (MSR) instead of an AML code
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*
252 table, so we need to expose it to sysfs. If boost is not active, but
257 This attribute is read-only.
261 The lowest non-linear CPPC CPU frequency that the driver is allowed to set,
263 lowest non-linear performance in `AMD CPPC Performance Capability
265 This attribute is read-only.
270 enabled. This attribute is read-only.
276 runtime based on platform conditions. This attribute is read-only.
283 to the low-level firmware about the user's desired energy vs efficiency
285 firmware. This attribute is read-only.
295 This attribute is read-write.
297 ``boost``
298 The `boost` sysfs attribute provides control over the CPU core
299 performance boost, allowing users to manage the maximum frequency limitation
300 of the CPU. This attribute can be used to enable or disable the boost feature
303 When the boost feature is enabled, the CPU can dynamically increase its frequency
305 On the other hand, disabling the boost feature restricts the CPU to operate at the
309 To manipulate the `boost` attribute, users can write a value of `0` to disable the
310 boost or `1` to enable it, for the respective CPU using the sysfs path
311 `/sys/devices/system/cpu/cpuX/cpufreq/boost`, where `X` represents the CPU number.
317 ``amd-pstate`` vs ``acpi-cpufreq``
320 On the majority of AMD platforms supported by ``acpi-cpufreq``, the ACPI tables
322 only provide 3 P-states on AMD processors.
325 for AMD platforms. That is, fine-grained and continuous frequency ranges
326 instead of the legacy hardware P-states. ``amd-pstate`` is the kernel
327 module which supports the new AMD P-States mechanism on most of the future AMD
328 platforms. The AMD P-States mechanism is the more performance and energy
332 ``amd-pstate`` Driver Operation Modes
336 non-autonomous (passive) mode and guided autonomous (guided) mode.
339 - In autonomous mode, platform ignores the desired performance level request
342 - In non-autonomous mode, platform gets desired performance level
344 - In guided-autonomous mode, platform sets operating performance level
349 ------------
353 This is the low-level firmware control mode which is implemented by ``amd_pstate_epp``
362 ------------
376 -----------
385 ``amd-pstate`` Preferred Core
396 ``amd-pstate`` preferred core enables the scheduler to prefer scheduling on
401 The priority metric will be initialized by the ``amd-pstate`` driver. The ``amd-pstate``
402 driver will also determine whether or not ``amd-pstate`` preferred core is
405 ``amd-pstate`` driver will provide an initial core ordering when the system boots.
408 with highest performance firstly for scheduling the process. When ``amd-pstate``
412 ``amd-pstate`` Preferred Core Switch
415 -----------------
417 ``amd-pstate`` peferred core`` has two states: enable and disable.
419 Default enable ``amd-pstate`` preferred core.
423 For systems that support ``amd-pstate`` preferred core, the core rankings will
427 User Space Interface in ``sysfs`` - General
431 -----------------
433 ``amd-pstate`` exposes several global attributes (files) in ``sysfs`` to
456 to the operation mode represented by that string - or to be
463 Enable the ``amd-pstate`` preferred core.
466 Disable the ``amd-pstate`` preferred core
469 This attribute is read-only to check the state of preferred core set
472 ``cpupower`` tool support for ``amd-pstate``
475 ``amd-pstate`` is supported by the ``cpupower`` tool, which can be used to dump
477 operations for the new ``amd-pstate`` module with this tool. ::
479 root@hr-test1:/home/ray# cpupower frequency-info
481 driver: amd-pstate
485 hardware limits: 400 MHz - 4.68 GHz
492 boost state support:
497 AMD PSTATE Lowest Non-linear Performance: 39. Lowest Non-linear Frequency: 1.10 GHz.
505 --------------
507 There are two static trace events that can be used for ``amd-pstate``
510 specific to ``amd-pstate``. The following sequence of shell commands can
514 root@hr-test1:/home/ray# cd /sys/kernel/tracing/
515 root@hr-test1:/sys/kernel/tracing# echo 1 > events/amd_cpu/enable
516 root@hr-test1:/sys/kernel/tracing# cat trace
519 # entries-in-buffer/entries-written: 47827/42233061 #P:2
521 # _-----=> irqs-off
522 # / _----=> need-resched
523 # | / _---=> hardirq/softirq
524 # || / _--=> preempt-depth
526 # TASK-PID CPU# |||| TIMESTAMP FUNCTION
528 …<idle>-0 [015] dN... 4995.979886: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
529 …<idle>-0 [007] d.h.. 4995.979893: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
530 …cat-2161 [000] d.... 4995.980841: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_per…
531 …sshd-2125 [004] d.s.. 4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_pe…
532 …<idle>-0 [007] d.s.. 4995.980968: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
533 …<idle>-0 [003] d.s.. 4995.980971: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
534 …<idle>-0 [011] d.s.. 4995.980996: amd_pstate_perf: amd_min_perf=85 amd_des_perf=85 amd_max_…
542 -------------
544 ``amd_pstate_tracer.py`` can record and parse ``amd-pstate`` trace log, then
546 performance of ``amd-pstate`` driver. The tracer tool needs to import intel
553 ./amd_pstate_trace.py [-c cpus] -t <trace_file> -n <test_name>
557 sudo ./amd_pstate_trace.py [-c cpus] -n <test_name> -i <interval> [-m kbytes]
562 …common_cpu common_secs common_usecs min_perf des_perf max_perf freq mperf apef tsc …
563 … 0.7565 9645075 2214891 38431470 25.1 11.646 469 2.496 kworker/5:0-40
564 … 0.6769 8950227 1839034 37192089 24.06 11.272 470 2.496 kworker/6:0-1264
566 Unit Tests for amd-pstate
567 -------------------------
569 ``amd-pstate-ut`` is a test module for testing the ``amd-pstate`` driver.
581 Test prerequisite and basic functions for the ``amd-pstate`` driver.
583 …+---------+--------------------------------+------------------------------------------------------…
589 …+---------+--------------------------------+------------------------------------------------------…
590 …| 2 | amd_pstate_ut_check_enabled || Check whether AMD P-State is enabled. …
592 …| | || AMD P-States and ACPI hardware P-States always can b…
593 …| | | But AMD P-States has the higher priority and if it is…
595 …| | | request from AMD P-States. …
596 …+---------+--------------------------------+------------------------------------------------------…
599 …+---------+--------------------------------+------------------------------------------------------…
600 …check_freq || Check if the each frequency values and max freq when set support boost mode …
603 …| | || If boost is not active but supported, this maximum f…
605 …+---------+--------------------------------+------------------------------------------------------…
612 Tbench can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
619 Gitsource can also be tested on the ``acpi-cpufreq`` kernel driver for comparison.
624 We create ``amd-pstate-ut`` module and tie it into kselftest.(for
635 $ make -C tools/testing/selftests
645 $ make -C tools/testing/selftests install INSTALL_PATH=~/kselftest
647 $ sudo ./kselftest/run_kselftest.sh -c amd-pstate
651 $ cd ~/kselftest/amd-pstate
652 $ sudo ./run.sh -t basic
653 $ sudo ./run.sh -t tbench
654 $ sudo ./run.sh -t tbench -m acpi-cpufreq
655 $ sudo ./run.sh -t gitsource
656 $ sudo ./run.sh -t gitsource -m acpi-cpufreq
657 $ ./run.sh --help
658 ./run.sh: illegal option -- -
660 [-h <help>]
661 [-o <output-file-for-dump>]
662 [-c <all: All testing,
666 [-t <tbench time limit>]
667 [-p <tbench process number>]
668 [-l <loop times for tbench>]
669 [-i <amd tracer interval>]
670 [-m <comparative test: acpi-cpufreq>]
692 …+-------------------------------------------------+--------------+----------+---------+----------+…
693 …+ Governor | Round | Des-perf | Freq | Load |…
694 …+-------------------------------------------------+--------------+----------+---------+----------+…
697 …+ amd-pstate-ondemand | 1 | | | |…
698 …+-------------------------------------------------+--------------+----------+---------+----------+…
699 …+ amd-pstate-ondemand | 2 | | | |…
700 …+-------------------------------------------------+--------------+----------+---------+----------+…
701 …+ amd-pstate-ondemand | 3 | | | |…
702 …+-------------------------------------------------+--------------+----------+---------+----------+…
703 …+ amd-pstate-ondemand | Average | | | |…
704 …+-------------------------------------------------+--------------+----------+---------+----------+…
705 …+ amd-pstate-schedutil | 1 | 165.329 | 1.62257 | 99.798 |…
706 …+-------------------------------------------------+--------------+----------+---------+----------+…
707 …+ amd-pstate-schedutil | 2 | 166 | 1.49761 | 99.9993 |…
708 …+-------------------------------------------------+--------------+----------+---------+----------+…
709 …+ amd-pstate-schedutil | 3 | 166 | 1.47806 | 99.9993 |…
710 …+-------------------------------------------------+--------------+----------+---------+----------+…
711 …+ amd-pstate-schedutil | Average | 165.776 | 1.53275 | 99.9322 |…
712 …+-------------------------------------------------+--------------+----------+---------+----------+…
713 …+ acpi-cpufreq-ondemand | 1 | | | |…
714 …+-------------------------------------------------+--------------+----------+---------+----------+…
715 …+ acpi-cpufreq-ondemand | 2 | | | |…
716 …+-------------------------------------------------+--------------+----------+---------+----------+…
717 …+ acpi-cpufreq-ondemand | 3 | | | |…
718 …+-------------------------------------------------+--------------+----------+---------+----------+…
719 …+ acpi-cpufreq-ondemand | Average | | | |…
720 …+-------------------------------------------------+--------------+----------+---------+----------+…
721 …+ acpi-cpufreq-schedutil | 1 | | | |…
722 …+-------------------------------------------------+--------------+----------+---------+----------+…
723 …+ acpi-cpufreq-schedutil | 2 | | | |…
724 …+-------------------------------------------------+--------------+----------+---------+----------+…
725 …+ acpi-cpufreq-schedutil | 3 | | | |…
726 …+-------------------------------------------------+--------------+----------+---------+----------+…
727 …+ acpi-cpufreq-schedutil | Average | | | |…
728 …+-------------------------------------------------+--------------+----------+---------+----------+…
729 …+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | |…
730 …+-------------------------------------------------+--------------+----------+---------+----------+…
731 …+ amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | | | |…
732 …+-------------------------------------------------+--------------+----------+---------+----------+…
733 …+ acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | |…
734 …+-------------------------------------------------+--------------+----------+---------+----------+…
735 …+ acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | |…
736 …+-------------------------------------------------+--------------+----------+---------+----------+…
745 …+-------------------------------------------------+--------------+----------+----------+----------…
746 …+ Governor | Round | Des-perf | Freq | Load …
747 …+-------------------------------------------------+--------------+----------+----------+----------…
750 …+ amd-pstate-ondemand | 1 | 50.119 | 2.10509 | 23.3076 …
751 …+-------------------------------------------------+--------------+----------+----------+----------…
752 …+ amd-pstate-ondemand | 2 | 94.8006 | 1.98771 | 56.6533 …
753 …+-------------------------------------------------+--------------+----------+----------+----------…
754 …+ amd-pstate-ondemand | 3 | 76.6091 | 2.53251 | 43.7791 …
755 …+-------------------------------------------------+--------------+----------+----------+----------…
756 …+ amd-pstate-ondemand | Average | 73.8429 | 2.20844 | 41.2467 …
757 …+-------------------------------------------------+--------------+----------+----------+----------…
758 …+ amd-pstate-schedutil | 1 | 165.919 | 1.62319 | 98.3868 …
759 …+-------------------------------------------------+--------------+----------+----------+----------…
760 …+ amd-pstate-schedutil | 2 | 165.97 | 1.31309 | 99.5712 …
761 …+-------------------------------------------------+--------------+----------+----------+----------…
762 …+ amd-pstate-schedutil | 3 | 165.973 | 1.28448 | 99.9252 …
763 …+-------------------------------------------------+--------------+----------+----------+----------…
764 …+ amd-pstate-schedutil | Average | 165.954 | 1.40692 | 99.2944 …
765 …+-------------------------------------------------+--------------+----------+----------+----------…
766 …+ acpi-cpufreq-ondemand | 1 | | | …
767 …+-------------------------------------------------+--------------+----------+----------+----------…
768 …+ acpi-cpufreq-ondemand | 2 | | | …
769 …+-------------------------------------------------+--------------+----------+----------+----------…
770 …+ acpi-cpufreq-ondemand | 3 | | | …
771 …+-------------------------------------------------+--------------+----------+----------+----------…
772 …+ acpi-cpufreq-ondemand | Average | | | …
773 …+-------------------------------------------------+--------------+----------+----------+----------…
774 …+ acpi-cpufreq-schedutil | 1 | | | …
775 …+-------------------------------------------------+--------------+----------+----------+----------…
776 …+ acpi-cpufreq-schedutil | 2 | | | …
777 …+-------------------------------------------------+--------------+----------+----------+----------…
778 …+ acpi-cpufreq-schedutil | 3 | | | …
779 …+-------------------------------------------------+--------------+----------+----------+----------…
780 …+ acpi-cpufreq-schedutil | Average | | | …
781 …+-------------------------------------------------+--------------+----------+----------+----------…
782 …+ acpi-cpufreq-ondemand VS acpi-cpufreq-schedutil | Comprison(%) | | | …
783 …+-------------------------------------------------+--------------+----------+----------+----------…
784 …+ amd-pstate-ondemand VS amd-pstate-schedutil | Comprison(%) | 124.7392 | -36.2934 | 140.7329 …
785 …+-------------------------------------------------+--------------+----------+----------+----------…
786 …+ acpi-cpufreq-ondemand VS amd-pstate-ondemand | Comprison(%) | | | …
787 …+-------------------------------------------------+--------------+----------+----------+----------…
788 …+ acpi-cpufreq-schedutil VS amd-pstate-schedutil | Comprison(%) | | | …
789 …+-------------------------------------------------+--------------+----------+----------+----------…
801 https://www.amd.com/system/files/TechDocs/56569-A1-PUB.zip
804 https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html