是什么机制禁用LFENCE使不可能重新排序? [英] What mechanism disables the LFENCE to make impossible reordering?

查看:612
本文介绍了是什么机制禁用LFENCE使不可能重新排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们从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 of MFENCE for Sequential Consistency. And mainaly MFENCE = 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 beacause LFENCE does not prevent to it. And SFENCE 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 only SFENCE instructions IS a valid reordering, since SFENCE has no impact on load operations.

这篇关于是什么机制禁用LFENCE使不可能重新排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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