Fast Stub for VM JMP Instruction Overhead Reduction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing Virtual Machine technologies face significant overhead in processing privileged but unsafe instructions, particularly with JMP instructions, due to the need for context switching and emulation, which results in a two-order-of-magnitude increase in processing time compared to native execution.

Innovation Solution

The implementation of a method that generates a frame of analyzed code, identifies potentially unsafe instructions, and replaces them with control transfers to a stub that checks the safety of the instructions, allowing safe instructions to be executed directly and unsafe ones to be emulated within the Virtual Machine Monitor context.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If JMP instructions are replaced by INT3 interrupt to switch context to VMM for handling, then safety of privileged but unsafe instructions is ensured, but processing time increases by two orders of magnitude (from 10-30 clock cycles to approximately 4,000 clock cycles)

Engineering Contradiction:
Improvesafety of privileged but unsafe instructionsVSAvoidprocessing time for JMP instructions
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The patent introduces a fast stub as an intermediary component between the guest code and the full VMM emulation context. The stub serves as a lightweight mediator that performs preliminary safety checks for potentially unsafe instructions like JMP, CALL, and RET. When the instruction is determined to be safe, the stub allows direct execution without full context switching. Only when the instruction is unsafe does the stub trigger a full VMM context switch. This intermediary approach resolves the contradiction by filtering out safe cases that would otherwise require expensive full emulation, thereby reducing processing time while maintaining safety through the stub's verification mechanism.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If full context switching to VMM is performed for every potentially unsafe instruction, then complete safety verification is achieved, but overhead increases significantly due to frequent context switches

Engineering Contradiction:
Improveverification of unsafe instructionsVSAvoidexecution efficiency of guest code
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent applies preliminary action by performing safety verification in advance through the fast stub before committing to full VMM context switching. The stub pre-checks potentially unsafe instructions (JMP, CALL, RET) to determine whether they require full emulation or can be executed directly. This preliminary filtering action separates safe instructions from unsafe ones, allowing the system to avoid unnecessary full context switches for safe instructions while ensuring thorough verification for unsafe ones. This resolves the contradiction by performing verification work incrementally - first a quick stub check, then full verification only when needed - thereby maintaining reliability while improving productivity.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS7856547B1Fast stub and frame technology for virtual machine optimization
Publication Date: 2010.12.21 PARALLELS INT GMBH
  • US7856547B1 patent drawing
  • US7856547B1 patent drawing
  • US7856547B1 patent drawing

AI summary

A method and system for handling of potential unsafe instructions and/or for handling transfers of control in a Virtual Machine, that includes generating a frame composed of pages of analyzed code based on original guest code; identifying instructions within the frame that transfer control (or are otherwise unsafe); replacing instructions that transfer the control with an interrupt that transfers control to a stub in non-privileged code; wherein the stub checks whether the control transfer (or instruction) is safe or unsafe, and (i) for unsafe control transfers/unsafe instructions, switches the context to Virtual Machine Monitor; and (ii) for safe control transfers, executes the control transfer in non-privileged mode. The instructions that transfer control can include any of JMP, CALL, RET and RET(n). The instructions that transfer control can also include interrupts.