Thanks again for the comments.
>> Quote the documentation, __kuser_cmpxchg "already includes memory
>> barriers as needed," so the code using it shouldn't need anything
> Fair enough - but could you put a comment to this effect into the patch?
> But I'm still not too happy about even the very unlikely risk of
> something executing "random stuff" depending on kernel version.
> For now, could you update the comments to that effect that:
> "These kernel functions are available on kernel versions 2.6.15 and
> greater" + ", and running this software on earlier versions will result
> in undefined behaviour."
> What I'm suggesting is not to parse information out of the build host,
> but rather using the configured toolchain and options and try to
> assemble the 64-bit atomic instructions. This would make it easy to
> rebuild a generic ARMv6 package to support 64-bit atomics by just adding
> -march=armv6zk to CFLAGS.
Ah, I get it. I may see if I can come up with a nice test in the near future.
For now, revised patch attached.