提交 69c68da7 编写于 作者: J Jiri Olsa 提交者: Yang Yingliang

Intel: perf/x86: Use update attribute groups for default attributes

mainline inclusion
from mainline-v5.3-rc1
commit 6a9f4efe
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I47H3V
CVE: NA

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

commit 6a9f4efe upstream
Backport summary: backport to kernel 4.19.57 for ICX perf topdown support

Using the new pmu::update_attrs attribute group for default
attributes - freeze_on_smi, allow_tsx_force_abort.
Signed-off-by: NJiri Olsa <jolsa@kernel.org>
Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20190512155518.21468-10-jolsa@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
Signed-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>
上级 2cf61295
...@@ -1587,32 +1587,6 @@ static struct attribute_group x86_pmu_format_group = { ...@@ -1587,32 +1587,6 @@ static struct attribute_group x86_pmu_format_group = {
.attrs = NULL, .attrs = NULL,
}; };
/* Merge two pointer arrays */
__init struct attribute **merge_attr(struct attribute **a, struct attribute **b)
{
struct attribute **new;
int j, i;
for (j = 0; a && a[j]; j++)
;
for (i = 0; b && b[i]; i++)
j++;
j++;
new = kmalloc_array(j, sizeof(struct attribute *), GFP_KERNEL);
if (!new)
return NULL;
j = 0;
for (i = 0; a && a[i]; i++)
new[j++] = a[i];
for (i = 0; b && b[i]; i++)
new[j++] = b[i];
new[j] = NULL;
return new;
}
ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr, char *page) ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr, char *page)
{ {
struct perf_pmu_events_attr *pmu_attr = \ struct perf_pmu_events_attr *pmu_attr = \
...@@ -1797,14 +1771,6 @@ static int __init init_hw_perf_events(void) ...@@ -1797,14 +1771,6 @@ static int __init init_hw_perf_events(void)
if (!x86_pmu.events_sysfs_show) if (!x86_pmu.events_sysfs_show)
x86_pmu_events_group.attrs = &empty_attrs; x86_pmu_events_group.attrs = &empty_attrs;
if (x86_pmu.attrs) {
struct attribute **tmp;
tmp = merge_attr(x86_pmu_attr_group.attrs, x86_pmu.attrs);
if (!WARN_ON(!tmp))
x86_pmu_attr_group.attrs = tmp;
}
pmu.attr_update = x86_pmu.attr_update; pmu.attr_update = x86_pmu.attr_update;
pr_info("... version: %d\n", x86_pmu.version); pr_info("... version: %d\n", x86_pmu.version);
......
...@@ -3773,8 +3773,6 @@ static __initconst const struct x86_pmu core_pmu = { ...@@ -3773,8 +3773,6 @@ static __initconst const struct x86_pmu core_pmu = {
.check_period = intel_pmu_check_period, .check_period = intel_pmu_check_period,
}; };
static struct attribute *intel_pmu_attrs[];
static __initconst const struct x86_pmu intel_pmu = { static __initconst const struct x86_pmu intel_pmu = {
.name = "Intel", .name = "Intel",
.handle_irq = intel_pmu_handle_irq, .handle_irq = intel_pmu_handle_irq,
...@@ -3806,8 +3804,6 @@ static __initconst const struct x86_pmu intel_pmu = { ...@@ -3806,8 +3804,6 @@ static __initconst const struct x86_pmu intel_pmu = {
.format_attrs = intel_arch3_formats_attr, .format_attrs = intel_arch3_formats_attr,
.events_sysfs_show = intel_event_sysfs_show, .events_sysfs_show = intel_event_sysfs_show,
.attrs = intel_pmu_attrs,
.cpu_prepare = intel_pmu_cpu_prepare, .cpu_prepare = intel_pmu_cpu_prepare,
.cpu_starting = intel_pmu_cpu_starting, .cpu_starting = intel_pmu_cpu_starting,
.cpu_dying = intel_pmu_cpu_dying, .cpu_dying = intel_pmu_cpu_dying,
...@@ -4229,6 +4225,10 @@ static struct attribute_group group_format_extra_skl = { ...@@ -4229,6 +4225,10 @@ static struct attribute_group group_format_extra_skl = {
.is_visible = exra_is_visible, .is_visible = exra_is_visible,
}; };
static struct attribute_group group_default = {
.attrs = intel_pmu_attrs,
};
static const struct attribute_group *attr_update[] = { static const struct attribute_group *attr_update[] = {
&group_events_td, &group_events_td,
&group_events_mem, &group_events_mem,
...@@ -4237,6 +4237,7 @@ static const struct attribute_group *attr_update[] = { ...@@ -4237,6 +4237,7 @@ static const struct attribute_group *attr_update[] = {
&group_caps_lbr, &group_caps_lbr,
&group_format_extra, &group_format_extra,
&group_format_extra_skl, &group_format_extra_skl,
&group_default,
NULL, NULL,
}; };
......
...@@ -621,7 +621,6 @@ struct x86_pmu { ...@@ -621,7 +621,6 @@ struct x86_pmu {
const struct attribute_group **attr_update; const struct attribute_group **attr_update;
unsigned long attr_freeze_on_smi; unsigned long attr_freeze_on_smi;
struct attribute **attrs;
/* /*
* CPU Hotplug hooks * CPU Hotplug hooks
...@@ -886,8 +885,6 @@ static inline void set_linear_ip(struct pt_regs *regs, unsigned long ip) ...@@ -886,8 +885,6 @@ static inline void set_linear_ip(struct pt_regs *regs, unsigned long ip)
ssize_t x86_event_sysfs_show(char *page, u64 config, u64 event); ssize_t x86_event_sysfs_show(char *page, u64 config, u64 event);
ssize_t intel_event_sysfs_show(char *page, u64 config); ssize_t intel_event_sysfs_show(char *page, u64 config);
struct attribute **merge_attr(struct attribute **a, struct attribute **b);
ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr, ssize_t events_sysfs_show(struct device *dev, struct device_attribute *attr,
char *page); char *page);
ssize_t events_ht_sysfs_show(struct device *dev, struct device_attribute *attr, ssize_t events_ht_sysfs_show(struct device *dev, struct device_attribute *attr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册