Re: [RFC][PATCH 05/11] perf: register pmu implementations

Frederic Weisbecker
2010-06-28T15:29:18Z

On Mon, Jun 28, 2010 at 05:16:37PM +0200, Peter Zijlstra wrote:
> > > }
> > > + srcu_read_unlock(&pmus_srcu, idx);
> > >
> > > return pmu;
> > > }
> >
> >
> >
> > I'm still not sure why all this locking is needed. We don't even
> > support pmus in modules.
> >
> > Is there something coming soon that will use this?
> > I remember something about KVM.
>
> Possibly, not sure. We could put the unregister thing in a later patch,
> but I wanted to make sure it was sanely possibly and its only a few
> lines of code.

Ok.

> > And who will have to use srcu? It seems the event fastpath would
> > be concerned, right? Will that have an impact on the performances?
>
> Only event creation like above (perf_init_event) will have to use SRCU,
> so not really a hot path.

Ah I see. The event itself is synchronized against the fast-path using rcu.
And then pmus themselves would be synchronized against events. Right
that makes sense.

But then why RCU (or SRCU, whatever)? I mean parent event creation is
quite rare. And child events won't need to be synchronized as far as the parent
keeps a reference to the pmu.