You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When cpu.rs was originally written, it used std::sync::Once. std::sync::Once explicitly guarantees "that any memory writes performed by the executed closure can be reliably observed by other threads at this point (there is a happens-before relation between the closure and code executing after the return)" and we relied on this to ensure that the writes to GFp_ia32cap_P and GFp_iarmcap_P are seen by all threads.
When cpu.rs was originally written, it used
std::sync::Once
.std::sync::Once
explicitly guarantees "that any memory writes performed by the executed closure can be reliably observed by other threads at this point (there is a happens-before relation between the closure and code executing after the return)" and we relied on this to ensure that the writes toGFp_ia32cap_P
andGFp_iarmcap_P
are seen by all threads.Later, cpu.rs was modified to use spin-rs directly instead of
std::sync::Once
However, spin-rs'sOnce
does NOT provide the same guarantee in its documentation. (Neither doeslazy_static!
.) See https://mvdnes.github.io/rust-docs/spin-rs/spin/struct.Once.html#method.call_once.I think that because x86 and x86-64 have a strong memory model, only the feature detection for other CPUs (currently ARM) may be racy.
The text was updated successfully, but these errors were encountered: