Probing for native availability of isel from userspace

Gabriel Paubert paubert at iram.es
Sat Sep 22 20:21:51 EST 2012


On Sat, Sep 22, 2012 at 02:12:42PM +0400, malc wrote:
> On Sat, 22 Sep 2012, Segher Boessenkool wrote:
> 
> > > Is it possible to determine if _native_ isel is available from userspace
> > > somehow?
> > 
> > Just try to execute one and catch the SIGILL?
> > 
> 
> Unfortunately my kernel emulates ISEL for me in this case, so i don't
> get any SIGILLs.

Perform a few isels in a loop between a couple of mftb and measure the 
shortest time it takes. Any emulation will take tens of timebase ticks,
hardware implementation will return very small values, perhaps even
0 depending on the relationship between core and timebase frequencies.

I don't remember whether it's necessary inserting an isync between the
two mftb. I believe that even on the most OOO machines, two mftb in
a row will not be reordered to the point that the second executes before 
the first.

	Gabriel


More information about the Linuxppc-dev mailing list