From owner-freebsd-arch Tue Jan 15 17:22:23 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mail5.speakeasy.net (mail5.speakeasy.net [216.254.0.205]) by hub.freebsd.org (Postfix) with ESMTP id 014FE37B400 for ; Tue, 15 Jan 2002 17:22:21 -0800 (PST) Received: (qmail 18344 invoked from network); 16 Jan 2002 01:22:20 -0000 Received: from unknown (HELO laptop.baldwin.cx) ([64.81.54.73]) (envelope-sender ) by mail5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 16 Jan 2002 01:22:20 -0000 Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20020116120611.A72285@gsmx07.alcatel.com.au> Date: Tue, 15 Jan 2002 17:21:37 -0800 (PST) From: John Baldwin To: Peter Jeremy Subject: Re: 64 bit counters again Cc: arch@FreeBSD.ORG, Thomas Hurst , "James E. Housley" , Bosko Milekic , Michal Mertl , Terry Lambert 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 16-Jan-02 Peter Jeremy wrote: > For the read case, the reader uses something like: > > loop: movl 4(mem),%edx > movl (mem),%eax > cmpl 4(mem),%edx > jnz loop > > If an interrupt updates the MSW then you take another pass around the > loop, otherwise you always read the correct value. > > For the SMP case, you either need to use locks or you need to use > per-CPU counters. (And the per-CPU counters can be read by another > CPU using the above trick). Well, SMP on Pentium's maybe, but not on Alpha, sparc64, or ia64, all of which support OOE and looser memory models than x86, meaning that you really need locks unless you are going to have 386-specific code all over the place. I suppose you can wrap it behind an MI API but that seems like a lot of work for fairly small gain that can end up making the code uglier. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message