Virtualized Performance Counters With Selective VM Allocation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing processor virtualization models offer only two options: allocating all performance counters to a virtual machine (VM) or none, lacking flexibility for selective allocation of performance counters between VMs and the hypervisor.
Innovation Solution
A flexible virtualization model allows a virtual machine monitor (VMM) to selectively allocate none, some, or all performance counters to VMs and itself, using a mixed virtualization approach with controls like PERF_VIRT and PERF_MASK to manage counter allocation.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If all performance counters are allocated to a virtual machine, then the VM has complete monitoring capability, but the hypervisor loses the ability to monitor system-wide performance
Solution Approach 1:
The performance counters are segmented and individually allocated to different virtual machines or the hypervisor based on selective allocation bits. Each counter can be independently assigned, allowing flexible distribution rather than all-or-nothing allocation, thus resolving the contradiction between monitoring capability and system control.
Solution Approach 2:
The allocation of performance counters is made dynamic through configurable selective allocation bits that can be set or cleared. This allows the system to adapt counter distribution at runtime based on workload requirements, providing flexibility while maintaining manageable control through software configuration rather than complex hardware logic.
2Adaptability or versatility
If performance counters are selectively allocated to virtual machines, then monitoring flexibility is improved, but more control mechanisms are required
Solution Approach 1:
The system uses parameter changes by setting or clearing selective allocation bits in configuration registers to control counter distribution. This simple binary parameter change mechanism enables flexible selective allocation without requiring complex control logic, as the hardware responds to straightforward bit-level configurations.
Solution Approach 2:
The same set of selective allocation bits serves multiple purposes: controlling which counters are available to VMs, determining hypervisor visibility, and managing monitoring rights. This multi-functional control structure reduces overall system complexity by consolidating multiple control functions into a single mechanism.
3Productivity
If performance counters are allocated to virtual machines, then process performance optimization is enabled, but VM exits may increase for counter access
Solution Approach 1:
The selective allocation bits are configured in advance before VM execution to pre-determine which performance counters are available to each VM. This preliminary configuration eliminates the need for runtime decisions and VM exits when counters are accessed, as the allocation status is already established in the configuration registers.
Solution Approach 2:
The virtual machine monitor and virtual machines use the pre-configured allocation bits to self-determine counter availability without requiring hypervisor intervention or VM exits. The system serves itself by using the configuration bits to manage counter access rights, reducing overhead and time loss from frequent VM exits.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
Techniques for flexible virtualization of performance monitoring are described. In an embodiment, an apparatus includes a plurality of performance monitoring hardware resources and an instruction decoder to decode a first instruction to access a first performance monitoring hardware resource of the plurality of performance monitoring hardware resources. In response to the first instruction being received by a virtual machine, the apparatus is to determine whether the first performance monitoring hardware resource is allocated to the virtual machine based on an allocation model to allow any set of the performance monitoring hardware resources to be allocated to the virtual machine, execute the first instruction within the virtual machine in response to a determination that the first performance monitoring hardware resource is allocated to the virtual machine, and raise an exception within the virtual machine in response to a determination that the first performance monitoring hardware resource is not allocated to the virtual machine.