perf/x86/intel: Support TopDown metrics on Ice Lake
authorKan Liang <kan.liang@linux.intel.com>
Thu, 23 Jul 2020 17:11:13 +0000 (10:11 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 18 Aug 2020 14:34:37 +0000 (16:34 +0200)
commit59a854e2f3b90ad2cc7368ae392de40b981ad51d
treeb70791ce7f8db8bfcd0e5e1b168deb2c401a8e49
parent0e2e45e2ded4988f5641115fd996c75dc32e4be3
perf/x86/intel: Support TopDown metrics on Ice Lake

Ice Lake supports the hardware TopDown metrics feature, which can free
up the scarce GP counters.

Update the event constraints for the metrics events. The metric counters
do not exist, which are mapped to a dummy offset. The sharing between
multiple users of the same metric without multiplexing is not allowed.

Implement set_topdown_event_period for Ice Lake. The values in
PERF_METRICS MSR are derived from the fixed counter 3. Both registers
should start from zero.

Implement update_topdown_event for Ice Lake. The metric is reported by
multiplying the metric (fraction) with slots. To maintain accurate
measurements, both registers are cleared for each update. The fixed
counter 3 should always be cleared before the PERF_METRICS.

Implement td_attr for the new metrics events and the new slots fixed
counter. Make them visible to the perf user tools.

Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200723171117.9918-11-kan.liang@linux.intel.com
arch/x86/events/intel/core.c
arch/x86/events/perf_event.h
arch/x86/include/asm/msr-index.h
arch/x86/include/asm/perf_event.h