Virtual Machine Timer Translation Layer for KVM Performance

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Kernel-based virtual machine (KVM) platforms face performance issues due to frequent virtual machine exits when using simulated timers, particularly when a virtual machine runs in TSC-Deadline mode and employs a local APIC timer, leading to significant impacts on virtual machine performance in business scenarios.

Innovation Solution

A timer processing method that determines the type of timer used by a physical machine before a virtual machine starts, adjusts the timer's time and deadline to match the virtual machine's requirements, and configures the adjusted timer for the virtual machine to prevent frequent exits.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If a virtual machine uses a local APIC timer and runs in TSC-Deadline mode, then the virtual machine can achieve precise timing control, but the virtual machine frequently exits to the physical machine causing performance degradation

Engineering Contradiction:
Improvetiming control precisionVSAvoidvirtual machine performance
Core Design Contradiction:
Measurement precisionVSProductivity

Solution Approach 1:

The patent introduces a timer translation layer that acts as an intermediary between the virtual machine's TSC-Deadline mode timer requirements and the physical machine's local APIC timer capabilities. This translation mechanism allows the virtual machine to operate in TSC-Deadline mode with precise timing control while the physical machine uses local APIC timers, eliminating frequent exits and performance degradation without sacrificing timing precision.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If software simulation is used to implement timers for virtual machines, then the virtual machine can run on the physical machine, but frequent virtual machine exits occur when deadlines are set

Engineering Contradiction:
Improvevirtual machine compatibilityVSAvoidvirtual machine performance
Core Design Contradiction:
Adaptability or versatilityVSProductivity

Solution Approach 1:

The patent changes the timer parameter representation and translation approach. Instead of using direct software simulation that causes frequent exits, the system translates timer parameters (deadline, period, initial value) between different timer models. This parameter transformation allows the virtual machine to maintain compatibility with TSC-Deadline mode while the physical machine executes using local APIC timer parameters, eliminating performance degradation.

Inventive Principle:
Principle #35Parameter changes

3Productivity

If the virtual machine timer is synchronized with the physical machine timer, then frequent exits are eliminated, but timer type compatibility must be maintained

Engineering Contradiction:
Improvevirtual machine performanceVSAvoidtimer configuration complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent segments the timer system into distinct translation layers: a virtual timer layer that handles TSC-Deadline mode operations, a translation layer that converts between different timer models, and a physical timer layer that interfaces with local APIC timers. This segmentation allows each layer to operate independently with its own optimizations, eliminating frequent exits while managing complexity through modular design.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS20240069953A1Timer processing method, apparatus, electronic device, and computer-readable storage medium
Publication Date: 2024.02.29 DOUYIN VISION CO LTD
  • US20240069953A1 patent drawing
  • US20240069953A1 patent drawing
  • US20240069953A1 patent drawing

AI summary

This disclosure discloses a timer processing method, an apparatus, an electronic device, and a computer-readable storage medium. The timer processing method includes: determining a type of a timer used by a physical machine before a virtual machine starts, wherein the virtual machine runs on the physical machine; determining a first time and a first deadline of the virtual machine which are before the virtual machine starts; in a case where the timer used by the physical machine is a first-type timer, adjusting a time of the first-type timer to a second time corresponding to the first time and adjusting a deadline of the first-type timer to a second deadline corresponding to the first deadline to obtain an adjusted first-type timer; and configuring the adjusted first-type timer as a timer of the virtual machine.