This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Using __kuser_cmpxchg
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: Paul Brook <paul at codesourcery dot com>, java at gcc dot gnu dot org
- Cc: linux-arm-kernel at lists dot arm dot linux dot org dot uk
- Date: Thu, 15 Nov 2007 16:56:32 +0000
- Subject: Using __kuser_cmpxchg
- References: <18069.10098.18740.585534@zebedee.pink> <200707131904.13071.paul@codesourcery.com> <18074.23501.203002.207179@zebedee.pink>
Andrew Haley writes:
> Paul Brook writes:
> > > + ? arm*-linux-gnu)
> >
> > Should probably be
> >
> > arm*-linux*)
>
> OK, will do.
>
> > > +/* Atomic compare and exchange. These sequences are not actually
> > > + atomic; there is a race if *ADDR != OLD_VAL and we are preempted
> >
> > For recent kernels there is a kernel helper you should use.
> > See __kernel_cmpxchg in linux/arch/arm/kernel/entry-armv.S
> >
> > Any kernel capable of running on armv6/v7 hardware should have this helper.
> > So should all targets on targets that define __ARM_EABI__
> >
> > So I suggest using the kernel helper for EABI and v6/v7 libraries, everyone
> > else will have to make do with the crappy old sequence.
>
> OK, I'll investigate this as soon as I get some time.
It seems to be impossible to use this kernel helper because
* - A failure might be transient, i.e. it is possible, although unlikely,
* that "failure" be returned even if *ptr == oldval.
If this were to happen, the logic used to block and unblock threads
wouldn't work.
Andrew.