From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 21 14:31:07 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A8BD116A4CE for ; Sun, 21 Dec 2003 14:31:07 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1961643D5E for ; Sun, 21 Dec 2003 14:31:04 -0800 (PST) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id hBLMV3iw028908; Sun, 21 Dec 2003 17:31:03 -0500 (EST) Date: Sun, 21 Dec 2003 17:31:03 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Alfred Perlstein In-Reply-To: <20031221203311.GW60229@elvis.mu.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: hackers@freebsd.org Subject: Re: support for __thread X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Dec 2003 22:31:07 -0000 On Sun, 21 Dec 2003, Alfred Perlstein wrote: > * Daniel Eischen [031221 12:08] wrote: > > On Sun, 21 Dec 2003, Alfred Perlstein wrote: > > > > > * Alfred Perlstein [031221 02:47] wrote: > > > > How do I get __thread to work for me? > > > > > > > > http://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html > > > > > > > > it seems the assembler chokes on it? > > > > We don't have support for it yet. Why do you want it? > > .) it'd be nice to have it for future work > .) linux seems to have it, so does MS libkse is ready to add support for it but I believe there's some additional work to be done in rtld-elf first. > but mostly: > > I'm porting webstone to use threads, and it uses that construct > for the win32 threaded portion, it'd be really nice if we supported > it so that I could make use of it instead of changing hundreds of > lines of code. I would discourage using __thread and instead make the API better so it's not needed. My fear is that once we have it, it'll be abused in all sorts of ways. I can understand needing it for something like nvidia's OpenGL where you have an existing API layered over their drivers and they need to get thread-local-storage very often (tight loops). > Any idea of how much effort it would take? I have no clue as to > how to fix our toolchain, gooing the work in ld.so doesn't see > that awful, but it's not trivial either: > > http://people.freebsd.org/~alfred/tls.pdf Yes, we've been over that in either -current or -threads; I forget which. I think libkse already obeys the tls spec WRT %gs; we just need some hooks/coordination into/with rtld. > I want a threaded webstone so that I can generate a lot more load > with wimpier client boxes on FreeBSD. > > Right now doing hundreds of connections nearly kills my desktop, > but when threaded it barely hiccups. There is always pthread_[gs]pecific which is what normally should be used. > Also, in re: thread things: > http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/60477 > :( There were some thoughts on restructuring our name lookups so that they would be thread-safe. I would rather see that than littering __thread around libc. -- Dan Eischen