This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [PATCH] mips: work-around R10k ll/sc errata
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: Matt Turner <mattst88 at gmail dot com>
- Cc: libc-ports at sourceware dot org, Ralf Baechle <ralf at linux-mips dot org>, Joshua Kinard <kumba at gentoo dot org>, Tom de Vries <tom at codesourcery dot com>
- Date: Wed, 29 Jun 2011 14:39:14 +0000 (UTC)
- Subject: Re: [PATCH] mips: work-around R10k ll/sc errata
- References: <1309298625-31737-1-git-send-email-mattst88@gmail.com>
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