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

Intel: perf/core: Add attr_groups_update into struct pmu

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

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

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

Adding attr_update attribute group into pmu, to allow
having multiple attribute groups for same group name.

This will allow us to update "events" or "format"
directories with attributes that depend on various
HW conditions.

For example having group_format_extra group that updates
"format" directory only if pmu version is 2 and higher:

  static umode_t
  exra_is_visible(struct kobject *kobj, struct attribute *attr, int i)
  {
         return x86_pmu.version >= 2 ? attr->mode : 0;
  }

  static struct attribute_group group_format_extra = {
         .name       = "format",
         .is_visible = exra_is_visible,
  };
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-3-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>
上级 8cc951e1
...@@ -255,6 +255,7 @@ struct pmu { ...@@ -255,6 +255,7 @@ struct pmu {
struct module *module; struct module *module;
struct device *dev; struct device *dev;
const struct attribute_group **attr_groups; const struct attribute_group **attr_groups;
const struct attribute_group **attr_update;
const char *name; const char *name;
int type; int type;
......
...@@ -9691,6 +9691,12 @@ static int pmu_dev_alloc(struct pmu *pmu) ...@@ -9691,6 +9691,12 @@ static int pmu_dev_alloc(struct pmu *pmu)
if (ret) if (ret)
goto del_dev; goto del_dev;
if (pmu->attr_update)
ret = sysfs_update_groups(&pmu->dev->kobj, pmu->attr_update);
if (ret)
goto del_dev;
out: out:
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册