13e57460fSChangbin Du.. SPDX-License-Identifier: GPL-2.0
23e57460fSChangbin Du
33e57460fSChangbin Du==================================================
43e57460fSChangbin DuCollaborative Processor Performance Control (CPPC)
53e57460fSChangbin Du==================================================
63e57460fSChangbin Du
7c2276088SHuang Rui.. _cppc_sysfs:
8c2276088SHuang Rui
93e57460fSChangbin DuCPPC
103e57460fSChangbin Du====
113e57460fSChangbin Du
123e57460fSChangbin DuCPPC defined in the ACPI spec describes a mechanism for the OS to manage the
13b2105aa2SAndrew Klychkovperformance of a logical processor on a contiguous and abstract performance
143e57460fSChangbin Duscale. CPPC exposes a set of registers to describe abstract performance scale,
153e57460fSChangbin Duto request performance levels and to measure per-cpu delivered performance.
163e57460fSChangbin Du
173e57460fSChangbin DuFor more details on CPPC please refer to the ACPI specification at:
183e57460fSChangbin Du
193e57460fSChangbin Duhttp://uefi.org/specifications
203e57460fSChangbin Du
213e57460fSChangbin DuSome of the CPPC registers are exposed via sysfs under::
223e57460fSChangbin Du
233e57460fSChangbin Du  /sys/devices/system/cpu/cpuX/acpi_cppc/
243e57460fSChangbin Du
253e57460fSChangbin Dufor each cpu X::
263e57460fSChangbin Du
273e57460fSChangbin Du  $ ls -lR  /sys/devices/system/cpu/cpu0/acpi_cppc/
283e57460fSChangbin Du  /sys/devices/system/cpu/cpu0/acpi_cppc/:
293e57460fSChangbin Du  total 0
303e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 feedback_ctrs
313e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 highest_perf
323e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 lowest_freq
333e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 lowest_nonlinear_perf
343e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 lowest_perf
353e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 nominal_freq
363e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 nominal_perf
373e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 reference_perf
383e57460fSChangbin Du  -r--r--r-- 1 root root 65536 Mar  5 19:38 wraparound_time
393e57460fSChangbin Du
403e57460fSChangbin Du* highest_perf : Highest performance of this processor (abstract scale).
413e57460fSChangbin Du* nominal_perf : Highest sustained performance of this processor
423e57460fSChangbin Du  (abstract scale).
433e57460fSChangbin Du* lowest_nonlinear_perf : Lowest performance of this processor with nonlinear
443e57460fSChangbin Du  power savings (abstract scale).
453e57460fSChangbin Du* lowest_perf : Lowest performance of this processor (abstract scale).
463e57460fSChangbin Du
473e57460fSChangbin Du* lowest_freq : CPU frequency corresponding to lowest_perf (in MHz).
483e57460fSChangbin Du* nominal_freq : CPU frequency corresponding to nominal_perf (in MHz).
493e57460fSChangbin Du  The above frequencies should only be used to report processor performance in
50b2105aa2SAndrew Klychkov  frequency instead of abstract scale. These values should not be used for any
513e57460fSChangbin Du  functional decisions.
523e57460fSChangbin Du
533e57460fSChangbin Du* feedback_ctrs : Includes both Reference and delivered performance counter.
543e57460fSChangbin Du  Reference counter ticks up proportional to processor's reference performance.
553e57460fSChangbin Du  Delivered counter ticks up proportional to processor's delivered performance.
563e57460fSChangbin Du* wraparound_time: Minimum time for the feedback counters to wraparound
573e57460fSChangbin Du  (seconds).
583e57460fSChangbin Du* reference_perf : Performance level at which reference performance counter
593e57460fSChangbin Du  accumulates (abstract scale).
603e57460fSChangbin Du
613e57460fSChangbin Du
623e57460fSChangbin DuComputing Average Delivered Performance
633e57460fSChangbin Du=======================================
643e57460fSChangbin Du
653e57460fSChangbin DuBelow describes the steps to compute the average performance delivered by
663e57460fSChangbin Dutaking two different snapshots of feedback counters at time T1 and T2.
673e57460fSChangbin Du
683e57460fSChangbin Du  T1: Read feedback_ctrs as fbc_t1
693e57460fSChangbin Du      Wait or run some workload
703e57460fSChangbin Du
713e57460fSChangbin Du  T2: Read feedback_ctrs as fbc_t2
723e57460fSChangbin Du
733e57460fSChangbin Du::
743e57460fSChangbin Du
753e57460fSChangbin Du  delivered_counter_delta = fbc_t2[del] - fbc_t1[del]
763e57460fSChangbin Du  reference_counter_delta = fbc_t2[ref] - fbc_t1[ref]
773e57460fSChangbin Du
78*03c30586SErwan Velu  delivered_perf = (reference_perf x delivered_counter_delta) / reference_counter_delta
79