AMD的页面表扩展中的ASID何时不再有效?

时间:2020-12-27 20:18:16

IA-32 defines various cases in which the CPU may invalidate the entire TLB. Starting with the ASID extensions that AMD released in Opteron Rev-F processors (Barcelona?) there are cases in which only the TLB entries of a certain ASID are invalidated.

IA-32定义了CPU可能使整个TLB无效的各种情况。从AMD在Opteron Rev-F处理器(Barcelona?)中发布的ASID扩展开始,有些情况下只有某个ASID的TLB条目无效。

The question is, does the ASID itself ever stop being valid? Does the Hypervisor have to check that an ASID is valid before using it?

问题是,ASID本身是否永远无效?在使用之前,Hypervisor是否必须检查ASID是否有效?

1 个解决方案

#1


I think the answer is 'not directly' - looking at the AMD system programming specification, the ASID field in the VM control block is simply a (up to) 32bit ID which the hypervisor sets to a unique value for each instance of a VM, and is used as an additional tag in the TLB lookup.

我认为答案是“不直接” - 看看AMD系统编程规范,VM控制块中的ASID字段只是一个(最多)32位ID,管理程序为每个VM实例设置一个唯一值,并用作TLB查找中的附加标记。

As you have no direct control over the TLB contents on x86, you can't control what entries end up in the TLB - if the processor decides to add an entry to the TLB, the entry will be tagged with the current ASID, which by definition will be valid when added.

由于您无法直接控制x86上的TLB内容,因此无法控制TLB中最终的条目 - 如果处理器决定向TLB添加条目,则条目将使用当前ASID标记,定义在添加时有效。

This is described in a somewhat roundabout way in section 15.15.1 of the previously mentioned system programming spec:

这在前面提到的系统编程规范的第15.15.1节中以稍微迂回的方式描述:

In implementations that do not provide a way to selectively flush all translations of a single specified ASID, software may effectively flush the guest's TLB entries by allocating a new ASID for the guest and not reusing the old ASID until the entire TLB has been flushed at least once.

在不提供选择性地刷新单个指定ASID的所有翻译的方式的实现中,软件可以通过为访客分配新的ASID而不重用旧的ASID来有效地刷新访客的TLB条目,直到至少刷新整个TLB为止。一旦。

This implies that the processor has no concept of valid or invalid ASIDs - it's just a number whose current value must match a TLB entries ASID for the TLB to hit. Hence if the hypervisor doesn't correctly flush an ASID before it reuses it, you'll get stale TLB hits.

这意味着处理器没有有效或无效ASID的概念 - 它只是一个数字,其当前值必须匹配TLB要命中的TLB条目ASID。因此,如果管理程序在重用它之前没有正确刷新ASID,那么您将获得过时的TLB命中。

#1


I think the answer is 'not directly' - looking at the AMD system programming specification, the ASID field in the VM control block is simply a (up to) 32bit ID which the hypervisor sets to a unique value for each instance of a VM, and is used as an additional tag in the TLB lookup.

我认为答案是“不直接” - 看看AMD系统编程规范,VM控制块中的ASID字段只是一个(最多)32位ID,管理程序为每个VM实例设置一个唯一值,并用作TLB查找中的附加标记。

As you have no direct control over the TLB contents on x86, you can't control what entries end up in the TLB - if the processor decides to add an entry to the TLB, the entry will be tagged with the current ASID, which by definition will be valid when added.

由于您无法直接控制x86上的TLB内容,因此无法控制TLB中最终的条目 - 如果处理器决定向TLB添加条目,则条目将使用当前ASID标记,定义在添加时有效。

This is described in a somewhat roundabout way in section 15.15.1 of the previously mentioned system programming spec:

这在前面提到的系统编程规范的第15.15.1节中以稍微迂回的方式描述:

In implementations that do not provide a way to selectively flush all translations of a single specified ASID, software may effectively flush the guest's TLB entries by allocating a new ASID for the guest and not reusing the old ASID until the entire TLB has been flushed at least once.

在不提供选择性地刷新单个指定ASID的所有翻译的方式的实现中,软件可以通过为访客分配新的ASID而不重用旧的ASID来有效地刷新访客的TLB条目,直到至少刷新整个TLB为止。一旦。

This implies that the processor has no concept of valid or invalid ASIDs - it's just a number whose current value must match a TLB entries ASID for the TLB to hit. Hence if the hypervisor doesn't correctly flush an ASID before it reuses it, you'll get stale TLB hits.

这意味着处理器没有有效或无效ASID的概念 - 它只是一个数字,其当前值必须匹配TLB要命中的TLB条目ASID。因此,如果管理程序在重用它之前没有正确刷新ASID,那么您将获得过时的TLB命中。