From owner-freebsd-arch@FreeBSD.ORG Fri May 25 00:27:03 2007 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 299B816A468; Fri, 25 May 2007 00:27:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx02.syd.optusnet.com.au (fallbackmx02.syd.optusnet.com.au [211.29.133.72]) by mx1.freebsd.org (Postfix) with ESMTP id B304313C45D; Fri, 25 May 2007 00:27:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by fallbackmx02.syd.optusnet.com.au (8.12.11.20060308/8.12.11) with ESMTP id l4OBR3nr010586; Thu, 24 May 2007 21:27:03 +1000 Received: from besplex.bde.org (c211-30-216-190.carlnfd3.nsw.optusnet.com.au [211.30.216.190]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id l4OBQurY010787 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 May 2007 21:27:01 +1000 Date: Thu, 24 May 2007 21:26:57 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: <4655C67A.9060000@FreeBSD.org> Message-ID: <20070524210030.J36089@besplex.bde.org> References: <20070520155103.K632@10.0.0.1> <20070521113648.F86217@besplex.bde.org> <20070520213132.K632@10.0.0.1> <4651CAB8.8070007@FreeBSD.org> <4651CE2F.8080908@FreeBSD.org> <20070521022847.D679@10.0.0.1> <20070521195811.G56785@delplex.bde.org> <4651FCB5.7070604@FreeBSD.org> <20070521225032.C57233@delplex.bde.org> <20070522162819.N5249@besplex.bde.org> <20070522201336.C87981@besplex.bde.org> <46533CAD.8030104@FreeBSD.org> <4655C67A.9060000@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: alc@freebsd.org, arch@freebsd.org, Jeff Roberson Subject: Re: sched_lock && thread_lock() X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2007 00:27:03 -0000 On Thu, 24 May 2007, Attilio Rao wrote: > Hello, > Let me know if this patch is right for you and if you have feedbacks, > comments, etc: > http://users.gufi.org/~rookie/works/patches/schedlock/vmmeter3.diff > > This should fix translation errors Bruce has found and switching the _SET() > method in order to being a simple assignment (as Bruce has suggested). OK. Note that I won't be really happy until the macros and volatiles go away. But keep at least the macros for development. The volatiles are easier to remove: put them in the access macros instead of putting them in the declarations and cancelling them in the access macros where they are most needed. This would leave them broken in the access macros where they are most needed, the same as now (since the sysctl macros just don't support volatile, they must be cancelled now and cannot be added). Note that we use this method for almost all "volatile" variables in the kernel -- we don't declare quite enough things volatile, but we add volatiles in the atomic function calls and depend on a combination of atomic accesses and locking to avoid races. It is easy to get this wrong, but if we get it wrong then declaring things volatile only reduces the races. I forgot to mention another easy-to-fix bug: missing parentheses around the `val' arg in macro definitions. Bruce