From owner-freebsd-stable@FreeBSD.ORG Thu May 12 15:42:13 2005 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7DA4D16A4CE; Thu, 12 May 2005 15:42:13 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id E18EE43D68; Thu, 12 May 2005 15:42:12 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j4CFfagd097298; Thu, 12 May 2005 10:41:36 -0500 (CDT) (envelope-from dan) Date: Thu, 12 May 2005 10:41:36 -0500 From: Dan Nelson To: Scott Long Message-ID: <20050512154135.GF2567@dan.emsphone.com> References: <4283565B.6060303@samsco.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4283565B.6060303@samsco.org> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.8i cc: Daniel Eischen cc: Mikhail Teterin cc: re@freebsd.org cc: stable@freebsd.org Subject: Re: PTHREAD_INVARIANTS in 5.x X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2005 15:42:13 -0000 In the last episode (May 12), Scott Long said: > Daniel Eischen wrote: > >On Wed, 11 May 2005, Jonathan Noack wrote: > >>I checked out _PTHREADS_INVARIANTS for libthr and libpthread on CURRENT. > >> As far as I can tell, all but one of the defines under > >>_PTHREADS_INVARIANTS are ASSERTs; they check for a condition and if it > >>is false result in a fatal error. These should be very visible if > >>they are being tripped. Only MUTEX_INIT_LINK actually *does* > >>something. It is defined in src/lib/libpthread/thread/thr_mutex.c > >>at lines 43-46 and in src/lib/libthr/thread/thr_mutex.c at lines > >>44-47: > > > >This is way overblown and they're other areas for much better > >optimizations than worrying about a couple of instructions. Perhaps > >if it were called _PTHREAD_ROBUST instead of _PTHREAD_INVARIANTS, > >noone would notice ;-) > > Yes, the check for the cross-linked threads libraries is still quite > useful. However, we gave a general policy of turning off most other > debugging and invariants tools for production releases. A good > example is the malloc debugging options that are on in HEAD and off > in RELENG_5. Would we be able to reach a compromise similar to that? The malloc flags can cause serious performance issues, though, since they basically force a memory fill before every malloc and after every free. On the other hand, shouldn't there be a better way of detecting cross-linked threads libraries than dieing because some internal mutex isn't initialized? Maybe set __isthreaded to 1, 2, or 3 (or (int)'c_r\0', 'kse\0', 'thr\0', to allow for even more threads libs)? -- Dan Nelson dnelson@allantgroup.com