Developing concurrent software is challenging, specially if it has to run on modern architectures with Weak Memory Models (WMMs) such as Armv8 and RISC-V. For the sake of performance, WMMs allow hardware and compilers to aggressively reorder memory accesses. To guarantee correctness, developers have to carefully place memory barriers in the code to enforce ordering among critical memory operations. While WMM architectures are growing in popularity, it is notoriously difficult to identify the necessary and sufficient barriers of complex synchronization primitives. Unfortunately, recent publications often consider barriers just implementation details and omit them. In this technical note, we report our efforts in verifying the correctness of the Compact NUMA-Aware (CNA) lock algorithm on WMMs, inserting a correct and efficient set of barriers in the implementation. The CNA lock is of special interest because it is being integrated in Linux qspinlock, and this integration process has produced several reviews of the algorithm. We intend to contribute to this process by verifying the correctness of the latest patch (v15) on WMMs.
翻译:开发同时使用的软件具有挑战性,特别是如果它必须用弱记忆模型(WMMs)运行在现代建筑上,如Armv8和RISC-V。为了性能,WMMs允许硬件和编译者对内存存存存取进行积极的重新订购。为了保证正确性,开发者必须在代码中谨慎地设置记忆障碍,以便在关键记忆操作中执行命令。虽然WMM结构越来越受欢迎,但发现复杂同步原始体的必要和足够障碍是十分困难的。不幸的是,最近的出版物常常考虑设置障碍,只字不提。在本技术说明中,我们报告了我们为核查《NUMA-Aware(CNA)契约》对WMMMs锁定算法的正确性所作的努力,在实施过程中插入了一套正确而有效的障碍。CNA锁具有特别的意义,因为它正在与Linux qspinlock相结合,而这一集成过程对算法进行了几次审查。我们打算通过核查关于WMMMMs的最新补码(v15)的正确性来推动这一进程。