Return-Path: Received: from villa.puc.rediris.es (unknown [IPv6:2001:720:418:ca00::7]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CD55F2C0098 for ; Sat, 22 Sep 2012 21:28:40 +1000 (EST) Date: Sat, 22 Sep 2012 12:21:51 +0200 From: Gabriel Paubert To: malc Subject: Re: Probing for native availability of isel from userspace Message-ID: <20120922102151.GA31314@visitor2.iram.es> References: <50EE7AAC-3080-4B1B-B741-E3F7F5A57A73@kernel.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: Cc: linuxppc-dev@lists.ozlabs.org, hollis@penguinppc.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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