Re: [RFT] [SPARC] Emulate cmpxchg like parisc
From: Kyle McMartin <kyle@parisc-linux.org>
Date: Sun, 27 May 2007 23:11:14 -0400
> Yeah, David Howells wanted to use cmpxchg in his work struct patch, but
> had to not because not everyone implements it.
>
> >From what I can tell, very few arches actually have CAS, and others
> emulate it with LL/SC type implementations.
That's fine, as a LL/SC implementation of cmpxchg() is fully
atomic and would work in concert with a userspace cmpxchg()
implemented with LL/SC.
It's the platforms that lack CAS _and_ some kind of LL/SC
which are problematic.
Sparc32 SMP cpus (sparcv8 sun4m and later) have a 'swap' instruction
but that does not have an inifinite consensus number like CAS and
LL/SC, so it can't be used to implement cmpxchg() (and also the
non-SMP sparc32 chips lack the instruction).
Reply to: