US11593168B2ActiveUtilityA1

Zero copy message reception for devices via page tables used to access receiving buffers

Assignee: RED HAT INCPriority: Jun 26, 2019Filed: Jun 26, 2019Granted: Feb 28, 2023
Est. expiryJun 26, 2039(~12.9 yrs left)· nominal 20-yr term from priority
Inventors:Michael Tsirkin
G06F 2009/45583G06F 2209/503G06F 9/45558G06F 9/5016G06F 2009/45595G06F 9/5022
50
PatentIndex Score
0
Cited by
18
References
20
Claims

Abstract

Zero copy message reception for devices is disclosed. For example, a host has a memory, a processor, a supervisor, and a device with access to device memory addresses mapped in a device page table via an IOMMU. An application has access to application memory addresses and is configured to identify a first page of memory addressed by an application memory address to share with the device as a receiving buffer to store data received by the device for the application, where the first page is mapped to a first device memory address in a first device page table entry (PTE). A supervisor is configured to detect that the first application has disconnected from the device, and in response to detecting the application disconnecting, to update the first device PTE to address a second page instead of the first page.

Claims

exact text as granted — not AI-modified
The invention is claimed as follows: 
     
       1. A system comprising:
 a host with a memory, a processor, a supervisor, a guest memory, and a device with access to a plurality of device memory addresses via an input output memory management unit (IOMMU), wherein the plurality of device memory addresses are mapped to the guest memory in a device page table; and 
 a first application with access to a first plurality of application memory addresses (AMA), 
 wherein the first application is configured to execute on the processor to:
 identify a first page of the guest memory that is mapped, in a page table associated with the first application, to a first AMA of the first plurality of AMA, 
 wherein the first page of the guest memory is also mapped, in a first device page table entry (PTE) of the device page table, to a first device memory address of the plurality of device memory addresses; and 
 communicate, in a communication session with the device, by sharing the first page with the device as a first receiving buffer in the guest memory to store first data received by the device for the first application; 
 
 wherein the supervisor is configured to execute on the processor to:
 detect that the communication session is terminated such that the first application is disconnected from the device; and 
 responsive to detecting that the first application has disconnected from the device, update the first device PTE in the device page table to map the first device memory address to a second page of the guest memory instead of the first page of the guest memory and copy the first data of the first page of the guest memory to the second page of the guest memory as an extra copy of the first data. 
 
 
     
     
       2. The system of  claim 1 , wherein the device is one of a network interface and a storage device. 
     
     
       3. The system of  claim 1 , wherein the supervisor is one of a hypervisor and a host operating system. 
     
     
       4. The system of  claim 1 , wherein the device has access to respective pages of the guest memory mapped to each of the first plurality of application memory addresses via corresponding device memory addresses of the plurality of device memory addresses that are also mapped to the respective pages. 
     
     
       5. The system of  claim 1 , wherein the first application lacks access to the second page of the guest memory. 
     
     
       6. The system of  claim 1 , wherein the first application continues to access the first page of the guest memory after the first device memory address of the first device PTE is remapped to the second page of the guest memory. 
     
     
       7. The system of  claim 1 , wherein the supervisor discards data in the second page of the guest memory and reclaims the second page of the guest memory. 
     
     
       8. The system of  claim 1 , wherein a second application, which is any application accessing a network, identifies a third page of the guest memory to share with the device to store data received by the device for the second application. 
     
     
       9. The system of  claim 8 , wherein the second application is the first application that has been reconnected to the device at a point in time after the first device memory address of the first device PTE was mapped to the second page of the guest memory. 
     
     
       10. The system of  claim 9 , wherein second data is received after the first application disconnected and before the first application reconnected with the device as the second application, and access to the second data is provided to the first application. 
     
     
       11. The system of  claim 8 , wherein the second application is a different application from the first application, the device stores second data directed to the second application to the second page of the guest memory filling the second page of the guest memory, and the supervisor is further configured to:
 copy the second data to the third page of the guest memory; 
 reclaim the second page of the guest memory; and 
 update the first device memory address of the first device PTE to map to the third page of the guest memory instead of the second page of the guest memory. 
 
     
     
       12. The system of  claim 11 , wherein the device is configured with a limited quantity of receiving buffers, and only configures the third page of the guest memory as a second receiving buffer after the second page of the guest memory is reclaimed. 
     
     
       13. The system of  claim 12 , wherein the second application lacks access to the second page of the guest memory. 
     
     
       14. The system of  claim 1 , wherein a request to disconnect is associated with a request to reset a virtual device that emulates the device. 
     
     
       15. A method comprising:
 identifying, by a first application, a first page of a guest memory that is mapped, in a page table associated with the first application, to an application memory address (AMA), wherein the first page of the guest memory is accessible to the first application via the AMA, 
 wherein the first page of the guest memory is also mapped to a first device memory address, in a first device page table entry (PTE) of a device page table, associated with a device such that the first page is accessible to the device via the first device memory address; 
 communicating, in a communication session of the first application with the device, by sharing the first page with the device as a first receiving buffer in the guest memory to store first data received by the device for the first application; 
 detecting, by a supervisor, that the communication session is terminated such that the first application is disconnected from the device; and 
 responsive to detecting that the first application has disconnected from the device, updating, by the supervisor, the first device PTE to map the first device memory address to a second page of the guest memory instead of the first page of the guest memory, and copying, by the supervisor, the first data of the first page of the guest memory to the second page of the guest memory as an extra copy of the first data. 
 
     
     
       16. The method of  claim 15 , wherein the device has access, via corresponding device memory addresses in the device page table, to a plurality of guest memory pages in the guest memory, wherein the plurality of guest memory pages are also accessible to the first application via a plurality of AMAs associated with the first application. 
     
     
       17. The method of  claim 15 , wherein the first application lacks access to the second page of the guest memory and the first application continues to access the first page of the guest memory after the first device memory address of the first device PTE is remapped to the second page of the guest memory. 
     
     
       18. The method of  claim 15 , further comprising:
 discarding data in the second page of the guest memory; and 
 reclaiming the second page of the guest memory. 
 
     
     
       19. The method of  claim 15 , further comprising:
 identifying, by a second application, a third page of the guest memory to share with the device to store second data received by the device for the second application; 
 storing, by the device, the second data directed to the second application to the second page of the guest memory; 
 copying, by the supervisor, the second data to the third page of the guest memory; and 
 after copying the second data, updating, by the supervisor, the first device memory address of the first device PTE to map to the third page of the guest memory instead of the second page of the guest memory, wherein the device stores third data directed to the second application to the third page of the guest memory. 
 
     
     
       20. A computer-readable non-transitory storage medium storing executable instructions, which when executed by a computer system, cause the computer system to:
 identify a first page of a guest memory, mapped to an application memory address (AMA) in a page table associated with an application, wherein the first page is accessible to the application via the AMA; 
 communicating, in a communication session of the application with a device, by sharing the first page with the device as a receiving buffer in the guest memory to store first data received by the device for the application, 
 wherein the first page in the guest memory is also mapped to a device memory address in a device page table entry (PTE) of a device page table associated with the device, wherein the first page is accessible to the device via the device memory address; 
 detecting, by a supervisor, that the communication session is terminated such that the application is disconnected from the device; and 
 responsive to detecting that the application has disconnected from the device, updating, by the supervisor, the device PTE in the device page table to map the device memory address to a second page of the guest memory instead of the first page of the guest memory, and copying, by the supervisor, the first data of the first page of the guest memory to the second page of the guest memory as an extra copy of the first data.

Join the waitlist — get patent alerts

Track US11593168B2 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.