Using __kuser_cmpxchg

Nicolas Pitre nico@cam.org
Fri Nov 16 01:18:00 GMT 2007


On Fri, 16 Nov 2007, Paul Brook wrote:

> > >  > In the mean time you can work around it by using a mutex around the
> > >  > thread state modification instead of using cmpxchg on it.  Or if your
> > >  > platform is ARMv6 or higher then you won't get those spurious false
> > >  > negatives.
> > >
> > > Ah, OK, that's interesting: it sounds like you understand under what
> > > circumstances it may fail "spuriously".
> >
> > Heh, I wrote that code (and comment).  :-)
> >
> > > What are these?
> >
> > On a pre-ARMv6 processor
> 
> Similar "spurious" failures can happen on ARMv6 processors.
> 
> ARMv6 cpus don't have atomic operations either. They have ldrex/strex, where 
> the latter will fail if another CPU modifies the memory *or* a context switch 
> occurs.

Due to the current implementation this is indeed true.

ARMv6 is more trivial to fix though, since the operation can be 
reattempted whenever the strex fails.


Nicolas



More information about the Java mailing list