Element and attribute overview
CPU model and topology
20.11. CPU Model and Topology
KVM cpu 配置模式分类
使用lscpu命令查看CPU的架构,然后使用virsh cpu-models来查看支持的CPU型号。
「1.4. Supported Guest CPU Models」
简单介绍
可以使用以下元素指定 CPU「型号」、「特征」、「拓扑」。
<cpu match='exact'> <model fallback='allow'>core2duo</model> <vendor>Intel</vendor> <topology sockets='1' cores='2' threads='1'/> <cache level='3' mode='emulate'/> <feature policy='disable' name='lahf_lm'/> </cpu>
<cpu mode='host-model'> <model fallback='forbid'/> <topology sockets='1' cores='2' threads='1'/> </cpu>
<cpu mode='host-passthrough'> <cache mode='passthrough'/> <feature policy='disable' name='lahf_lm'/> ...
如果不需要对 CPU「型号」及其「特征」进行限制,可以简单的使用一个 cpu 元素:
<cpu> <topology sockets='1' cores='2' threads='1'/> </cpu>
配置结构
一个完整的结构如下:
<cpu match="minimum/exact/strict" check="none/partial/full" mode="custom/host-model/host-passthrough">
<model />
<vendor />
<topology sockets='1' cores='2' threads='1'/>
<feature />
<cache />
<numa>
<cell id="" cpus="" memory="" unit="" memAccess="" discard="">
<distances>
<sibling id='' value=''/>
</distances>
</cell>
</numa>
</cpu>
参考