^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) Collaborative Processor Performance Control (CPPC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) ==================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) CPPC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) ====
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) CPPC defined in the ACPI spec describes a mechanism for the OS to manage the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) performance of a logical processor on a contigious and abstract performance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) scale. CPPC exposes a set of registers to describe abstract performance scale,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) to request performance levels and to measure per-cpu delivered performance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) For more details on CPPC please refer to the ACPI specification at:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) http://uefi.org/specifications
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) Some of the CPPC registers are exposed via sysfs under::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) /sys/devices/system/cpu/cpuX/acpi_cppc/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) for each cpu X::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) $ ls -lR /sys/devices/system/cpu/cpu0/acpi_cppc/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /sys/devices/system/cpu/cpu0/acpi_cppc/:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) total 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) -r--r--r-- 1 root root 65536 Mar 5 19:38 feedback_ctrs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) -r--r--r-- 1 root root 65536 Mar 5 19:38 highest_perf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_freq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_nonlinear_perf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) -r--r--r-- 1 root root 65536 Mar 5 19:38 lowest_perf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) -r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_freq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) -r--r--r-- 1 root root 65536 Mar 5 19:38 nominal_perf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) -r--r--r-- 1 root root 65536 Mar 5 19:38 reference_perf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) -r--r--r-- 1 root root 65536 Mar 5 19:38 wraparound_time
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * highest_perf : Highest performance of this processor (abstract scale).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * nominal_perf : Highest sustained performance of this processor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) (abstract scale).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * lowest_nonlinear_perf : Lowest performance of this processor with nonlinear
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) power savings (abstract scale).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * lowest_perf : Lowest performance of this processor (abstract scale).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * lowest_freq : CPU frequency corresponding to lowest_perf (in MHz).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * nominal_freq : CPU frequency corresponding to nominal_perf (in MHz).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) The above frequencies should only be used to report processor performance in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) freqency instead of abstract scale. These values should not be used for any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) functional decisions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * feedback_ctrs : Includes both Reference and delivered performance counter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) Reference counter ticks up proportional to processor's reference performance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) Delivered counter ticks up proportional to processor's delivered performance.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * wraparound_time: Minimum time for the feedback counters to wraparound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) (seconds).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * reference_perf : Performance level at which reference performance counter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) accumulates (abstract scale).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) Computing Average Delivered Performance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) =======================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) Below describes the steps to compute the average performance delivered by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) taking two different snapshots of feedback counters at time T1 and T2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) T1: Read feedback_ctrs as fbc_t1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) Wait or run some workload
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) T2: Read feedback_ctrs as fbc_t2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) ::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) delivered_counter_delta = fbc_t2[del] - fbc_t1[del]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) reference_counter_delta = fbc_t2[ref] - fbc_t1[ref]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) delivered_perf = (refernce_perf x delivered_counter_delta) / reference_counter_delta