[llvm] r182603 - ARM: implement @llvm.readcyclecounter intrinsic

Tim Northover t.p.northover at gmail.com
Fri May 24 14:53:05 PDT 2013


> PMUSERENR.EN seems to default to zero on Linux, no? At least my local Ubuntu
> A15 board test says so, and as expected I get SIGILL in user mode.

I believe so. It's very annoying, but I suppose you could see security
implications in the alternative case (it would probably make
timing-based cryptography attacks easier, for example).

> Wouldn't it also useful to have an intrinsic to check for the value? "mrc
> p15, 0, %0, c9, c14, 0"'s bottom bit should do it. Or figure out which OS
> also supports PMUSERENR.EN=1 by default, with an override flag?

I tend to think the issues around using these counters (multiple CPUs,
task switching, ...) are subtle enough that we should rely on the user
to know when it's sensible. There's no magical "I want to time a loop"
predicate we could implement, and I wouldn't want to give the
impression there is.

Tim.



More information about the llvm-commits mailing list