From owner-freebsd-arch Wed Jan 2 16:34:36 2002 Delivered-To: freebsd-arch@freebsd.org Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by hub.freebsd.org (Postfix) with ESMTP id A6A7D37B41B; Wed, 2 Jan 2002 16:34:32 -0800 (PST) Received: (from uucp@localhost) by srv1.cosmo-project.de (8.11.6/8.11.6) with UUCP id g030YHc06069; Thu, 3 Jan 2002 01:34:17 +0100 (CET) (envelope-from ticso@cicely9.cicely.de) Received: from mail.cicely.de (cicely20.cicely.de [10.1.1.22]) by cicely5.cicely.de (8.12.1/8.12.1) with ESMTP id g030WGtx046285; Thu, 3 Jan 2002 01:32:16 +0100 (CET)?g (envelope-from ticso@cicely9.cicely.de) Received: from cicely9.cicely.de (cicely9.cicely.de [10.1.7.11]) by mail.cicely.de (8.11.0/8.11.0) with ESMTP id g030WFW12917; Thu, 3 Jan 2002 01:32:15 +0100 (CET) Received: (from ticso@localhost) by cicely9.cicely.de (8.11.6/8.11.6) id g030WFG62289; Thu, 3 Jan 2002 01:32:15 +0100 (CET) (envelope-from ticso) Date: Thu, 3 Jan 2002 01:32:15 +0100 From: Bernd Walter To: Matthew Dillon Cc: John Baldwin , arch@FreeBSD.ORG, Bernd Walter , Mike Smith , Bruce Evans , Michal Mertl , Peter Jeremy Subject: Re: When to use atomic_ functions? (was: 64 bit counters) Message-ID: <20020103003214.GC53199@cicely9.cicely.de> References: <200201030002.g0302Eo60575@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200201030002.g0302Eo60575@apollo.backplane.com> User-Agent: Mutt/1.3.24i X-Operating-System: FreeBSD cicely9.cicely.de 5.0-CURRENT alpha Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Jan 02, 2002 at 04:02:14PM -0800, Matthew Dillon wrote: > :Look at PCPU_GET/PCPU_SET. Note that since an interrupt can preempt you and > :push you off onto another CPU, you have to use a critical section while > :updating per-CPU variables. If desired, some kind of free area could be stuck > :in struct pcpu (or more likely, struct pcpu would hold a pointer to the area) > :that could be galloc/gfree'd or some such. > : > :-- > : > :John Baldwin <>< http://www.FreeBSD.org/~jhb/ > :"Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ > > Maybe we are going about this all wrong. If a particular interface > counter can only be modified from the device interrupt, or only be > modified while holding the appropriate mutex, do we need any locking > at all? You need to hold the mutex while writing and reading. If you hold the mutex only while writing another CPU might still use old cached values. The same goes for device interrrupt as it doesn't enshure inter CPU consistency. -- B.Walter COSMO-Project http://www.cosmo-project.de ticso@cicely.de Usergroup info@cosmo-project.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message