From owner-freebsd-threads@FreeBSD.ORG Mon Mar 29 13:44:12 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5EB9916A4CE; Mon, 29 Mar 2004 13:44:12 -0800 (PST) Received: from sccrmhc12.comcast.net (sccrmhc12.comcast.net [204.127.202.56]) by mx1.FreeBSD.org (Postfix) with ESMTP id 114C443D45; Mon, 29 Mar 2004 13:44:12 -0800 (PST) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (sccrmhc12) with ESMTP id <2004032921440901200ngklhe>; Mon, 29 Mar 2004 21:44:11 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id NAA30331; Mon, 29 Mar 2004 13:53:03 -0800 (PST) Date: Mon, 29 Mar 2004 13:53:03 -0800 (PST) From: Julian Elischer To: Doug Rabson In-Reply-To: <200403292221.00286.dfr@nlsystems.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org cc: peter@freebsd.org Subject: Re: Thread Local Storage X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Mar 2004 21:44:12 -0000 On Mon, 29 Mar 2004, Doug Rabson wrote: > On Monday 29 March 2004 20:36, Daniel Eischen wrote: > > On Mon, 29 Mar 2004, Doug Rabson wrote: > > > I've been spending a bit of time recently familiarising myself with > > > this TLS stuff and trying out a few things. I've been playing with > > > rtld and I have a prototype patch which implements enough TLS > > > support to let a non-threaded program which uses static TLS work. > > > With a tiny bit more work I can have limited support for dynamic > > > TLS as well (not for dlopen'ed modules yet though). Is there a p4 > > > tree for this stuff yet? I'd like to check in what I have sometime. > > > > > > I've also been looking at libpthread and I can see some potential > > > problems with it. Currently libpthread on i386 uses %gs to point at > > > a struct kcb which seems to be a per-kse structure. This structure > > > contains a pointer to a per-thread struct tcb and this pointer is > > > managed by the userland context switch code. Other arches are > > > similar, e.g. ia64 uses $tp to point at struct kcb. > > > > > > The problem with TLS is that the i386 ABI needs %gs to point at the > > > TLS > > > > There are 2 different methods allowed for the i386 ABI. > > We want to use the other method in which there is an > > additional indirection. The current i386 libpthread > > stuff adheres to this method. > > Surely the GNU TLS ABI is preferable? It generates much smaller code and > needs many fewer relocations. We were working on teh "let's just get it going using the Solaris model which fits now, and then if we can use the GDT version of thread pointers we can possibly sim-lify it later.. the code is 'faster' for he GNU variant but it may not be significant in the performance of the average threaded program.