[PATCH] mips: work-around R10k ll/sc errata
Joseph S. Myers
joseph@codesourcery.com
Wed Jun 29 14:39:00 GMT 2011
On Tue, 28 Jun 2011, Matt Turner wrote:
> This was sent back in Nov 2008 by Joshua Kinard, but seems to have
> fallen through the cracks after a lot of bikeshedding.
>
> I don't particularly care about implementing alternative work-arounds,
> like 28 nops. I only intend for this patch to be useful when the builder
> is using -march=r10000 and/or -mfix-r10000. All other situations are
> unaffected.
I think the discussion really illustrates that glibc isn't the right place
to be making this decision; there are a lot of different compiler options
for different MIPS variants, and I don't know if they all have relevant
preprocessor macros, and the compiler already makes its own decisions
based on those options about how to implement __sync_*. There are also
various out-of-tree patches to the MIPS atomics in glibc to optimize them
for some processor variants.
The real fix is to use __sync_* for MIPS in glibc, as done for some other
architectures. But for this not to be an optimization regression you need
versions of those functions with more specific barrier semantics. Tom,
you had such functions (MIPS-specific) and associated glibc changes. A
proper set of target-independent such functions has recently been
discussed on gcc-patches by Aldy Hernandez, Andrew MacLeod et al; once the
generic framework is in GCC trunk, perhaps you could contribute a version
of your MIPS changes that builds on the generic framework, and then a
version of the glibc patches that uses the new generic builtins? The
existing assembly implementations can then be left just for GCC <= 4.6,
and not complicated by lots of processor conditionals.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-ports
mailing list