# US 11,308,230 B2 · Direct access to host memory for guests

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

- Number: US 11,308,230 B2
- Document ID: US11308230B2
- Status: Granted
- Kind: B2
- Application number: 16/259,595
- Filed: 2019-01-28
- Published: 2020-07-30
- Granted: 2022-04-19
- Earliest claimed: 2019-01-28
- Assignees: Red Hat, Inc.
- Applicants: Red Hat, Inc.
- Inventors: Stefan Hajnoczi; Vivek Goyal; David Alan Gilbert; Steven John Whitehouse; Miklos Szeredi
- Web page: https://patentgrep.com/patent/US11308230B2

## CPC

- G06F 21/6218: {to a system of files or objects, e.g. local or distributed file system or database}
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 9/546: {Message passing systems or structures, e.g. queues}
- G06F 12/0804: with main memory updating (G06F12/0806 takes precedence)
- G06F 12/1009: using page tables, e.g. page table structures
- G06F 21/53: by executing in a restricted environment, e.g. sandbox or secure virtual machine
- G06F 21/604: {Tools and structures for managing or administering access control systems}
- G06F 2009/45579: {I/O management, e.g. providing access to device drivers or storage}
- G06F 2209/548: Queue
- G06F 2212/151: Emulated environment, e.g. virtual machine
- G06F 2212/206: Memory mapped I/O
- G06F 2221/2141: Access rights, e.g. capability lists, access control lists, access tables, access matrices
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Direct access to host memory for guests is disclosed. For example, a system includes a processor, a host memory, a filesystem daemon, a guest including a storage controller, and a filesystem queue accessible to the filesystem daemon and the storage controller. The storage controller receives a file retrieval request associated with a file stored in the host memory and forwards the file retrieval request to the filesystem daemon by adding the file retrieval request to the filesystem queue. The filesystem daemon retrieves the file retrieval request from the filesystem queue, determines a host memory address (HMA) associated with the file, and causes the HMA to be mapped to a guest memory address (GMA). The guest accesses the file in the host memory with the GMA, and later terminates access to the file, where the filesystem daemon is then configured cause the GMA to be unmapped.

## Claims

### Claim 1

A system comprising:
a processor, a host memory, a hypervisor including a filesystem daemon, a first guest including a first storage controller and a first application, a second guest including a second storage controller and a second application, a first filesystem queue accessible to the filesystem daemon and the first storage controller, and a second filesystem queue accessible to the filesystem daemon and the second storage controller, wherein the filesystem daemon is configured to:
receive a first file retrieval request associated with a file stored in the host memory from the first storage controller via the first filesystem queue and a second file retrieval request associated with the file from the second storage controller via the second filesystem queue;
cause a host memory address (HMA) associated with the file to be mapped to a first guest memory address (GMA) of the first guest and a second GMA of the second guest;
wherein the first application is configured to:
access the file in the host memory with the first GMA; and
update the file with changes,
wherein responsive to the file being updated by the first application, the second application is configured to modify an execution state of the second application based on the changes, and
wherein the first file retrieval request includes an identifier of an identified part of the file to be accessed, and the filesystem daemon is configured to:
determine a memory offset associated with a starting position of the identified part in the host memory; and
adjust the first HMA with the memory offset allowing the application to directly access the identified part via the first GMA, wherein the first application's access to the file is limited to a segment of the file that includes the identified part.

### Claim 2 (depends on 1)

The system of claim 1, wherein when the first application updates the file, the first storage controller sends a memory synchronization request to the filesystem daemon via a high priority queue, and the filesystem daemon is configured to:
execute a flush operation on processor caches of the processor; and
execute a fence operation to commit the updated file to persistent storage, wherein the second application is restricted from updating the file while the flush operation and the fence operation are executing.

### Claim 3 (depends on 1)

The system of claim 1, wherein the first storage controller is a component of one of (i) a guest memory device that appears to applications executing on the first guest as a peripheral component interconnect device, and (ii) a driver of the guest memory device, and wherein the guest memory device is configured to provide access to files stored in the host memory.

### Claim 4 (depends on 1)

The system of claim 1, wherein one of the filesystem daemon and the hypervisor rejects a different file retrieval request to access a different file based on access permissions associated with the different file.

### Claim 5 (depends on 1)

The system of claim 1, wherein the first storage controller requests a lock on the file by sending a lock request via the first filesystem queue to the filesystem daemon prior to the first application modifying the file and a version counter of the file is updated whenever changes are saved to the file.

### Claim 6 (depends on 1)

The system of claim 1, wherein one of the filesystem daemon and the hypervisor unmaps the first GMA based on one of a memory capacity threshold, an access timeout, an address space threshold, and an unmapping request.

### Claim 7 (depends on 1)

The system of claim 1, wherein the first application accesses the file via a third GMA associated with the first application, which is translated to the first GMA with a guest page table.

### Claim 8 (depends on 1)

