Kernelspace C11 atomics for MIPS

Andre Oppermann andre at freebsd.org
Tue Jun 4 08:19:25 UTC 2013


On 03.06.2013 16:04, Ed Schouten wrote:
> Hi,
>
> As of r251230, it should be possible to use C11 atomics in
> kernelspace, by including <sys/stdatomic.h>! Even when not using Clang
> (but GCC 4.2), it is possible to use quite a large portion of the API.

I'm a bit wary of *kernel* developers using C11-native atomics as opposed
to our own atomic API.  This could lead to a proliferation of home-grown,
more or less correctly working, locks and variants thereof (mostly less
correct).

Atomics and locks are difficult enough to get right and reason about even
with our rather good API and I scream in fear thinking about everyone(tm)
doing their own "optimized" lock or even forgoing it because "it's atomic".

I would even propose to go as far as disbarring the use of C11 atomics in
the kernel other than inside the officially supported lock API.

-- 
Andre



More information about the freebsd-arch mailing list