# US 2021/0342176 A1 · Hypercall acceleration for nested virtual machines

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0342176 A1
- Document ID: US20210342176A1
- Status: Published application
- Kind: A1
- Application number: 16/866,510
- Filed: 2020-05-04
- Published: 2021-11-04
- Earliest claimed: 2020-05-04
- Assignees: Red Hat, Inc.
- Applicants: Red Hat, Inc.
- Inventors: Michael Tsirkin; Karen Noel
- Web page: https://patentgrep.com/patent/US20210342176A1

## CPC

- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 2009/45566: {Nested virtual machines}
- G06F 2009/45583: {Memory management, e.g. access or allocation}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Systems and methods for accelerating hypercalls for nested virtual machines. An example method may comprise executing, by a host computer system, a Level 0 hypervisor managing a Level 1 virtual machine (VM). The Level 0 hypervisor receives a first function component from a Level 2 hypervisor managing a Level 3 VM, where the first function component performs a first functionality associated with a hypercall issued by the Level 3 VM; stores the first function component in a memory space associated with the Level 0 hypervisor; detects the hypercall issued by the Level 3 VM; and responsive to detecting the hypercall, executes the first function component to modify a VM context for the Level 3 VM.

## Claims

### Claim 1

A method comprising:
executing, by a host computer system, a Level 0 hypervisor managing a Level 1 virtual machine (VM);
receiving, by the Level 0 hypervisor, a first function component from a Level 2 hypervisor managing a Level 3 VM, wherein the first function component performs a first functionality associated with a hypercall issued by the Level 3 VM;
storing the first function component in a memory space associated with the Level 0 hypervisor, wherein the first function component is associated with a first VM context for the Level 3 VM;
detecting, by the Level 0 hypervisor, the hypercall issued by the Level 3 VM; and
responsive to detecting the hypercall, executing, by the Level 0 hypervisor, the first function component to modify the first VM context.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
determining, by the Level 0 hypervisor, a completion status of the first function component; and
returning control to the Level 2 hypervisor in view of the completion status.

### Claim 3 (depends on 1)

The method of claim 1, further comprising:
receiving, by the Level 0 hypervisor, a second function component from the Level 2 hypervisor, wherein the second function component performs a second functionality associated with the hypercall issued by the Level 3 VM;
storing the second function component in the memory space associated with the Level 0 hypervisor, wherein the second function component is associated with a second VM context for a Level 2 VM managed by a Level 1 hypervisor; and
chaining, by the level 0 hypervisor, the second function component with the first function component.

### Claim 4 (depends on 3)

The method of claim 3, further comprising:
determining, by the Level 0 hypervisor, a completion status of the first function component; and
executing, by the Level 0 hypervisor, the second function component in view of the completion status, the second function component to modify the second VM context.

### Claim 5 (depends on 4)

The method of claim 4, further comprising:
determining, by the Level 0 hypervisor, a second completion status of the second function component; and
returning control to the Level 2 hypervisor in view of the second completion status.

### Claim 6 (depends on 3)

The method of claim 3, wherein the first functionality comprises a first set of instructions that perform a first modification of the first VM context.

### Claim 7 (depends on 6)

The method of claim 6, wherein the second functionality comprises a second set of instructions that perform a second modification of the second VM context, and wherein the second set of instructions translate the first modification of the first VM context into the second modification of the second VM context.

### Claim 8

A system comprising:
a memory; and
a processing device, operatively coupled to the memory, the processing device to:
execute, by a host computer system, a Level 0 hypervisor managing a Level 1 virtual machine (VM);
receive, by a Level 1 hypervisor managing a Level 2 VM, a first function component from a Level 2 hypervisor managing a Level 3 VM, wherein the first function component performs a first functionality associated with a hypercall issued by the Level 3 VM;
generate, by the Level 1 hypervisor, a second function component that performs a second functionality associated with the hypercall issued by the Level 2 VM, and wherein the second function component translates the first functionality to the second functionality;
chain, by the Level 1 hypervisor, the first function component with the second function component to generate a chain of function components; and
provide the chain of function components to the Level 0 hypervisor to cause the Level 0 hypervisor to store the chain of function components in a memory space associated with the level 0 hypervisor.

