https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80148

--- Comment #3 from Dmitry Vyukov <dvyukov at google dot com> ---
> Why doesn't the kernel use atomic builtins instead?

There was a recent discussion here:
https://groups.google.com/forum/#!topic/kasan-dev/3sNHjjb4GCI

In short:
---
Trivially, The C++ model doesn't feature I/O ordering [1]...
+
https://lwn.net/Articles/691295/
+
rmb()/wmb() are not remotely similar to
atomic_thread_fenc_{acquire,release}, even if you restrict ordering to
coherent CPUs (i.e. the smp_* variants). Please don't do that :)
+
I'm also terrified of the optimisations that the compiler is theoretically
allowed to make to C11 atomics given the assumptions of the language
virtual machine, which are not necessarily valid in the kernel environment.
We would at least need well-supported compiler options to disable these
options, and also to allow data races with things like READ_ONCE.

Reply via email to