summaryrefslogtreecommitdiffstats
path: root/arch/x86/events/core.c
diff options
context:
space:
mode:
authorKan Liang <kan.liang@linux.intel.com>2020-07-23 19:11:14 +0200
committerPeter Zijlstra <peterz@infradead.org>2020-08-18 16:34:37 +0200
commit2cb5383b30d47c446ec7d884cd80f93ffcc31817 (patch)
treed8b2963bff1b5a75b9d65b2e6680b841b1d91b03 /arch/x86/events/core.c
parentperf/x86/intel: Support TopDown metrics on Ice Lake (diff)
downloadlinux-2cb5383b30d47c446ec7d884cd80f93ffcc31817.tar.xz
linux-2cb5383b30d47c446ec7d884cd80f93ffcc31817.zip
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
Diffstat (limited to 'arch/x86/events/core.c')
-rw-r--r--arch/x86/events/core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index ebf723f33794..0f3d01562ded 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -2257,7 +2257,10 @@ static int x86_pmu_event_idx(struct perf_event *event)
if (!(hwc->flags & PERF_X86_EVENT_RDPMC_ALLOWED))
return 0;
- return hwc->event_base_rdpmc + 1;
+ if (is_metric_idx(hwc->idx))
+ return INTEL_PMC_FIXED_RDPMC_METRICS + 1;
+ else
+ return hwc->event_base_rdpmc + 1;
}
static ssize_t get_attr_rdpmc(struct device *cdev,