From owner-freebsd-threads@FreeBSD.ORG Sat Nov 15 09:36:44 2003 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 9D7AA16A4CF; Sat, 15 Nov 2003 09:36:44 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id C67F543FCB; Sat, 15 Nov 2003 09:36:43 -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 hAFHag1G008138; Sat, 15 Nov 2003 12:36:43 -0500 (EST) Date: Sat, 15 Nov 2003 12:36:42 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Marcel Moolenaar In-Reply-To: <20031115031906.GA52831@dhcp01.pn.xcllnt.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: kan@freebsd.org cc: threads@freebsd.org cc: davidxu@freebsd.org Subject: Re: KSE/ia64 broken X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Nov 2003 17:36:44 -0000 On Fri, 14 Nov 2003, Marcel Moolenaar wrote: > Gang, > > The following change broke KSE on ia64: > > -------- > revision 1.18 > date: 2003/11/08 06:07:04; author: davidxu; state: Exp; lines: +16 -17 > Use THR lock instead of KSE lock to avoid scheduler be blocked in spinlock. > > Reviewed by: deischen > -------- > > We seem to be clobbering the thread structure instead of writing > to the mailbox. This happens at initialization. Can it be that > the change assumes PER_KSE and doesxn't work for PER_THREAD? I _think_ this may be because rltd-elf (at least for ia64) calls malloc with the rtld lock held. I'm not sure how to test this theory. The rtld lock uses a KSE lock because it is not always called within the context of a thread. We try to be careful in libpthread to only call malloc()/free() either at initialization (when there are no threads) or within the context of a thread. This allows us to make the malloc lock (currently a spinlock) a thread-based lock. KSE locks have the disadvantage of blocking the KSE from running any other threads. So moving spinlocks to thread locks improves performance. -- Dan Eischen