The system of claim 1, wherein the first application updates the file, and the filesystem daemon is configured to:
issue a synchronization request to the hypervisor associated with the file which causes the updated file to be saved to persistent storage.

### Claim 9

A method comprising:
receiving, by a filesystem daemon of a hypervisor executing on a processor, a first file retrieval request associated with a file stored in a host memory from a first storage controller of a first guest via a first filesystem queue and a second file retrieval request associated with the file from a second storage controller of a second guest via a second filesystem queue, wherein the first file retrieval request includes an identifier of an identified part of the file to be accessed;
causing, by the filesystem daemon, a host memory address (HMA) associated with the file to be mapped to a first guest memory address (GMA) of the first guest and a second GMA of the second guest;
accessing, by a first application of the first guest, the file in the host memory with the first GMA;
updating, by the first application, the file with changes;
responsive to the file being updated by the first application, modifying, by a second application of the second guest, an execution state of the second application based on the changes;
determining, by the filesystem daemon, a memory offset associated with a starting position of the identified part in the host memory; and
adjusting, by the filesystem daemon, the first HMA with the memory offset allowing the application to directly access the identified part via the first GMA, wherein the first application's access to the file is limited to a segment of the file that includes the identified part.

### Claim 10 (depends on 9)

The method of claim 9, further comprising:
when the first application updates the file, sending, by the first storage controller, a memory synchronization request to the filesystem daemon via a high priority queue;
executing, by the filesystem daemon, a flush operation on processor caches of the processor; and
executing, by the filesystem daemon, a fence operation to commit the updated file to persistent storage, wherein the second application is restricted from updating the file while the flush operation and the fence operation are executing.

### Claim 11 (depends on 9)

The method of claim 9, wherein the first storage controller is a component of one of (i) a guest memory device that appears to applications executing on the first guest as a peripheral component interconnect device, and (ii) a driver of the guest memory device, and wherein the guest memory device is configured to provide access to files stored in the host memory.

### Claim 12 (depends on 9)

The method of claim 9, further comprising rejecting, by one of the filesystem daemon and the hypervisor, a different file retrieval request to access a different file based on access permissions associated with the different file.

### Claim 13 (depends on 9)

The method of claim 9, further comprising requesting, by the first storage controller, a lock on the file by sending a lock request via the first filesystem queue to the filesystem daemon prior to the first application modifying the file, wherein a version counter of the file is updated whenever changes are saved to the file.

### Claim 14 (depends on 9)

The method of claim 9, further comprising unmapping, by one of the filesystem daemon and the hypervisor, the first GMA based on one of a memory capacity threshold, an access timeout, an address space threshold, and an unmapping request.

### Claim 15 (depends on 9)

The method of claim 9, further comprising accessing, by the first application, the file via a third GMA associated with the first application, which is translated to the first GMA with a guest page table.

### Claim 16 (depends on 9)

The method of claim 9, further comprising:
updating, by the first application, the file, and
issuing, by the filesystem daemon, a synchronization request to the hypervisor associated with the file which causes the updated file to be saved to persistent storage.

### Claim 17

A non-transitory computer readable medium storing instructions which, when executed, cause a processor to execute to:
receive, by a filesystem daemon of a hypervisor, a first file retrieval request associated with a file stored in a host memory from a first storage controller of a first guest via a first filesystem queue and a second file retrieval request associated with the file from a second storage controller of a second guest via a second filesystem queue, wherein the first file retrieval request includes an identifier of an identified part of the file to be accessed;
cause, by the filesystem daemon, a host memory address (HMA) associated with the file to be mapped to a first guest memory address (GMA) of the first guest and a second GMA of the second guest;
access, by a first application of the first guest, the file in the host memory with the first GMA;
update, by the first application, the file with changes;
responsive to the file being updated by the first application, modify, by a second application of the second guest, an execution state of the second application based on the changes;
determine, by the filesystem daemon, a memory offset associated with a starting position of the identified part in the host memory; and
adjust, by the filesystem daemon, the first HMA with the memory offset allowing the application to directly access the identified part via the first GMA, wherein the first application's access to the file is limited to a segment of the file that includes the identified part.

### Claim 18 (depends on 17)

The non-transitory computer readable medium of claim 17, the instructions further causing the processor to execute to reject, by one of the filesystem daemon and the hypervisor, a different file retrieval request to access a different file based on access permissions associated with the different file.

### Claim 19 (depends on 17)

The non-transitory computer readable medium of claim 17, the instructions further causing the processor to execute to request, by the first storage controller, a lock on the file by sending a lock request via the first filesystem queue to the filesystem daemon prior to the first application modifying the file, wherein a version counter of the file is updated whenever changes are saved to the file.

### Claim 20 (depends on 17)

The non-transitory computer readable medium of claim 17, the instructions further causing the processor to execute to unmap, by one of the filesystem daemon and the hypervisor, the first GMA based on one of a memory capacity threshold, an access timeout, an address space threshold, and an unmapping request.
