Re: [RFC] Sharing PMU counters across compatible events

From: Jiri Olsa
Date: Wed Dec 13 2017 - 05:18:17 EST


On Mon, Dec 11, 2017 at 07:34:49AM -0800, Tejun Heo wrote:
> Hello, Jiri.
>
> On Wed, Dec 06, 2017 at 12:42:04PM +0100, Jiri Olsa wrote:
> > I see this rather on the hw level, since it concerns HW counters
> >
> > I think we could detect same (alias) events at the time counters
> > are added/removed on/from the cpu and share their HW part like
> > counter idx, regs and such (struct hw_perf_event_cpu in my changes)
> >
> > this way it'd be completely transparent for generic code
>
> I don't quite follow why doing this in arch code is better than
> generic. Doing this in arch means we'd need to do the same thing
> multiple times for different archs. Why is that better?

so I can see this to be useful for HW conters only, because
of limited number of regs

as for the higher level on which this could be implemented I
see some pitfals with event rotations as Peter mentioned and
task/cpu contexts scheduling.. while the hw-level implementation
seems pretty straight forward

I'll test the code and let's see ;-)

jirka