From owner-freebsd-current@FreeBSD.ORG Tue Aug 3 15:43:11 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E09916A4CE for ; Tue, 3 Aug 2004 15:43:11 +0000 (GMT) Received: from mail.qubesoft.com (gate.qubesoft.com [217.169.36.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id BC1E743D58 for ; Tue, 3 Aug 2004 15:43:10 +0000 (GMT) (envelope-from dfr@nlsystems.com) Received: from bluebottle.qubesoft.com (bluebottle.qubesoft.com [192.168.1.2]) by mail.qubesoft.com (8.12.9/8.12.9) with ESMTP id i73Fh9GR094134 for ; Tue, 3 Aug 2004 16:43:09 +0100 (BST) (envelope-from dfr@nlsystems.com) Received: from builder02.qubesoft.com (builder02.qubesoft.com [192.168.1.8]) i73Fh9ON094975 for ; Tue, 3 Aug 2004 16:43:09 +0100 (BST) (envelope-from dfr@nlsystems.com) From: Doug Rabson To: freebsd-current@freebsd.org Content-Type: text/plain Message-Id: <1091547788.1988.35.camel@builder02.qubesoft.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 03 Aug 2004 16:43:09 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV version 'clamd / ClamAV version 0.65', clamav-milter version '0.60p' Subject: [Fwd: Re: cvs commit: src/libexec/rtld-elf map_object.c rtld.c rtld.h rtld_tls.h src/libexec/rtld-elf/alpha reloc.c rtld_machdep.h src/libexec/rtld-elf/i386 reloc.c rtld_machdep.h ...] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2004 15:43:11 -0000 For anyone who is interested that hasn't seen the commit mail... -----Forwarded Message----- From: Doug Rabson To: Doug Rabson Cc: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/libexec/rtld-elf map_object.c rtld.c rtld.h rtld_tls.h src/libexec/rtld-elf/alpha reloc.c rtld_machdep.h src/libexec/rtld-elf/amd64 reloc.c rtld_machdep.h src/libexec/rtld-elf/i386 reloc.c rtld_machdep.h ... Date: Tue, 03 Aug 2004 14:24:11 +0100 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.