ARM64内存屏障指令

news/2024/10/22 13:17:26/

ARM64内存屏障指令

  • 1 内存屏障的提供的功能
  • 2 介绍DMB/DSB/ISB指令以及区别
    • 2.1 数据存储屏障指令DMB(Data Memory Barrier)
    • 2.2 数据同步屏障指令DSB(Data Synchronization Barrier)
    • 2.3 指令同步屏障指令ISB(Instruction Synchronization Barrier)
  • 3 内存屏障指令参数

1 内存屏障的提供的功能

The memory barriers defined by the Armv8 architecture provide a range of functionality, including:

  • Ordering of Load/Store instructions.
  • Completion of Load/Store instructions.
  • Context synchronization.

2 介绍DMB/DSB/ISB指令以及区别

2.1 数据存储屏障指令DMB(Data Memory Barrier)

The DMB instruction is a memory barrier instruction that ensures the relative order of memory accesses before the barrier with memory accesses after the barrier. The DMB instruction does not ensure the completion of any of the memory accesses for which it ensures relative order.
DMB指令是一种内存屏障指令,它确保屏障前的内存访问相对顺序与屏障后的内存访问相对顺序。DMB指令不确保任何它所确保相对顺序的内存访问已经完成。
保证的树内存屏障前后的内存访问指令的执行顺序,不能保证内存访问指令在内存屏障指令之前必须完成。
The basic principle of a DMB instruction is to introduce order between memory accesses that are specified to be affected by the DMB options supplied as arguments to the DMB instruction. The DMB instruction ensures that all affected memory accesses by the PE executing the DMB instruction that appear in program order before the DMB instruction and those which originate from a different PE, to the extent required by the DMB options, which have been Observed-by the PE before the DMB instruction is executed, are Observed-by each PE, to the extent required by the DMB options, before any affected memory accesses that appear in program order after the DMB instruction are Observed-by that PE.
DMB指令的基本原则是在由作为DMB指令参数提供的选项所指定的受影响的内存访问之间引入顺序。DMB指令确保由执行DMB指令的PE在DMB指令之前按程序顺序执行的所有受影响的内存访问,以及来自不同PE的内存访问(根据DMB选项的要求),在DMB指令被执行之前被PE所观察到,并且这些内存访问将被每个PE(根据DMB选项的要求)在任何在DMB指令之后按程序顺序执行的受影响的内存访问之前所观察到。
The use of a DMB instruction creates order between the Memory effects of instructions as described in the definition of Barrier-ordered-before.
使用DMB指令会在指令的内存效果之间建立顺序,如屏障排序定义中所述。
The DMB instruction only affects memory accesses and the operation of data cache and unified cache maintenance instructions. It has no effect on the ordering of any other instructions executing on the PE. A DMB instruction intended to ensure the completion of cache maintenance instructions must have an access type of both loads and stores.
DMB指令仅影响内存访问和数据高速缓存和统一高速缓存维护指令的操作。它不影响PE上执行的任何其他指令的顺序。DMB指令旨在确保高速缓存维护指令的完成,必须具有加载和存储两种访问类型。

2.2 数据同步屏障指令DSB(Data Synchronization Barrier)

这条指令可以保证任何指令都要等待DSB指令之前的存储访问操作处理完成之后才可以执行。
A DSB instruction is a memory barrier that ensures that memory accesses that occur before the DSB instruction have completed before the completion of the DSB instruction. In doing this, it acts as a stronger barrier than a DMB and all ordering that is created by a DMB with specific options is also generated by a DSB with the same options.
DSB指令是一种内存屏障,它确保在DSB指令完成之前发生的内存访问已经完成。通过这样做,它比DMB指令更强,所有由DMB指令特定选项创建的排序也可以由具有相同选项的DSB指令生成。
Execution of a DSB instruction:
执行DSB指令:
• At EL2 ensures that any memory accesses caused by Speculative translation table walks from the EL1&0 translation regime have been observed.
• 在EL2上,确保已经观察到由EL1&0翻译管理机制引起的任何推测性翻译表访问。
• At EL3 ensures that any memory accesses caused by speculative translation table walks from the EL2, EL1&0 or EL2&0 translation regimes have been observed.
• 在EL3上,确保已经观察到由EL2、EL1&0或EL2&0翻译管理机制引起的任何推测性翻译表访问。

A DSB instruction executed by a PE, PEe, completes when all of the following apply:
当一个PE执行DSB指令时,该指令完成的条件为:
• All explicit memory accesses of the required access types appearing in program order before the DSB are complete for the set of observers in the required shareability domain.
对于指定的共享域内的观察者,程序中在DSB之前出现的所有特定访问类型的显式内存访问都已完成。
• If the required access types of the DSB is reads and writes, then all cache maintenance instructions, all TLB maintenance instructions, and all PSB CYNC instructions issued by PEe before the DSB are complete for the required shareability domain.
如果DSB所需的访问类型为读和写,则在所需的共享性域内,PEe在DSB之前发出的所有缓存维护指令、TLB维护指令和PSB CYNC指令都已完成。

