OSDN Git Service

perf/x86/intel: Support per-thread RDPMC TopDown metrics
authorKan Liang <kan.liang@linux.intel.com>
Thu, 23 Jul 2020 17:11:14 +0000 (10:11 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 18 Aug 2020 14:34:37 +0000 (16:34 +0200)
commit2cb5383b30d47c446ec7d884cd80f93ffcc31817
treed8b2963bff1b5a75b9d65b2e6680b841b1d91b03
parent59a854e2f3b90ad2cc7368ae392de40b981ad51d
perf/x86/intel: Support per-thread RDPMC TopDown metrics

Starts from Ice Lake, the TopDown metrics are directly available as
fixed counters and do not require generic counters. Also, the TopDown
metrics can be collected per thread. Extend the RDPMC usage to support
per-thread TopDown metrics.

The RDPMC index of the PERF_METRICS will be output if RDPMC users ask
for the RDPMC index of the metrics events.

To support per thread RDPMC TopDown, the metrics and slots counters have
to be saved/restored during the context switching.

The last_period and period_left are not used in the counting mode. Use
the fields for saved_metric and saved_slots.

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-12-kan.liang@linux.intel.com
arch/x86/events/core.c
arch/x86/events/intel/core.c
include/linux/perf_event.h