From owner-freebsd-hackers Wed Aug 7 10:53:16 2002 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 992CC37B400 for ; Wed, 7 Aug 2002 10:53:13 -0700 (PDT) Received: from wall.polstra.com (wall-gw.polstra.com [206.213.73.130]) by mx1.FreeBSD.org (Postfix) with ESMTP id B070443E84 for ; Wed, 7 Aug 2002 10:53:12 -0700 (PDT) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.11.3/8.11.3) with ESMTP id g77Hr6f13401; Wed, 7 Aug 2002 10:53:06 -0700 (PDT) (envelope-from jdp@vashon.polstra.com) Received: (from jdp@localhost) by vashon.polstra.com (8.12.4/8.12.4/Submit) id g77Hr6Fs058407; Wed, 7 Aug 2002 10:53:06 -0700 (PDT) (envelope-from jdp) Date: Wed, 7 Aug 2002 10:53:06 -0700 (PDT) Message-Id: <200208071753.g77Hr6Fs058407@vashon.polstra.com> To: hackers@freebsd.org From: John Polstra Cc: eischen@pcnet1.pcnet.com Subject: Re: Help needed. Deadlock in rtld makes openoffice build hang ag In-Reply-To: <200208071636.g77GavpD003986@mail.pcnet.com> References: <200208071636.g77GavpD003986@mail.pcnet.com> Organization: Polstra & Co., Seattle, WA Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In article <200208071636.g77GavpD003986@mail.pcnet.com>, Daniel Eischen wrote: > > I agree completely about spinlocks vs. mutexes, in principle. But ... > > the reason the rtld uses its own spinlock implementation is because > > it cannot assume that the threads package is libc_r. It could be > > linuxthreads or some completely unknown threads package. I don't > > like the current solution in the rtld, but it's hard to come up with > > something that works with arbitrary threads packages. > > As long as all threads packages that we want to support have > pthread_mutex_lock/pthread_mutex_unlock, then you can just > use a weak reference to them (and pthread_mutex_init I guess > too) and use them when present. I tried something like that once, but I ran into a problem. When the rtld calls one of the application's locking functions, that function might reference a symbol which needs lazy binding. That results in a call back into the rtld, and the rtld locks against itself. I guess it's worthwhile revisiting that approach and trying harder to make it work. Ideally I'd just like to eliminate the need for locking at all when resolving symbols in the rtld. I think that's possible, but don't look for it any time real soon. John -- John Polstra John D. Polstra & Co., Inc. Seattle, Washington USA "Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message