linux – 自旋锁真的需要DMB吗?

前端之家收集整理的这篇文章主要介绍了linux – 自旋锁真的需要DMB吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在使用双Cortex-A9系统,我一直在努力
了解为什么自旋锁功能需要使用DMB.它似乎
只要合并存储缓冲区刷新了锁定值
应该在解锁核心的L1上结束并且SCU应该
要么使另一个核心的L1中的值无效,要么更新.
这足以保持一致性和安全锁定吗?和
STREX不会跳过合并存储缓冲区,这意味着我们没有
甚至需要冲洗?

DMB似乎是一种生硬的锤子,特别是因为它
默认为系统域,这可能意味着一直写入
主内存,这可能是昂贵的.

锁定中的DMB是否为驱动程序的解决方法
正确使用smp_mb?

我目前看到,基于性能指标,约占5%
我的系统周期在由DMB引起的停顿中消失.

最佳答案
我发现这些文章可能会回答你的问题:

> Locks,SWPs and two Smoking Barriers
> Locks,SWPs and two Smoking Barriers (Part 2)

特别是:

You will note the Data Memory Barrier (DMB) instruction that is issued once the lock has been acquired. The DMB guarantees that all memory accesses before the memory barrier will be observed by all of the other cpus in the system before all memory accesses made after the memory barrier. This makes more sense if you consider that once a lock has been acquired,a program will then access the data structure(s) locked by the lock. The DMB in the lock function above ensures that accesses to the locked data structure are observed after accesses to the lock.

原文链接:https://www.f2er.com/linux/440610.html

猜你在找的Linux相关文章