# US 2016/0253197 A1 · Dirty Page Tracking of Guest-Uncached Memory

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

- Number: US 2016/0253197 A1
- Document ID: US20160253197A1
- Status: Published application
- Kind: A1
- Application number: 14/634,204
- Filed: 2015-02-27
- Published: 2016-09-01
- Earliest claimed: 2015-02-27
- Assignees: Red Hat, Inc.
- Applicants: Red Hat, Inc.
- Inventors: Paolo Bonzini; Laszlo Ersek; Jonathan Masters
- Web page: https://patentgrep.com/patent/US20160253197A1

## CPC

- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 12/0808: with cache invalidating means (G06F12/0815 takes precedence)
- G06F 12/0893: Caches characterised by their organisation or structure
- G06F 2009/45583: {Memory management, e.g. access or allocation}
- G06F 2212/1041: Resource optimization
- G06F 2212/601: Reconfiguration of cache memory
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An example method of providing a dirty bitmap to an application includes receiving a request for a snapshot of an internal dirty bitmap. The internal dirty bitmap indicates whether a guest has updated one or more pages in guest memory since a previously received request for a snapshot of the internal dirty bitmap. The method also includes copying a set of bits of the internal dirty bitmap into a shared dirty bitmap, which is accessible by the hypervisor and application. The method further includes for each bit of the set of bits having a first value, setting the respective bit to a second value. The method also includes invalidating all cache lines in a set of pages corresponding to one or more bits having the first value in the shared dirty bitmap. The method further includes after invalidating the cache lines, providing the shared dirty bitmap to the application.

## Claims

### Claim 1

A method of providing a dirty bitmap to an application executable in a host machine, comprising:
receiving, by a hypervisor executable in a host machine, a request for a snapshot of an internal dirty bitmap stored at a first region of memory, the request being from an application that communicates with the hypervisor, and the internal dirty bitmap indicating whether a guest executable in the host machine has updated one or more pages in guest memory of the guest since a previously received request for a snapshot of the internal dirty bitmap;
copying a set of bits of the internal dirty bitmap into a shared dirty bitmap, the shared dirty bitmap being stored at a second region of memory and accessible by the hypervisor and application;
for each bit of the set of bits having a first value, setting the respective bit to a second value;
invalidating all cache lines in a set of pages corresponding to one or more bits having the first value in the shared dirty bitmap; and
after the invalidating, providing the shared dirty bitmap to the application.

### Claim 2 (depends on 1)

The method of claim 1, wherein the invalidating all cache lines in the set of pages marks the set of pages as not cached in the hypervisor.

### Claim 3 (depends on 1)

The method of claim 1, wherein a first set of bits of the shared dirty bitmap having the first value indicates that the guest has updated a page corresponding to the first set of bits since a previous request for a snapshot of the internal dirty bitmap was received, and wherein a second set of bits of the shared dirty bitmap having the second value indicates that the guest has not updated a page corresponding to the second set of bits since the previous request was received.

### Claim 4 (depends on 3)

The method of claim 3, wherein cache lines in a second set of pages corresponding to a bit having the second value are not invalidated.

### Claim 5 (depends on 1)

The method of claim 1, wherein the copying and setting includes in one or more atomic transactions:
copying the set of bits of the internal dirty bitmap into the shared dirty bitmap; and
for each bit of the set of bits having the first value, setting the respective bit to the second value in the internal dirty bitmap.

### Claim 6 (depends on 5)

The method of claim 5, wherein the invalidating includes after an atomic transaction has completed, invalidating all cache lines in the set of pages corresponding to one or more bits having the first value.

### Claim 7 (depends on 5)

The method of claim 5, wherein the invalidating includes after all of the one or more atomic transactions has completed, invalidating all cache lines in the set of pages corresponding to one or more bits having the first value.

### Claim 8 (depends on 5)

The method of claim 5, wherein the copying a set of bits includes copying one bit of the internal dirty bitmap per atomic transaction.

### Claim 9 (depends on 5)

The method of claim 5, wherein the copying a set of bits includes copying a word of the internal dirty bitmap per atomic transaction.

### Claim 10 (depends on 1)

The method of claim 1, further including:
starting a new snapshot of the internal dirty bitmap, the new snapshot storing only bits having the second value.

### Claim 11

A system for providing a dirty bitmap to an application executable in a host machine, comprising:
a first region of memory that stores an internal dirty bitmap indicating whether a guest executable in a host machine has updated one or more pages in guest memory of the guest since a previously received request for a snapshot of the internal dirty bitmap;
a hypervisor that receives a request for a snapshot of the internal dirty bitmap, wherein the request is from an application that communicates with the hypervisor; and
a dirty memory manager that copies a set of bits of the internal dirty bitmap into a shared dirty bitmap stored at a second region of memory, sets each bit in the internal dirty bitmap having a first value to a second value, invalidates all cache lines in a set of pages corresponding to one or more bits having the first value in the shared dirty bitmap, and provides the shared dirty bitmap to the application after the cache lines in the set of pages have been invalidated,
wherein the second region of memory is accessible by the hypervisor and application.

### Claim 12 (depends on 11)

The system of claim 11, wherein the application is a virtual machine monitor.

### Claim 13 (depends on 11)

The system of claim 11, wherein the second region of memory is mapped to the application.

### Claim 14 (depends on 11)

The system of claim 11, wherein the second region of memory is mapped to the hypervisor.

### Claim 15 (depends on 11)

The system of claim 11, wherein a page corresponding to a bit having the first value is a dirty page.

### Claim 16 (depends on 11)

The system of claim 11, wherein in each atomic transaction, the dirty memory manager (i) copies the set of bits of the internal dirty bitmap into the shared dirty bitmap, and (ii) for each bit of the set of bits having the first value, sets the respective bit to the second value in the internal dirty bitmap.

### Claim 17 (depends on 16)

The system of claim 16, wherein after a set of atomic transactions has completed, the dirty memory manager invalidates cache lines in the set of pages corresponding to one or more bits having the first value.

### Claim 18

A machine-readable medium comprising a plurality of machine-readable instructions that when executed by one or more processors is adapted to cause the one or more processors to perform a method comprising:
receiving, by a hypervisor executable in a host machine, a request for a snapshot of an internal dirty bitmap stored at a first region of memory, the request being from an application that communicates with the hypervisor, and the internal dirty bitmap indicating whether a guest executable in the host machine has updated one or more pages in guest memory of the guest since a previously received request for a snapshot of the internal dirty bitmap;
copying a set of bits of the internal dirty bitmap into a shared dirty bitmap, the shared dirty bitmap being stored at a second region of memory and accessible by the hypervisor and application;
for each bit of the set of bits having a first value, setting the respective bit to a second value;
invalidating all cache lines in a set of pages corresponding to one or more bits having the first value in the shared dirty bitmap; and
after the invalidating, providing the shared dirty bitmap to the application.

### Claim 19 (depends on 18)

The machine-readable medium of claim 18, wherein the invalidating all cache lines in the set of pages marks the set of pages as not cached in the hypervisor.

### Claim 20 (depends on 18)

The machine-readable medium of claim 18, wherein a first set of bits of the shared dirty bitmap having the first value indicates that the guest has updated a page corresponding to the first set of bits since a previous request for a snapshot of the internal dirty bitmap was received, and wherein a second set of bits of the shared dirty bitmap having the second value indicates that the guest has not updated a page corresponding to the second set of bits since the previous request was received.
