Re: [RFC][PATCH 2/6] perf, arch: Rework perf_event_index()

From: Peter Zijlstra
Date: Tue Nov 22 2011 - 06:26:46 EST


On Mon, 2011-11-21 at 22:43 +0000, Will Deacon wrote:
> On Mon, Nov 21, 2011 at 08:35:55PM +0000, Peter Zijlstra wrote:
> > On Mon, 2011-11-21 at 20:31 +0000, Will Deacon wrote:
> > > On Mon, Nov 21, 2011 at 07:18:10PM +0000, Peter Zijlstra wrote:
> > > > But does ARM have a read PMU counter from userspace
> > > > instruction/capability?
> > >
> > > In ARMv7, you can enable user access to the performance counters but the
> > > access is R/W so I don't think it's something we want to do (could interfere
> > > with another task doing system-wide profiling).
> >
> > Yeah, write access is pushing it a bit..
>
> Perhaps we could disable it while per-cpu events are running, although I
> think this will probably just lead to SIGILL central for anybody trying to
> use the counters in userspace.

One possibility would be to do as I did in patch 4, except ARM has it
disabled by default and the folks who think they know WTF they're doing
can enable it or so.

Ostrikov mentioned on #kernelnewbies he wanted to have this enabled
because apparently games use it. He mentioned toggling the user access
on/off depending on if the kernel was using perf or not, but that would
create very unreliable service.

Best would be to use perf to program the thing and use the userspace
read and simply agree not to write to these registers (and pray people
don't)..

Also, for those ARMs that do have a user readable clock, you could
support the new time_{mult,shift,offset} from patch 5.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/