大网数据广告活动
Hyper-V与虚拟化

Enable Intel Performance Monitoring Hardware in a Hyper-V Virtual Machine

· 52CE 我爱测

How to enable Intel's Performance Monitoring Hardware in a Hyper-V Machine. Also touches on how enabling performance monitoring hardware effects live migration.

Intel processors contain features collectively called performance monitoring hardware (e.g. PMU, PEBS, LBR). These features are used by performance tuning software like Intel VTune Amplifier to analyze software performance. Prior to Windows Server 2019 and Windows 10 Version 1809, neither the host operating system nor Hyper-V guest virtual machines could use performance monitoring hardware when Hyper-V was enabled. Starting with Windows Server 2019 and Windows 10 Version 1809, the host operating system has access to performance monitoring hardware by default. Hyper-V guest virtual machines do not have access by default, but Hyper-V administrators may choose to grant access to one or more guest virtual machines. This document describes the steps required to expose performance monitoring hardware to guest virtual machines.

Requirements

To enable performance monitoring hardware in a virtual machine, you'll need:

  • An Intel processor with performance monitoring hardware (i.e. PMU, PEBS, LBR). Refer to this document from Intel to determine which performance monitoring hardware your system supports.
  • Windows Server 2019 or Windows 10 Version 1809 (October 2018 Update) or later
  • A Hyper-V virtual machine without nested virtualization that is also in the stopped state

To enable upcoming Intel Processor Trace (IPT) performance monitoring hardware in a virtual machine, you’ll need:

  • An Intel processor that supports IPT and the PT2GPA feature. [^1] Refer to this document from Intel to determine which performance monitoring hardware your system supports.
  • Windows Server version 1903 (SAC) or Windows 10 Version 1903 (May 2019 Update) or later
  • A Hyper-V virtual machine without nested virtualization that is also in the stopped state
  • PMU needs to be enabled via the command line using the command seen below.

[^1]: PT2GPA refers to the “Intel PT uses guest physical addresses” bit. This is described in 25.5.4.1 of the Intel SDM.

Enabling performance monitoring components in a virtual machine

To enable different performance monitoring components for a specific guest virtual machine, use the Set-VMProcessor PowerShell cmdlet while running as Administrator:

Note: The virtual machine generation must be 9.1 or higher. If nested virtualization is offered to the guest as well, then this needs 9.3 and up.

# Enable IPT
Set-VMProcessor MyVMName -Perfmon @("ipt", "pmu")
# Enable all components
Set-VMProcessor MyVMName -Perfmon @("ipt", "pmu", "lbr", "pebs")
# Disable all components
Set-VMProcessor MyVMName -Perfmon @()

Note: When enabling the performance monitoring components, if "pebs" is specified, then "pmu" must also be specified. PEBS is only supported on hardware that has a PMU Version >= 4. Also, any command that attempts to enable "ipt" must also specify "pmu".

Enabling a component that is not supported by the host's physical processors will result in a virtual machine start failure.

Effects of enabling performance monitoring hardware on save/restore, export, and live migration

Microsoft does not recommend live migrating or saving/restoring virtual machines with performance monitoring hardware between systems with different Intel hardware. The specific behavior of performance monitoring hardware is often non-architectural and changes between Intel hardware systems. Moving a running virtual machine between different systems can result in unpredictable behavior of the non-architectural counters.

Source: Microsoft Learn / Windows Server documentation by Microsoft and contributors (upstream author metadata: robinharwood). Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Server documentation
适用范围
Windows Server · Source date 11/30/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。