[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190614123435.GM3436@hirez.programming.kicks-ass.net>
Date: Fri, 14 Jun 2019 14:34:35 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] perf/x86/intel: Use is_visible callback for default group
On Fri, Jun 14, 2019 at 12:20:17PM +0200, Jiri Olsa wrote:
> On Fri, May 24, 2019 at 03:21:52PM +0200, Jiri Olsa wrote:
>
> SNIP
>
> ping
Well, it looks about right; but last time you asked if someone could
test, and I've no idea. I don't think I have any testboxes that are
affected by this stuff.
I can just merge it I suppose, we'll see if anybody complains :-)
> > ---
> > It's preffered to use group's is_visible callback, so
> > we do not need to use condition attribute assignment.
> >
> > Cc: Stephane Eranian <eranian@...gle.com>
> > Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > Suggested-by: Peter Zijlstra <peterz@...radead.org>
> > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > ---
> > arch/x86/events/intel/core.c | 15 ++++++++++++---
> > 1 file changed, 12 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
> > index 85afe7e98c7d..cfd61b71136d 100644
> > --- a/arch/x86/events/intel/core.c
> > +++ b/arch/x86/events/intel/core.c
> > @@ -4386,7 +4386,7 @@ static DEVICE_ATTR(allow_tsx_force_abort, 0644,
> >
> > static struct attribute *intel_pmu_attrs[] = {
> > &dev_attr_freeze_on_smi.attr,
> > - NULL, /* &dev_attr_allow_tsx_force_abort.attr.attr */
> > + &dev_attr_allow_tsx_force_abort.attr,
> > NULL,
> > };
> >
> > @@ -4414,6 +4414,15 @@ exra_is_visible(struct kobject *kobj, struct attribute *attr, int i)
> > 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 = {
> > .name = "events",
> > };
> > @@ -4450,7 +4459,8 @@ static struct attribute_group group_format_extra_skl = {
> > };
> >
> > 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[] = {
> > @@ -4973,7 +4983,6 @@ __init int intel_pmu_init(void)
> > x86_pmu.get_event_constraints = tfa_get_event_constraints;
> > x86_pmu.enable_all = intel_tfa_pmu_enable_all;
> > x86_pmu.commit_scheduling = intel_tfa_commit_scheduling;
> > - intel_pmu_attrs[1] = &dev_attr_allow_tsx_force_abort.attr;
> > }
> >
> > pr_cont("Skylake events, ");
> > --
> > 2.20.1
> >
Powered by blists - more mailing lists