Guest initiated atomic instructions for shared memory page host copy on write
AssigneeRed Hat Israel, Ltd.
InventorsMichael Tsirkin, Andrea Arcangeli
Life of this patent
Estimating the term…
Abstract
A guest OS detects a DMA write request for a device assigned to the guest OS to perform a DMA write to a shared page of memory that has a write protection attribute to cause a protection page fault upon an attempt to write to the shared page of memory. The guest OS reads a portion of the shared page of memory from a location of that page, determines the value of the portion, and executes an atomic instruction that writes the value back to the location of the shared page of memory to trigger the page protection fault. Upon executing the atomic instruction, the guest OS sends the DMA write request to the device to cause the device to write to a writeable copy of the shared page of memory.
Claims20
A method comprising:
- detecting, by a processing device, a direct memory access (DMA) write request for a device assigned to a guest operating system to perform a DMA write to a shared page of memory, wherein the shared page of memory has a write protection attribute to cause a protection page fault upon an attempt to write to the shared page of memory;
- reading, by the processing device, a portion of the shared page of memory from a location of the shared page of memory;
- executing, by the processing device, an atomic instruction that writes a value of the portion of the shared page of memory back to the location of the shared page of memory to trigger the protection page fault in view of the write protection attribute;
- and
- upon executing the atomic instruction, sending, by the processing device, the DMA write request to the device to cause the device to write to a writable copy of the shared page of memory, the writable copy created responsive to the protection page fault.
A computing apparatus comprising:
- a memory to store instructions;
- and
- a processing device, operatively coupled to the memory, to execute the instructions, wherein the processing device is to:
- detect, by the processing device, a direct memory access (DMA) write request for a device assigned to a guest operating system to perform a DMA write to a shared page of memory, wherein the shared page of memory has a write protection attribute to cause a protection page fault upon an attempt to write to the shared page of memory;
- read, by the processing device, a portion of the shared page of memory from a location of the shared page of memory;
- execute, by the processing device, an atomic instruction that writes a value of the portion of the shared page of memory back to the location of the shared page of memory to trigger the protection page fault in view of the write protection attribute;
- and
- upon executing the atomic instruction, send, by the processing device, the DMA write request to the device to cause the device to write to a writable copy of the shared page of memory, the writable copy created responsive to the protection page fault.
A non-transitory computer readable storage medium, having instructions stored therein, which when executed by a processing device of a computer system, cause the processing device to:
- detect, by the processing device, a direct memory access (DMA) write request for a device assigned to a guest operating system to perform a DMA write to a shared page of memory, wherein the shared page of memory has a write protection attribute to cause a protection page fault upon an attempt to write to the shared page of memory;
- and
- execute, by the processing device, an atomic instruction that reads a portion of the shared page of memory from a location of the shared page of memory and writes a value of the portion of the shared page of memory back to the location of the shared page of memory to trigger the protection page fault in view of the write protection attribute.
Dependencies are inferred from the claim text.