如何在 KVM 来宾中启用 PMU
how to enable PMU in KVM guest
我正在 运行宁 KVM/QEMU 我的联想 X1 笔记本电脑。
嘉宾OS是Ubuntu15.04x86_64.
现在,我想 运行 'perf' 在 guest OS 中执行命令,但我在 dmesg OS 中发现以下命令。
...
[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,CPUs:#1
[0.008000] kvm-clock: cpu 1, msr 0:1ffd6041, secondary cpu 时钟
...
因此,perf 命令无法在来宾 OS.
中处理硬件 PMU 事件
如何启用从主机到 Ubuntu 来宾的硬件 PMU?
谢谢,
-道
第 https://github.com/mozilla/rr/wiki/Building-And-Installing 页给出了一些如何启用访客 PMU 的提示:
Qemu: On QEMU command line use
-cpu host
Libvirt/KVM: Specify CPU passthrough in domain XML definition:
<cpu mode='host-passthrough'/>
中的相同建议
我将 <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: 使用了 Qemu 的 -cpu host
选项
/usr/bin/kvm-spice ... -machine ...,accel=kvm,... -cpu host ...
我正在 运行宁 KVM/QEMU 我的联想 X1 笔记本电脑。
嘉宾OS是Ubuntu15.04x86_64.
现在,我想 运行 'perf' 在 guest OS 中执行命令,但我在 dmesg OS 中发现以下命令。
...
[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,CPUs:#1
[0.008000] kvm-clock: cpu 1, msr 0:1ffd6041, secondary cpu 时钟
... 因此,perf 命令无法在来宾 OS.
中处理硬件 PMU 事件如何启用从主机到 Ubuntu 来宾的硬件 PMU?
谢谢,
-道
第 https://github.com/mozilla/rr/wiki/Building-And-Installing 页给出了一些如何启用访客 PMU 的提示:
中的相同建议Qemu: On QEMU command line use
-cpu host
Libvirt/KVM: Specify CPU passthrough in domain XML definition:
<cpu mode='host-passthrough'/>
我将 <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。
-cpu host
选项
/usr/bin/kvm-spice ... -machine ...,accel=kvm,... -cpu host ...