This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [PATCH 7/10] local_t : powerpc
- From: Paul Mackerras <paulus at samba dot org>
- To: Mathieu Desnoyers <mathieu dot desnoyers at polymtl dot ca>
- Cc: linux-kernel at vger dot kernel dot org, Andrew Morton <akpm at osdl dot org>, Ingo Molnar <mingo at redhat dot com>, Greg Kroah-Hartman <gregkh at suse dot de>, Christoph Hellwig <hch at infradead dot org>, "Martin J. Bligh" <mbligh at mbligh dot org>, linuxppc-dev at ozlabs dot org, Douglas Niehaus <niehaus at eecs dot ku dot edu>, ltt-dev at shafik dot org, systemtap at sources dot redhat dot com, Thomas Gleixner <tglx at linutronix dot de>
- Date: Wed, 24 Jan 2007 20:08:12 +1100
- Subject: Re: [PATCH 7/10] local_t : powerpc
- References: <20061221001545.GP28643@Krystal> <20061221002705.GW28643@Krystal>
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?
Paul.