如何将cache info透传入qemu虚拟机

将cache信息透传如虚拟机有助于guest kernel更好的进行负载均衡,甚至于减少IPI中断【1】。

使用qemu命令行:

qemu-system-x86_64 \
    -cpu host,host-cache-info=on,topoext \

使用libvirt,virt-install

virt-install \
--cpu mode='host-passthrough',cache.mode='passthrough',require='topoext'

或者修改xml

 <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='16' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
  </cpu>

【1】Why you should tell Qemu about your L3 cache (codeblueprint.co.uk)

【2】topology_amd.c - arch/x86/kernel/cpu/topology_amd.c - Linux source code (v6.9-rc7) - Bootlin

posted @ 2024-05-10 14:00  半山随笔  阅读(20)  评论(0编辑  收藏  举报