提交 6173a704 编写于 作者: K Kan Liang 提交者: Yang Yingliang

Intel: perf/x86: Use event_base_rdpmc for the RDPMC userspace support

mainline inclusion
from mainline-v5.10-rc1
commit 75608cb0
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I47H3V
CVE: NA

--------------------------------

commit 75608cb0 upstream
Backport summary: backport to kernel 4.19.57 for ICX perf topdown support

The RDPMC index is always re-calculated for the RDPMC userspace support,
which is unnecessary.

The RDPMC index value is stored in the variable event_base_rdpmc for
the kernel usage, which can be used for RDPMC userspace support as well.
Suggested-by: NPeter Zijlstra <peterz@infradead.org>
Signed-off-by: NKan Liang <kan.liang@linux.intel.com>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200723171117.9918-2-kan.liang@linux.intel.comSigned-off-by: NYunying Sun <yunying.sun@intel.com>
Signed-off-by: NJackie Liu <liuyun01@kylinos.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 66d9e5d7
...@@ -2149,17 +2149,12 @@ static void x86_pmu_event_unmapped(struct perf_event *event, struct mm_struct *m ...@@ -2149,17 +2149,12 @@ static void x86_pmu_event_unmapped(struct perf_event *event, struct mm_struct *m
static int x86_pmu_event_idx(struct perf_event *event) static int x86_pmu_event_idx(struct perf_event *event)
{ {
int idx = event->hw.idx; struct hw_perf_event *hwc = &event->hw;
if (!(event->hw.flags & PERF_X86_EVENT_RDPMC_ALLOWED)) if (!(hwc->flags & PERF_X86_EVENT_RDPMC_ALLOWED))
return 0; return 0;
if (x86_pmu.num_counters_fixed && idx >= INTEL_PMC_IDX_FIXED) { return hwc->event_base_rdpmc + 1;
idx -= INTEL_PMC_IDX_FIXED;
idx |= 1 << 30;
}
return idx + 1;
} }
static ssize_t get_attr_rdpmc(struct device *cdev, static ssize_t get_attr_rdpmc(struct device *cdev,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册