是什么机制禁用LFENCE使不可能重新排序? [英] What mechanism disables the LFENCE to make impossible reordering?
问题描述
当我们从previous问题知道:<一href=\"http://stackoverflow.com/questions/20316124/does-it-make-any-sense-instruction-lfence-in-processors-x86-x86-64\">Does它使处理器任何意义指令LFENCE的x86 / x86_64的?
这是我们不能使用 SFENCE
而不是 MFENCE
的顺序一致性。而mainaly MFENCE
= SFENCE
+ LFENCE
,即 LFENCE
做一些事情,没有这些我们无法提供连续一致性。
LFENCE
使得无法重新排序:
SFENCE
LFENCE
MOV章,[地址]
- 要 - >
MOV章,[地址]
SFENCE
LFENCE
有关的例子重新排序MOV [地址],章
LFENCE
- > LFENCE
MOV [地址],章
按机制提供 - 存储缓冲,其中重排商店 - 荷载的性能提升,并东阳 LFENCE
没有prevent它。和 SFENCE
禁用此机制
什么机制禁用 LFENCE
进行重新排序是不可能的(X86没有机制 - 无效队列)?
和为 SFENCE
MOV章的重新排序,[地址]
- > MOV章,[地址]
SFENCE
可能只是在理论上或者在现实中?如果可能的话,在现实中,什么样的机制,它是如何工作的?
什么机制禁用LFENCE进行重新排序是不可能的(X86没有机制 - 无效队列)
?
块引用>从英特尔手册,卷2A,第3-464文档中的
LFENCE
指令:
LFENCE不执行,直到所有先前指令都在本地完成,直到LFENCE完成不迟指令开始执行
块引用>所以,是的,你的例子是重新排序明确$由
LFENCE
指令pvented p $。您只涉及SFENCE
说明第二个例子是一个有效的重新排序,因为SFENCE
对装载操作没有任何影响。As we know from previous question: Does it make any sense instruction LFENCE in processors x86/x86_64?
That we can not use
SFENCE
instead ofMFENCE
for Sequential Consistency. And mainalyMFENCE
=SFENCE
+LFENCE
, i.e.LFENCE
do something without which we can not provide Sequential Consistency.
LFENCE
makes impossible to reordering:SFENCE LFENCE MOV reg, [addr]
-- To -->
MOV reg, [addr] SFENCE LFENCE
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 beacauseLFENCE
does not prevent to it. AndSFENCE
disables this mechanism.What mechanism disables the
LFENCE
to make impossible reordering (x86 have not mechanism - Invalidate-Queue)?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?解决方案What mechanism disables the LFENCE to make impossible reordering (x86 have not mechanism - Invalidate-Queue)?
From the Intel manuals, volume 2A, page 3-464 documentation for the
LFENCE
instruction:LFENCE does not execute until all prior instructions have completed locally, and no later instruction begins execution until LFENCE completes
So yes, your example reordering is explicitly prevented by the
LFENCE
instruction. Your second example involving onlySFENCE
instructions IS a valid reordering, sinceSFENCE
has no impact on load operations.这篇关于是什么机制禁用LFENCE使不可能重新排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!