In addition, no instruction that appears in program order after the DSB instruction can alter any state of the system or perform any part of its functionality until the DSB completes other than:
此外,在 DSB 完成之前,任何按程序顺序出现在 DSB 指令之后的指令都不能改变系统的任何状态或执行其功能的任何部分,除非:
• Being fetched from memory and decoded.
• 从内存中获取并解码指令。
• Reading the general-purpose, SIMD and floating-point, Special-purpose, or System registers that are directly or indirectly read without causing side-effects.
• 直接或间接读取通用、SIMD 和浮点寄存器、特殊寄存器或系统寄存器而不引起副作用。

2.3 指令同步屏障指令ISB(Instruction Synchronization Barrier)

该条指令会在冲刷流水线和渔区buffers后,才从高速缓存或者内存中预取ISB之后的指令。
An ISB instruction ensures that all instructions that come after the ISB instruction in program order are fetched from the cache or memory after the ISB instruction has completed. Using an ISB ensures that the effects of context-changing operations executed before the ISB are visible to the instructions fetched after the ISB instruction.
ISB指令确保在ISB指令之后按程序顺序执行的所有指令在ISB指令完成后从高速缓存或内存中获取。使用ISB可以确保在ISB之前执行的上下文更改操作的效果对在ISB指令之后获取的指令是可见的。
Examples of context-changing operations that require the insertion of an ISB instruction to ensure the effects of the operation are visible to instructions fetched after the ISB instruction are:
需要插入ISB指令以确保操作的效果对于在ISB指令后被提取的指令是可见的上下文更改操作的示例包括:
• Completed cache and TLB maintenance instructions.
• 完成的缓存和TLB维护指令。
• Changes to System registers.
• 系统寄存器的更改。
Any context-changing operations appearing in program order after the ISB instruction only take effect after the ISB has been executed.
ISB指令执行后,出现在程序顺序之后的任何上下文更改操作只有在ISB执行后才会生效。

3 内存屏障指令参数

参数访问顺序共享属性
SY内存读写指令全系统共享
ST内存写指令全系统共享
LD内存读指令全系统共享
ISH内存读写指令Inner 共享
ISHST内存写指令Inner 共享
ISHLD内存读指令Inner 共享
NSH内存读写指令不共享
NSHST内存写指令不共享
NSHLD内存读指令不共享
OSH内存读写指令Outer 共享
OSHST内存写指令Outer 共享
OSHLD内存读指令Outer 共享

http://www.ppmy.cn/news/52670.html

相关文章

聚观早报 | 马斯克称星舰1-2个月内准备再发射;推特撤下官媒标签

今日要闻:马斯克称星舰1-2个月内准备再发射;推特撤下「官媒」标签;Pixel Fold 折叠机型首次被泄露;蔚来员工曝半年加班500小时;苹果Mac Pro和Mac Studio无缘WWDC 马斯克称星舰1-2个月内准备再发射 美国当地时间 4 月 …

手术麻醉信息管理系统源码,生成规范麻醉文书,自动信息采集

C#手麻系统源码,C# .net 桌面软件 C/S版手术麻醉信息管理系统源码 手术麻醉信息管理系统源码是专门为麻醉科和手术室开发的围手术期临床信息管理系统,具备以下功能: 1.规范手术流程管理:系统整合了手术室、麻醉科的工作及管理流程&#xff…

flinkSQL Table转DataStream

flink版本1.14 flinksql 来源于kafka json格式数据 变化的表 业务中sql可能不完全满足使用,需要转换成DataStream 更灵活一些,所以需要互相转换,发挥各自的优势。 final StreamExecutionEnvironment env StreamExecutionEnvironment.getE…

「SQL面试题库」 No_49 产品销售分析 I

🍅 1、专栏介绍 「SQL面试题库」是由 不是西红柿 发起,全员免费参与的SQL学习活动。我每天发布1道SQL面试真题,从简单到困难,涵盖所有SQL知识点,我敢保证只要做完这100道题,不仅能轻松搞定面试&#xff0…

【社区图书馆】30+危机,最值得读烂的5本书|必读

“年少时总会抱怨读书无用,殊不知那只是你没有用心感受读书带给你的好处。” ㅤ 一直觉得迈入30大门并不可怕,“35岁危机”也离自己甚远。然而,近1年自己身上发生的一些事情,让自己越来越认识到:只有不断丰富内在、提高…

优漫动游APP四类页面样式设计

在设计过程中,在新设计一个页面时,会遇到一个基本的问题,我的页面背景应该是底色?页面的要素怎么组合展现才能达到更好的展现美观度,贴合业务需要,实现更高的转化率?   基于上面的问题&…

java版本电子招标采购系统源码—企业战略布局下的采购

​ 智慧寻源 多策略、多场景寻源,多种看板让寻源过程全程可监控,根据不同采购场景,采取不同寻源策略, 实现采购寻源线上化管控;同时支持公域和私域寻源。 询价比价 全程线上询比价,信息公开透明&#xff0…

ISO-27145故障诊断说明

ISO-27145故障诊断说明 2.1 27145目录说明 ISO27145-1: 这里边介绍的是一般信息和用例定义; ISO27145-2: 这里边介绍的是与排放相关的通用数据规则,用于查询; ISO27145-3: 这里边主要介绍了支持的服务 12服务 14服务 19服务 22服务 31服务&…