From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Linas Vepstas Newsgroups: gmane.lisp.guile.devel Subject: Re: Locks and threads Date: Wed, 11 Feb 2009 17:30:28 -0600 Message-ID: <3ae3aa420902111530k671cd331i308915e0efaf75bb@mail.gmail.com> References: <87mycsd2rj.fsf@arudy.ossau.uklinux.net> Reply-To: linasvepstas@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1234395045 18629 80.91.229.12 (11 Feb 2009 23:30:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Feb 2009 23:30:45 +0000 (UTC) Cc: Guile Development To: Neil Jerram Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Feb 12 00:31:59 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LXOYf-0002UH-9z for guile-devel@m.gmane.org; Thu, 12 Feb 2009 00:31:57 +0100 Original-Received: from localhost ([127.0.0.1]:45781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXOXL-0000mg-EN for guile-devel@m.gmane.org; Wed, 11 Feb 2009 18:30:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LXOXH-0000m5-L7 for guile-devel@gnu.org; Wed, 11 Feb 2009 18:30:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LXOXH-0000lq-4x for guile-devel@gnu.org; Wed, 11 Feb 2009 18:30:31 -0500 Original-Received: from [199.232.76.173] (port=44608 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LXOXG-0000lm-St for guile-devel@gnu.org; Wed, 11 Feb 2009 18:30:30 -0500 Original-Received: from yw-out-1718.google.com ([74.125.46.155]:11453) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LXOXG-0002OG-Ip for guile-devel@gnu.org; Wed, 11 Feb 2009 18:30:30 -0500 Original-Received: by yw-out-1718.google.com with SMTP id 6so273458ywa.66 for ; Wed, 11 Feb 2009 15:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=1WVrqTJacSwwZhCzwQ39FLNU/S3J8SoZKbqFl6ZneEU=; b=qurOlxNaqmfaDLy+EZM2DTv2KDF/CqS9JGpQLIf1m68xjc9tP4xj2bXZMQQ0YYGxan 3F+STFzA6iJEVgXnHLCtxZyqQTNSvKSNH1PYzXbS1G9WPlxo2OxfV2ZYIaHDs2/71pFU 8TUMu485boIIB5xitVp+q1X12RwrNkjVNzEtA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; b=OlyCTW/X0ZQYTr+wncium16o6FVORK+Xw0HRt8gnQmf2kW96Rz67tM49vQNynM/Ezp KD1l2VGIqifDm92aISLoQpQ8Xzh2WvV2UDc3Q1MomRHvKK9Z216AGZp67fTW2HQx7iig GCTKAkH5OIctiHMwlCLRu7iAYSSQV+GNqSrYY= Original-Received: by 10.100.108.20 with SMTP id g20mr417112anc.14.1234395028398; Wed, 11 Feb 2009 15:30:28 -0800 (PST) In-Reply-To: <87mycsd2rj.fsf@arudy.ossau.uklinux.net> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:8153 Archived-At: 2009/2/11 Neil Jerram : > I've started working through the lock ordering and threading issues > that we have. My plan is (with 1.8.x) > > - first to address problems reported by helgrind (since I think we > should take advantage of external tools before adding debug code to > Guile internally) > > - then to run Linas's define-race program, and address the problems > that that shows up (including thread-safe define, hopefully) > > - then (or maybe as part of the previous step) to look again at > Linas's lock order debugging patch, to see if it would make sense to > apply some of that. > > Does that sound sensible; have I missed anything? Err, sort of, yes, unless I misunderstand. Guile 1.8 makes a certain basic assumption that is splattered throughout the code; it rather intentionally re-orders the order in which one of the locks is taken. If I remember correctly, its the "in guile mode" lock. So if you just go looking for locks that are released out-of-order, you'll find lots of these. At the time, I had decided that 1) it would be a lot of work to get these in order, and the patch would likely be rejected, and 2) the reordering is essentially harmless (since its consistently done). 3) there might have even been a performance hit (I don't remember) by trying to get these into order. This made using valgrind impossible, and that's why I created the custom patch -- it made a point of ignoring this one reversed-order, while checking for badness in everything else. --linas