lkml.org 
[lkml]   [2020]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/2] perf x86: Infrastructure for exposing an Uncore unit to PMON mapping
On Tue, Jan 14, 2020 at 02:39:58PM +0100, Jiri Olsa wrote:
> On Tue, Jan 14, 2020 at 04:24:34PM +0300, Sudarikov, Roman wrote:
>
> SNIP
>
> > > > {
> > > > struct intel_uncore_pmu *pmus;
> > > > @@ -950,10 +976,19 @@ static int __init uncore_type_init(struct intel_uncore_type *type, bool setid)
> > > > attr_group->attrs[j] = &type->event_descs[j].attr.attr;
> > > > type->events_group = &attr_group->group;
> > > > - }
> > > > + } else
> > > > + type->events_group = &empty_group;
> > > Why???
> > Hi Greg,
> >
> > Technically, what I'm trying to do is to add an attribute which depends on
> > the uncore pmu type and BIOS support. New attribute is added to the end of
> > the attribute groups array. It appears that the events attribute group is
> > optional for most of the uncore pmus for x86/intel, i.e. events_group =
> > NULL.
> >
> > NULL element in the middle of the attribute groups array "hides" all others
> > attribute groups which follows that element.
> >
> > To work around it, embedded NULL elements should be either removed from
> > the attribute groups array [1] or replaced with empty attribute; see
> > implementation above.
> >
> > If both approaches are incorrect then please advice what would be correct
> > solution for that case.
>
> hi,
> I think Greg is reffering to the recent cleanup where we used attribute
> groups with is_vissible callbacks, you can check changes below:
>
> b7c9b3927337 perf/x86/intel: Use ->is_visible callback for default group
> 6a9f4efe78af perf/x86: Use update attribute groups for default attributes
> b657688069a2 perf/x86/intel: Use update attributes for skylake format
> 3ea40ac77261 perf/x86: Use update attribute groups for extra format
> 1f157286829c perf/x86: Use update attribute groups for caps
> baa0c83363c7 perf/x86: Use the new pmu::update_attrs attribute group

Yes, that is the case.

Don't abuse things like trying to stick NULL elements in the middle of
an attribute group, that's horrid. Use the apis that we have build
especially for this type of thing, that is what it is there for and will
keep things _MUCH_ simpler over time.

thanks,

greg k-h

\
 
 \ /
  Last update: 2020-01-14 15:05    [W:0.038 / U:12.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site