Re: [PATCH 2/2] perf_counter: optimize context switch between identical inherited contexts

Peter Zijlstra
2009-05-23T13:07:07Z

On Sat, 2009-05-23 at 14:38 +0200, Ingo Molnar wrote:
> > I'm for all counters you created (ie have a fd for). Being able to
> > disable counters others created on you just sounds wrong.
> >
> > If we can settle on a semantic, I'm sure we can implement it :-)
> >
> > Ingo, Corey, any opinions?
>
> It indeed doesnt sound correct that we can disable counters others
> created on us - especially if they are in a different (higher
> privileged) security context than us.
>
> OTOH, enabling/disabling counters in specific functions of a library
> might be a valid use-case. So perhaps make this an attribute:
> ..transparent or so, with perf stat defaulting on it to be
> transparent (i.e. not child context disable-able).

I'm not sure that's something we want to do. Furthermore, if we do want
it, the current implementation is not sufficient, because, as Paul
noted, we can attach a new counter right after the disable.

I really think such limitations should come from whatever security
policy there is on attaching counters. Eg. using selinux, label gnupg as
non-countable so that you simply cannot attach (incl inherit) counters
to it.

Allowing such hooks into libraries will destroy transparency for
developers and I don't think that's something we'd want to promote.

I'll implement my suggestion so we can take it from there.