5 ms·
Absolutely not solely for DEC Alpha; From the source [1]: You must use one of the rcu_dereference() family of primitives to load an RCU-protected poin
by gpderetta 3y ago
Absolutely not solely for DEC Alpha; From the source [1]:
You must use one of the rcu_dereference() family of primitives
to load an RCU-protected pointer, otherwise CONFIG_PROVE_RCU
will complain. Worse yet, your code can see random memory-corruption
bugs due to games that compilers and DEC Alpha can play.
Without one of the rcu_dereference() primitives, compilers
can reload the value, and won't your code have fun with two
different values for a single pointer! Without rcu_dereference(),
DEC Alpha can load a pointer, dereference that pointer, and
return data preceding initialization that preceded the store of
the pointer.
The whole document then goes in great details on the all the ways the compiler can screw you over.
If the kernel were to drop Alpha support tomorrow, rcu_dereference and all the warnings would still be relevant.
Similarly, if only x86, SPARC and Alpha existed, memory order relaxed, acquire/release and seq-cst would be sufficient. consume only exists to cater to architectures with memory models stronger than Alpha but weaker than TSO.
[1]https://www.kernel.org/doc/Documentation/RCU/rcu_dereference.txt https://www.kernel.org/doc/Documentation/RCU/rcu_dereference...