From owner-freebsd-threads@FreeBSD.ORG Fri Apr 2 11:40:15 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 1B7F016A4CF; Fri, 2 Apr 2004 11:40:15 -0800 (PST) Received: from pimout3-ext.prodigy.net (pimout3-ext.prodigy.net [207.115.63.102]) by mx1.FreeBSD.org (Postfix) with ESMTP id B63DD43D45; Fri, 2 Apr 2004 11:40:14 -0800 (PST) (envelope-from julian@elischer.org) Received: from elischer.org (adsl-216-100-132-94.dsl.snfc21.pacbell.net [216.100.132.94])i32JeC1Y249496; Fri, 2 Apr 2004 14:40:12 -0500 Message-ID: <406DC12E.5060404@elischer.org> Date: Fri, 02 Apr 2004 11:38:22 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4b) Gecko/20030524 X-Accept-Language: en, hu MIME-Version: 1.0 To: Doug Rabson , Daniel Eischen , threads@freebsd.org, Peter Wemm , Marcel Moolenaar References: <200404021443.i32EhAP9009274@repoman.freebsd.org> <1080926920.4652.1.camel@builder02.qubesoft.com> <406DB178.2000205@elischer.org> <200404021957.02922.dfr@nlsystems.com> In-Reply-To: <200404021957.02922.dfr@nlsystems.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: PERFORCE change 50188 for review 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: Fri, 02 Apr 2004 19:40:15 -0000 Doug Rabson wrote: > On Friday 02 April 2004 19:31, Julian Elischer wrote: > >>Doug Rabson wrote: >> >>>On Fri, 2004-04-02 at 17:47, Julian Elischer wrote: >>> >>>>And the crowd goes wild... >>> >>>I'm not convinced that rtld is quite right yet. In particular, >>>stuff like: >>> int __thread x[10]; >>> &x[5]; >>> >>>is probably broken. >>> >>>FWIW, our binutils doen't support the Sun abi at all... >> >>hmmm I wonder if it's planned or if we have to do it.. > > > Personally, I don't see the point. The GNU abi is smaller and faster and > will be better maintained by the gnu people over time. There isn't any > choice for any of the other platforms, including amd64 (which uses a > gnu-style abi with %fs:0 == %fs). So we are screwed for amd64 basically. But the reason the sun ABI axists is because on a PC using %gs as a segment register for thread identification, you cannot use the GNU model unless you are using 1:1 threads. You need to be able to change the place the pointer points from userland. Obviously this requires a syscall as changing a [gl]dt entry can not be done by a user process. This means that every context switch would require a syscall which defeats the entire point of using M:N threads. The SUN API allows the destination of the %gs:0 to be changes at runtime by the user this allowing the UTS to switch threads "on the fly" without going back to the kernel. Processors that have a "thread pointer" register are ok because the UTS can just change it whenever it switches threads. Unfortunatly the X86 requires that we use a priviledged operation. The only thing I can see as a possibility is if we make a special trap into the kernel (bypassing all the normal syscall code) that takes a single register as an argument and puts it into the segment register descriptor pointed to by %gs after checking it VERY quickly, and returns.. it may be possible to get in and out of the kernel quick enough that we don't lose performance. -- +------------------------------------+ ______ _ __ | __--_|\ Julian Elischer | \ U \/ / hard at work in | / \ julian@elischer.org +------>x USA \ a very strange | ( OZ ) \___ ___ | country ! +- X_.---._/ presently in San Francisco \_/ \\ v