How does one enable Intel Processor Tracing (IPT) in a virtualized environment?

ech*_*sys 6 virtualization trace kernel intel intel-pmu

I am attempting to run Alex Ionescu's WinIPT interface in a virtual machine, and having no success. (This is a Windows 10 Pro host running a Windows 10 VM and both are the 18363 update)

I have successfully built and run Intel's driver as well as Alex's toolchain on the host, and processed the trace with ptxed. I have also run Intel's cpuid utility, and verified that the INTEL_PROCESSOR_TRACE feature is active on the host. However, when I run the utility in a VM, it does not display the INTEL_PROCESSOR_TRACE flag, and indeed, the driver returns an error that the feature is not enabled.

I've attempted to run the same setup in several different virtual environments, including the latest versions of VirtualBox, VMWare Workstation, and Hyper-V.

When I enable the Hyper-V Platform, it silently disables the INTEL_PROCESSOR_TRACE feature on the host.

VMWare Workstation 不会直接禁用它,但是当我在启动 VM 后尝试在主机上再次运行跟踪工具时,它引发了 BSoD,所以我对此不抱太大希望。

VirtualBox 至少没有取消任何功能,但即使我启用了 VT-x 直通选项,它仍然没有设置启用 IPT 的标志。

根据微软的说法,理论上存在一个在 Hyper-V 中启用此功能的过程,尽管我遇到了上述问题,它最终在我的主机上被禁用:

在虚拟机中启用性能监控组件

有人让它发挥作用吗?我更喜欢当前环境中的解决方案(Windows 主机上的 Windows VM),但我希望获得在 Linux 上使用 perf 或任何其他方法的任何见解。我还发现 2017 年的一些帖子和问题表明“尚”不支持 IPT,但在过去一年左右的时间里没有任何支持。技术和架构似乎仍在不断发展,所以我真的很想知道是否有人以任何形式取得了成功,以及关于该做什么或避免做什么的任何见解。

其他资源:

英特尔处理器跟踪的背景: 处理器跟踪

编辑添加(2/10/2020)

仔细看看微软的说明,他们提到你需要“支持 IPT 和 PT2GPA 功能的英特尔处理器”才能在虚拟机中启用 IPT。 据英特尔称,他们列出的唯一支持 PT2GPA 的架构是 Ice Lake。

我当前使用的计算机运行的是早期的微架构(Coffee Lake),这可以解释我所看到的 IPT 在主机上运行良好的行为。任何人都可以确认他们可以在更新的处理器上运行吗?

Sir*_*bus 2

查看《Intel 64 and IA-32 Architectures Software Developer\xe2\x80\x99s Manual》,从“CHAPTER 35 INTEL PROCESSOR TRACE”开始。IPT CPU 功能确实具有虚拟机管理程序类型 1(硬件)支持,但似乎对其在虚拟机中的运行方式有一些限制。

\n\n

顺便说一句,我最初通过电话与 VMWare 代表讨论了缺乏 IPT 支持的问题,他没有给出任何结论性的答复,也没有通过电子邮件回复我。\n网上只有一两个论坛帖子VMWare 论坛上有这个主题。似乎有一些标志可以设置支持,但没有一个对我有用。\n阅读,它可能不会很快出现。

\n\n

到了 2020 年,我们可能都在同一条船上。\n如果我们想要商业虚拟机选项之一的支持,我们就必须不断询问。也许如果有足够多的询问,他们会认为这是一个商业上可行的功能。

\n\n

和/或对于任何能够完成这项任务的人,请在 VirtualBox 或其他开源解决方案之一中添加对其的支持。

\n\n

编辑:显然至少对于 Linux,KVM 现在有 IPT 支持。

\n