### Claim 9 (depends on 8)

The system of claim 8, wherein the processing device is further to:
receive, by the Level 2 hypervisor, instructions from the Level 3 VM pertaining to the first functionality;
validate, by the Level 2 hypervisor, the instructions from the Level 3 VM;
generate, by the Level 2 hypervisor, the first function component in view of the validated instructions; and
provide, by the Level 2 hypervisor, the first function component to the Level 1 hypervisor.

### Claim 10 (depends on 8)

The system of claim 8, wherein the processing device is further to:
receive, by the Level 1 hypervisor, instructions from the Level 2 VM pertaining to the second functionality;
validate, by the Level 1 hypervisor, the instructions from the Level 2 VM;
translate, by the Level 1 hypervisor, the instructions for the second functionality in view of the first functionality; and
generate, by the Level 1 hypervisor, the second function component in view of the validated instructions.

### Claim 11 (depends on 8)

The system of claim 8, wherein the processing device is further to:
determine that the first function component is a dependency of the second function component; and
configure the chain of function components in view of the dependency.

### Claim 12 (depends on 8)

The system of claim 8, wherein the processing device is further to:
determine that the first function component is not a dependency of the second function component; and
configure the chain of function components to indicate that the second function component is to be bypassed.

### Claim 13 (depends on 8)

The system of claim 8, wherein the processing device is further to:
responsive to detecting the hypercall issued by the Level 3 VM, causing the Level 0 hypervisor to execute one or more of the function components in the chain of function components.

### Claim 14

A non-transitory computer readable medium comprising instructions, which when accessed by a processing device, cause the processing device to:
execute, by a host computer system, a Level 0 hypervisor managing a Level 1 virtual machine (VM);
receive, by the Level 0 hypervisor, a first function component from a Level 2 hypervisor managing a Level 3 VM, wherein the first function component performs a first functionality associated with a hypercall issued by the Level 3 VM;
detect, by the Level 0 hypervisor, the hypercall issued by the Level 3 VM; and
execute, by the Level 0 hypervisor, the first function component to modify a first VM context for the Level 3 VM in view of the hypercall.

### Claim 15 (depends on 14)

The non-transitory computer readable storage medium of claim 14, wherein the processing device is further to:
determine, by the Level 0 hypervisor, a completion status of the first function component; and
return control to the Level 2 hypervisor in view of the completion status.

### Claim 16 (depends on 14)

The non-transitory computer readable storage medium of claim 14, wherein the processing device is further to:
store the first function component in a memory space accessible to the Level 0 hypervisor, wherein the first function component is associated with the first VM context for the Level 3 VM;
receive, by the Level 0 hypervisor, a second function component from the Level 2 hypervisor, wherein the second function component performs a second functionality associated with the hypercall issued by the Level 3 VM;
store the second function component in the memory space associated with the Level 0 hypervisor, wherein the second function component is associated with a second VM context for a Level 2 VM managed by a Level 1 hypervisor; and
chain, by the level 0 hypervisor, the second function component with the first function component.

### Claim 17 (depends on 16)

The non-transitory computer readable storage medium of claim 16, wherein the processing device is further to:
determine, by the Level 0 hypervisor, a completion status of the first function component; and
execute, by the Level 0 hypervisor, the second function component in view of the completion status, the second function component to modify the second VM context

### Claim 18 (depends on 17)

The non-transitory computer readable storage medium of claim 17, wherein the processing device is further to:
determine, by the Level 0 hypervisor, a second completion status of the second function component; and
return control to the Level 2 hypervisor in view of the second completion status

### Claim 19 (depends on 16)

The non-transitory computer readable storage medium of claim 16, wherein the first functionality comprises a first set of instructions that perform a first modification of the first VM context.

### Claim 20 (depends on 19)

The non-transitory computer readable storage medium of claim 19, wherein the second functionality comprises a second set of instructions that perform a second modification of the second VM context, and wherein the second set of instructions translate the first modification of the first VM context into the second modification of the second VM context.
