arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2111.15240cs.OS
收藏

弱记忆模型上的紧凑型NUMA锁的构造与优化

Verifying and Optimizing Compact NUMA-Aware Locks on Weak Memory Models

Antonio Paolillo, Hernán Ponce-de-León, Thomas Haas, Diogo Behrens, Rafael Chehab, Ming Fu, Roland Meyer

摘要:

开发并发软件具有挑战性,特别是如果它必须在具有弱内存模型(WESTERN)的现代体系结构(如ARMv 8,Power或RISC-V)上运行。为了保证正确性,开发人员必须小心地在代码中放置内存屏障,以强制执行关键内存操作之间的顺序。虽然WMM架构越来越受欢迎,但识别复杂同步原语的必要和充分障碍是非常困难的。不幸的是,出版物通常认为障碍只是实现细节,并忽略了它们。在本技术说明中,我们报告了我们在验证WESTERN上的Compact NUMA-Aware(CNA)锁算法的正确性方面所做的努力。CNA锁特别有趣,因为它已被提议作为Linux qspinlock(Linux中的主要自旋锁)的新慢路径。除了为WESTERN上的原始CNA算法确定一组正确有效的障碍外,我们还研究了Linux qspinlock和最新Linux CNA补丁(v15)在内存模型LKMM,ARMv 8和Power上的正确性。令人惊讶的是,我们发现Linux qspinlock和Linux CNA根据LKMM是不正确的,但在编译到ARMv 8或Power时仍然是正确的。

英文摘要:

Developing concurrent software is challenging, especially if it has to run on modern architectures with Weak Memory Models (WMMs) such as ARMv8, Power, or 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, identifying the necessary and sufficient barriers of complex synchronization primitives is notoriously difficult. Unfortunately, publications often consider barriers to be 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. The CNA lock is of special interest because it has been proposed as a new slowpath for Linux qspinlock, the main spinlock in Linux. Besides determining a correct and efficient set of barriers for the original CNA algorithm on WMMs, we investigate the correctness of Linux qspinlock and the latest Linux CNA patch (v15) on the memory models LKMM, ARMv8, and Power. Surprisingly, we have found that Linux qspinlock and, consequently, Linux CNA are incorrect according to LKMM, but are still correct when compiled to ARMv8 or Power.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