https://access.redhat.com/solutions/2574771
RHEV/KVM: how are the CPU models mapped to the CPU flags?
SOLUTION IN PROGRESS - 已更新 2016年八月26日12:25 -
环境
- Red Hat Virtualization 4
- Red Hat Enterprise Virtualization 3
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 6
- libvirt
- qemu-kvm
问题
- Where can I find the mapping between CPU models and flags for Virtualization?
- How can I enabled or disable a specific feature/flag?
- Which CPU flags are enabled when I select Sandy Bridge?
- Which CPU flags are enabled when I select Haswell?
- Which CPU flags are enabled when I select Broadwell?
- Which CPU flags are enabled when I select Opteron_G5?
决议
The definitions are stored in /usr/share/libvirt/cpu_map.xml.
$ cat /usr/share/libvirt/cpu_map.xml | egrep 'Opteron_G5|Broadwell' -A5
<model name='Broadwell'>
<vendor name='Intel'/>
<feature name='3dnowprefetch'/>
<feature name='adx'/>
<feature name='aes'/>
<feature name='apic'/>
...
--
<model name='Opteron_G5'>
<vendor name='AMD'/>
<feature name='3dnowprefetch'/>
<feature name='abm'/>
<feature name='aes'/>
<feature name='apic'/>
...
NOTE: the below is not valid for Red Hat Virtualization. It's only intended for RHEL KVM.
To enable or disable a specific flag, edit the VM definition using virsh edit <vm name> and edit the cpu section of the xml with:
<cpu ....>
<feature policy='policy' name='flag'/>
</cpu>
Where flag is the feature, such as vmx. And policy is one of the below:
| Policy | Description |
|---|---|
| force | The virtual CPU will claim the feature is supported regardless of it being supported by host CPU. |
| require | Guest creation will fail unless the feature is supported by host CPU. |
| optional | The feature will be supported by virtual CPU if and only if it is supported by host CPU. |
| disable | The feature will not be supported by virtual CPU. |
| forbid | Guest creation will fail if the feature is supported by host CPU. |
For example, to require the vmx feature to be passed to the Virtual Machine CPU:
<cpu ....>
<feature policy='require' name='vmx'/>
</cpu>

本文详细介绍了在Red Hat Enterprise Linux (RHEL) 和 KVM 虚拟化环境中,如何查找CPU模型与特征标志之间的映射。文章解释了如何在/usr/share/libvirt/cpu_map.xml中找到这些映射,并提供了如何启用或禁用特定CPU特征的方法。此外,还列出了Sandy Bridge、Haswell、Broadwell和Opteron G5等CPU模型所支持的特征。
4524

被折叠的 条评论
为什么被折叠?



