From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1810 invoked by alias); 24 Jan 2007 10:43:35 -0000 Received: (qmail 1800 invoked by uid 22791); 24 Jan 2007 10:43:34 -0000 X-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from gra-lx1.iram.es (HELO gra-lx1.iram.es) (150.214.224.41) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 24 Jan 2007 10:43:28 +0000 Received: from localhost (localhost [127.0.0.1]) by gra-lx1.iram.es (Postfix/MJ-1.08) with ESMTP id 7FA441650E9; Wed, 24 Jan 2007 11:43:20 +0100 (CET) Received: from gra-lx1.iram.es ([127.0.0.1]) by localhost (gra-lx1 [127.0.0.1]) (amavisd-new, port 10024) with SMTP id 24693-01; Wed, 24 Jan 2007 11:43:17 +0100 (CET) Received: from gra-vd1.iram.es (gra-vd1.iram.es [150.214.224.250]) by gra-lx1.iram.es (Postfix/MJ-1.08) with ESMTP id 00ED81650E8; Wed, 24 Jan 2007 11:43:16 +0100 (CET) Received: from gra-vd1.iram.es (localhost [127.0.0.1]) by gra-vd1.iram.es (8.13.8/8.13.8/Debian-3) with ESMTP id l0OAhGmV022729; Wed, 24 Jan 2007 11:43:16 +0100 Received: (from paubert@localhost) by gra-vd1.iram.es (8.13.8/8.13.8/Submit) id l0OAhDNa022728; Wed, 24 Jan 2007 11:43:13 +0100 From: Gabriel Paubert Date: Wed, 24 Jan 2007 10:43:00 -0000 To: Paul Mackerras Cc: Mathieu Desnoyers , Andrew Morton , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, "Martin J. Bligh" , Christoph Hellwig , linuxppc-dev@ozlabs.org, Douglas Niehaus , Ingo Molnar , ltt-dev@shafik.org, systemtap@sources.redhat.com, Thomas Gleixner Subject: Re: [PATCH 7/10] local_t : powerpc Message-ID: <20070124104313.GB22579@iram.es> References: <20061221001545.GP28643@Krystal> <20061221002705.GW28643@Krystal> <17847.8700.118329.777644@cargo.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17847.8700.118329.777644@cargo.ozlabs.ibm.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at iram.es Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2007-q1/txt/msg00181.txt.bz2 On Wed, Jan 24, 2007 at 08:08:12PM +1100, Paul Mackerras wrote: > Mathieu Desnoyers writes: > > > +static __inline__ int local_dec_if_positive(local_t *l) > > +{ > > + int t; > > + > > + __asm__ __volatile__( > > +"1: lwarx %0,0,%1 # local_dec_if_positive\n\ > > + addic. %0,%0,-1\n\ > > + blt- 2f\n" > > + PPC405_ERR77(0,%1) > > +" stwcx. %0,0,%1\n\ > > + bne- 1b" > > This has the same bugs that we fixed recently in atomic_dec_if_positive; > first, on 64-bit machines, the lwarx will zero-extend the word loaded > from memory, and so the result of the addic will be negative only if > the word was originally 0. Secondly, even on 32-bit machines, > 0x80000000 will be considered positive since decrementing it gives > 0x7fffffff, which is positive. > > > +/* Use these for per-cpu local_t variables: on some archs they are > > + * much more efficient than these naive implementations. Note they take > > + * a variable, not an address. > > + * > > + * This could be done better if we moved the per cpu data directly > > + * after GS. > > + */ > > What's "GS"? Does this comment really apply on powerpc? > 1) It's an (application visible) i386/x86_64 segment register used to make memory addressing more confusing. 2) Because of 1), obviously not ;-) Gabriel