aarch64 是否有不可缓存(=缓存旁路)加载或存储指令?
Is there non-cacheable (=cache-bypass) load or store instruction for aarch64?
在sparc架构中,有一个ASI(地址space指示器)被传递给加载,存储指令,所以如果ASI是0x20,缓存就像它的IO访问一样被绕过。即使内存范围在页面 table 处设置为可缓存,缓存也会被绕过。这有时非常方便,例如在使用变量等在内核之间进行同步时。
aarch64 架构中有类似的东西吗?我查看了说明内容,但在 load/store 说明列表中找不到任何内容。
ARMv8 没有这样的指令。 Load/Store 指令访问内存取决于映射属性。
提到的 LDNP
和 STNP
指令不是为了绕过缓存。
The Load/Store Non-temporal Pair instructions provide a hint to the memory system that an access is non-temporal or streaming, and unlikely to be repeated in the near future. This means that data caching is not required. However, depending on the memory type, the instructions might permit memory reads to be preloaded and memory writes to
be gathered to accelerate bulk memory transfers. (Arm Architecture Reference Manual)
所以缓存仍然可能涉及。
例如,在 Cortex-A53 TRM 之上,明确声明将涉及缓存。
Non-temporal loads
Cache requests made by a non-temporal load instruction (LDNP) are allocated to the L2 cache only. The allocation policy makes it likely that the line is replaced sooner than other lines.
对于核心同步,您可以查看 ARMv8 手册以了解锁实现(也称为原子)和自旋锁。
作为旁注,请查看您的芯片文档。许多现代芯片都具有特殊的硬件功能,可以提供基于硬件的高速缓存一致性接口。
在sparc架构中,有一个ASI(地址space指示器)被传递给加载,存储指令,所以如果ASI是0x20,缓存就像它的IO访问一样被绕过。即使内存范围在页面 table 处设置为可缓存,缓存也会被绕过。这有时非常方便,例如在使用变量等在内核之间进行同步时。
aarch64 架构中有类似的东西吗?我查看了说明内容,但在 load/store 说明列表中找不到任何内容。
ARMv8 没有这样的指令。 Load/Store 指令访问内存取决于映射属性。
提到的 LDNP
和 STNP
指令不是为了绕过缓存。
The Load/Store Non-temporal Pair instructions provide a hint to the memory system that an access is non-temporal or streaming, and unlikely to be repeated in the near future. This means that data caching is not required. However, depending on the memory type, the instructions might permit memory reads to be preloaded and memory writes to be gathered to accelerate bulk memory transfers. (Arm Architecture Reference Manual)
所以缓存仍然可能涉及。
例如,在 Cortex-A53 TRM 之上,明确声明将涉及缓存。
Non-temporal loads
Cache requests made by a non-temporal load instruction (LDNP) are allocated to the L2 cache only. The allocation policy makes it likely that the line is replaced sooner than other lines.
对于核心同步,您可以查看 ARMv8 手册以了解锁实现(也称为原子)和自旋锁。
作为旁注,请查看您的芯片文档。许多现代芯片都具有特殊的硬件功能,可以提供基于硬件的高速缓存一致性接口。