lkml.org 
[lkml]   [2016]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/7] arm64/perf: Basic uncore counter support for Cavium ThunderX
On Mon, Feb 15, 2016 at 02:27:27PM +0000, Mark Rutland wrote:
> > > > + uncore = event_to_thunder_uncore(event);
> > > > + if (!uncore)
> > > > + return -ENODEV;
> > > > + if (!uncore->event_valid(event->attr.config))
> > > > + return -EINVAL;
> > > > +
> > > > + hwc->config = event->attr.config;
> > > > + hwc->idx = -1;
> > > > +
> > > > + /* and we don't care about CPU */
> > >
> > > Actually, you do. You want the perf core to serialize accesses via the
> > > same CPU, so all events _must_ be targetted at the same CPU. Otherwise
> > > there are a tonne of problems you don't even want to think about.
> >
> > I found that perf added the events on every CPU in the system. Because
> > the uncore events are not CPU related I wanted to avoid this. Setting
> > cpumask to -1 did not work. Therefore I added a single CPU in the
> > cpumask, see thunder_uncore_attr_show_cpumask().
>
> I understand that, which is why I wrote:
>
> > > You _must_ ensure this kernel-side, regardless of what the perf tool
> > > happens to do.
> > >
> > > See the arm-cci and arm-ccn drivers for an example.
>
> Take a look at drivers/bus/arm-cci.c; specifically, what we do in
> cci_pmu_event_init and cci_pmu_cpu_notifier.
>
> This is the same thing that's done for x86 system PMUs. Take a look at
> uncore_pmu_event_init in arch/x86/kernel/cpu/perf_event_intel_uncore.c.

I note that we still have an open TODO rather than a call to
perf_pmu_migrate_context.

The better example is arm_ccn_pmu_cpu_notifier in drivers/bus/arm-ccn.c.

Mark.

\
 
 \ /
  Last update: 2016-02-15 16:01    [W:0.071 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site