From owner-cvs-src@FreeBSD.ORG Tue Aug 3 13:47:25 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 06EE516A4CE; Tue, 3 Aug 2004 13:47:25 +0000 (GMT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 90B9243D1D; Tue, 3 Aug 2004 13:47:24 +0000 (GMT) (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 i73DlN3w009826; Tue, 3 Aug 2004 09:47:23 -0400 (EDT) Date: Tue, 3 Aug 2004 09:47:23 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Doug Rabson In-Reply-To: <1091539451.1988.27.camel@builder02.qubesoft.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: Doug Rabson cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/libexec/rtld-elf map_object.c rtld.c rtld.h src/libexec/rtld-elf/amd64... X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2004 13:47:25 -0000 On Tue, 3 Aug 2004, Doug Rabson wrote: > On Tue, 2004-08-03 at 09:51, Doug Rabson wrote: > > dfr 2004-08-03 08:51:00 UTC > > > > FreeBSD src repository > > > > Modified files: > > libexec/rtld-elf map_object.c rtld.c rtld.h > > libexec/rtld-elf/alpha reloc.c rtld_machdep.h > > libexec/rtld-elf/amd64 reloc.c rtld_machdep.h > > libexec/rtld-elf/i386 reloc.c rtld_machdep.h > > libexec/rtld-elf/ia64 reloc.c rtld_machdep.h > > libexec/rtld-elf/sparc64 reloc.c rtld_machdep.h > > Added files: > > libexec/rtld-elf rtld_tls.h > > Log: > > Add support for Thread Local Storage. > > Thread Local Storage is a gcc feature which allows you to add a > '__thread' modifier to the declaration of global and static variables. > This extra modifier means that the variable's value is 'thread local', > i.e. one thread changing its value will not affect any other thread. In > lots of ways its similar to the per-cpu variables we use in the kernel. > > Most of the support is in the dynamic linker which discovers the TLS > blocks in each shared libary and allocates memory for them. It provides > hooks for threading libraries to allocate and initialise TLS blocks for > each new thread and hooks which the compiler uses to resolve the address > of a TLS variable. > > The main user for this right now is the OpenGL api. In OpenGL, each > thread has a GL context object associated with it. Each call to a GL > function implicitly references this context object. For single-threaded > OpenGL, the context can be found by e.g. a global variable but for > thread-safe OpenGL, the most efficient mechanism is to use TLS. This is > how the NVidia OpenGL driver supports threading and the open source > OpenGL drivers will use TLS in the future as well. > > As far as FreeBSD goes, there is nothing in the system right now that > uses TLS. Its possible that we might use TLS for 'errno' and similar > things in the 6.0 timeframe. And well-designed APIs shouldn't need TLS, so don't abuse it ;-) It is most useful for existing APIs that can't be made thread-safe and where speed is important. -- Dan Eischen