[fedora-arm] ARMv5 and atomic operations
Nicolas Pitre
nico at fluxnic.net
Mon Apr 23 15:02:57 UTC 2012
On Sun, 22 Apr 2012, Chris Tyler wrote:
> 6. There is the kernel's "user space atomic helper" (kuser_cmpxchg64) at
> 0xffff0f60, see Documentation/arm/kernel_user_helpers.txt. The kernel
> puts an instruction sequence here tuned for the current arch that can be
> called by userland to provide an atomic compare/exchange -- if it can be
> done natively, the instruction sequence does that, otherwise it does a
> syscall (with IRQ protection etc).
No, there is no syscall involved here. Doing so would have killed
performances for any trivial amount of atomic operations.
The way this works is to perform the operation, using non-atomic
instructions as they're not available on ARMv5, and if an interrupt or a
page fault occurs inside the critical region that the kernel controls,
then the operation is rewinded and resumed the next time the user space
task gets to run. This way you get the same performance as with native
atomic instructions on later processors, except for the added branch
instruction.
Nicolas
More information about the arm
mailing list