[mips-tls] A couple of potential changes to the MIPS TLS ABI
Daniel Jacobowitz
dan at codesourcery.com
Wed Feb 9 18:52:35 UTC 2005
On Wed, Feb 09, 2005 at 06:32:36PM +0000, Maciej W. Rozycki wrote:
> On Wed, 9 Feb 2005, Daniel Jacobowitz wrote:
>
> > > As part of our own experiments Maciej implemented a "fast path" rdhwr
> > > emulation, which he promises he will post to this list today. It has a
> > > typical emulation time of between 30 and 60 cycles, depending on the
> > > CPU, and assuming a fixed destination register for rdhwr (e.g. only
> > > rdhwr $2,$5). Not too bad, but not brilliant either if thread pointer
> > > access time turns out to be critical to the performance of some
> > > threaded applications.
> >
> > Can you compare this to the normal cost of an emulated instruction?
>
> For the 24Kf processor the cost of doing a normal emulation is about 550%
> of that of my fast path. For the 4Kc one it's 1975%...
>
> > I'm not sure if I've posted the rdhwr emulation patch anywhere; I know
> > Ralf has a copy. I'm not thrilled about hardcoding the target
> > register but if that's what ya gotta do...
>
> You can have a fast path for the dedicated target register and normal
> emulation for the others to keep the semantics consistent. The cost rise
> from doing a computed goto to emulate a write to an arbitrary target
> register is about 25%, i.e. the total cost is about 125% of the original.
For GCC and ABI purposes, this means we might as well define in the TLS
ABI which register has to be used, and we can open it up when we look
back in ten years and everyone has the register :-)
Thanks for the numbers. I think that working with the fast-path
emulation and rdhwr is our best bet at this time. It also has a
substantial locality (i.e. all the code in one place) benefit over
playing with the TLB...
--
Daniel Jacobowitz
CodeSourcery, LLC
More information about the mips-tls
mailing list