From owner-freebsd-hackers Wed Aug 7 9:23: 9 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 E7E0D37B400; Wed, 7 Aug 2002 09:23:06 -0700 (PDT) Received: from mail.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6536A43E4A; Wed, 7 Aug 2002 09:23:06 -0700 (PDT) (envelope-from eischen@mail.pcnet.com) Received: (from eischen@localhost) by mail.pcnet.com (8.12.3/8.12.1) id g77GN5K0002117; Wed, 7 Aug 2002 12:23:05 -0400 (EDT) Date: Wed, 7 Aug 2002 12:23:05 -0400 (EDT) From: Daniel Eischen Message-Id: <200208071623.g77GN5K0002117@mail.pcnet.com> To: hackers@freebsd.org, jdp@polstra.com Cc: deischen@freebsd.org, mb@imp.ch Subject: Re: Help needed. Deadlock in rtld makes openoffice build hang ag 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 > > Why there is suddenly another thread ? 0x8081c00 has changed > > to 0x804f000 ... > > > _thread_run->sig_defer_count stays forever 1 .... > > Hopefully, Daniel will be able to explain this. It must have got interrupted while in a critical section. Something may have grabbed a spinlock that the thread needs inside a critical section. Spinlocks are bad, and we have critical sections to prevent this from happening. Every spinlock and spinunlock should be protected by being contained in a critical region. For the most part, you could argue that we don't need spinlocks if we have critical regions (in the single process/single KSE libc_r anyways). But there are consumers that use spinlocks without being in a critical region (malloc is one that I know about). With spinlocks, we don't know which thread owns the lock when it is contested, so we can't switch to the right thread in order to let it finish the lock protected region. Everything should be using mutexes outside of libc_r itself. I'm not sure of the reasoning behind the use of the spinlock in malloc() (it predates me), but I've often wanted to change it to use a mutex. [ Critical regions aren't exported outside of libc_r, which is why they aren't useable elsewhere. ] -- Dan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message