SFENCE + LFENCE为什么等效于(或不等于)MFENCE? [英] Why is (or isn't?) SFENCE + LFENCE equivalent to MFENCE?

查看:430
本文介绍了SFENCE + LFENCE为什么等效于(或不等于)MFENCE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从先前对

As we know from a previous answer to Does it make any sense instruction LFENCE in processors x86/x86_64? that we can not use SFENCE instead of MFENCE for Sequential Consistency.

那里的答案表明MFENCE = SFENCE + LFENCE,即LFENCE会执行某些操作,否则我们将无法提供顺序一致性.

An answer there suggests that MFENCE = SFENCE+LFENCE, i.e. that LFENCE does something without which we can not provide Sequential Consistency.

LFENCE使得无法重新排序:

SFENCE
LFENCE
MOV reg, [addr]

-到->

MOV reg, [addr]
SFENCE
LFENCE

例如,机制-存储缓冲区提供的MOV [addr], reg LFENCE-> LFENCE MOV [addr], reg的重新排序,它对存储-为提高性能而加载的负载进行重新排序,并且因为LFENCE并不能阻止它.并且SFENCE 禁用此机制.

For example reordering of MOV [addr], reg LFENCE --> LFENCE MOV [addr], reg provided by mechanism - Store Buffer, which reorders Store - Loads for performance increase, and beacause LFENCE does not prevent to it. And SFENCE disables this mechanism.

什么机制禁止LFENCE使其无法进行重新排序(x86没有机制-Invalidate-Queue)?

What mechanism disables the LFENCE to make impossible reordering (x86 have not mechanism - Invalidate-Queue)?

SFENCE MOV reg, [addr]-> MOV reg, [addr] SFENCE的重新排序是否仅在理论上或实际上是可能的?如果可能的话,实际上是什么机制,它是如何运作的?

And is reordering of SFENCE MOV reg, [addr] --> MOV reg, [addr] SFENCE possible only in theory or perhaps in reality? And if possible, in reality, what mechanisms, how does it work?

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