Skip to content
Commit 9a11df2c authored by James Clark's avatar James Clark
Browse files

arm64: perf: Add support for event counting threshold



FEAT_PMUv3_TH (Armv8.8) permits a PMU counter to increment only on
events whose count meets a specified threshold condition. For example if
PMEVTYPERn.TC (Threshold Control) is set to 0b101 (Greater than or
equal, count), and the threshold is set to 2, then the PMU counter will
now only increment by 1 when an event would have previously incremented
the PMU counter by 2 or more on a single processor cycle.

Two new Perf event config fields, 'threshold' and 'threshold_control'
have been added for controlling the feature:

 $ perf stat -e stall_slot/threshold=2,threshold_control=5/

A new capability for reading out the maximum supported threshold value
has also been added:

  $ cat /sys/bus/event_source/devices/armv8_pmuv3/caps/threshold_max

  0x000000ff

If a threshold higher than threshold_max is provided, then no error is
generated but the threshold is clamped to the max value. If
FEAT_PMUv3_TH isn't implemented, then threshold_max reads zero, and
neither the 'threshold' nor 'threshold_control' parameters will be used.

The threshold is per PMU counter, and there are potentially different
threshold_max values per PMU type on heterogeneous systems.

Signed-off-by: James Clark's avatarJames Clark <james.clark@arm.com>
parent 95afce39
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment