我正在联想X1笔记本电脑上运行KVM / QEMU .
客户操作系统是Ubuntu 15.04 x86_64 .
现在,我想在客户操作系统中运行'perf'命令,但我在dmesg中的客户操作系统中发现了以下内容 .
...
[0.055442] smpboot:CPU0:Intel Xeon E3-12xx v2(Ivy Bridge)(fam:06,型号:3a,步进:09)
[0.056000]性能事件:不支持的p6 CPU型号58无PMU驱动程序,仅限软件事件 .
[0.057602] x86:引导SMP配置:
[0.058686] ....节点#0,CPU:#1
[0.008000] kvm-clock:cpu 1,msr 0:1ffd6041,辅助cpu时钟
...因此,perf命令无法在来宾操作系统中运行硬件PMU事件 .
如何从主机到Ubuntu guest虚拟机启用硬件PMU?
谢谢,
-Tao
1 回答
Page https://github.com/mozilla/rr/wiki/Building-And-Installing给出了一些如何启用客户PMU的提示:
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/sect-virtualization_tuning_optimization_guide-monitoring_tools-vpmu中的相同建议
我将
<cpu mode='host-passthrough'/>
行编辑为/etc/libvirt/qemu/my_vm_name.xml
文件而不是<cpu>...</cpu>
块 .(在virt-manager中使用"host-passthrough"作为CPU "Model:"字段 - http://blog.wikichoon.com/2016/01/using-cpu-host-passthrough-with-virt.html)
现在PMU工作,在VM内部使用
perf stat echo
进行测试,/proc/cpuinfo
中有"arch_perfmon",dmesg|grep PMU
中启用了PMU .根据/var/log/libvirt/qemu/vm_name.log使用了
-cpu host
Qemu选项: