mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
perf/x86/intel: Use ->is_visible callback for default group
It's preffered to use group's ->is_visible callback, so we do not need to use condition attribute assignment. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Peter 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: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20190524132152.GB26617@krava Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
ee49532b38
commit
b7c9b39273
1 changed files with 12 additions and 3 deletions
|
@ -4391,7 +4391,7 @@ static DEVICE_ATTR(allow_tsx_force_abort, 0644,
|
||||||
|
|
||||||
static struct attribute *intel_pmu_attrs[] = {
|
static struct attribute *intel_pmu_attrs[] = {
|
||||||
&dev_attr_freeze_on_smi.attr,
|
&dev_attr_freeze_on_smi.attr,
|
||||||
NULL, /* &dev_attr_allow_tsx_force_abort.attr.attr */
|
&dev_attr_allow_tsx_force_abort.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4419,6 +4419,15 @@ exra_is_visible(struct kobject *kobj, struct attribute *attr, int i)
|
||||||
return x86_pmu.version >= 2 ? attr->mode : 0;
|
return x86_pmu.version >= 2 ? attr->mode : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static umode_t
|
||||||
|
default_is_visible(struct kobject *kobj, struct attribute *attr, int i)
|
||||||
|
{
|
||||||
|
if (attr == &dev_attr_allow_tsx_force_abort.attr)
|
||||||
|
return x86_pmu.flags & PMU_FL_TFA ? attr->mode : 0;
|
||||||
|
|
||||||
|
return attr->mode;
|
||||||
|
}
|
||||||
|
|
||||||
static struct attribute_group group_events_td = {
|
static struct attribute_group group_events_td = {
|
||||||
.name = "events",
|
.name = "events",
|
||||||
};
|
};
|
||||||
|
@ -4456,6 +4465,7 @@ static struct attribute_group group_format_extra_skl = {
|
||||||
|
|
||||||
static struct attribute_group group_default = {
|
static struct attribute_group group_default = {
|
||||||
.attrs = intel_pmu_attrs,
|
.attrs = intel_pmu_attrs,
|
||||||
|
.is_visible = default_is_visible,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct attribute_group *attr_update[] = {
|
static const struct attribute_group *attr_update[] = {
|
||||||
|
@ -4979,7 +4989,6 @@ __init int intel_pmu_init(void)
|
||||||
x86_pmu.get_event_constraints = tfa_get_event_constraints;
|
x86_pmu.get_event_constraints = tfa_get_event_constraints;
|
||||||
x86_pmu.enable_all = intel_tfa_pmu_enable_all;
|
x86_pmu.enable_all = intel_tfa_pmu_enable_all;
|
||||||
x86_pmu.commit_scheduling = intel_tfa_commit_scheduling;
|
x86_pmu.commit_scheduling = intel_tfa_commit_scheduling;
|
||||||
intel_pmu_attrs[1] = &dev_attr_allow_tsx_force_abort.attr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_cont("Skylake events, ");
|
pr_cont("Skylake events, ");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue