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