Programming interfaces for accurate dirty data tracking
Described herein is a method for tracking changes to memory locations made by an application. In one embodiment, the application decides to start tracking and sends a list of virtual memory pages to be tracked to an operating system via an interface. The operating system converts the list of virtual memory pages to a list of physical addresses and sends the list of physical addresses to a hardware unit which performs the tracking by detecting write backs on a coherence interconnect coupled to the hardware unit. After the application ends tracking, the application requests a list of dirty cache lines. In response to the request, the operating system obtains the list of dirty cache lines from the hardware unit and adds the list to a buffer that the application can read. In other embodiments, the operating system can perform the tracking without the application making the request.
1. A method for tracking changes made by an application, comprising:
starting tracking of an application by sending a command to a hardware unit to register a list of physical addresses for tracking, the list of the physical addresses representing locations in memory changeable by the application;
sending a request to the hardware unit for a list of dirty cache lines after tracking of the application is ended, the list of dirty cache lines being cache lines that were changed and are included in a list of cache lines corresponding to the list of physical addresses registered for tracking;
receiving the list of dirty cache lines from the hardware unit; and
adding the list of dirty cache lines to a buffer.
2. The method of claim 1 , wherein starting tracking includes:
receiving a list of virtual memory pages from the application; and
converting the list of virtual memory pages into the list of physical addresses.
3. The method of claim 2 , wherein the buffer is readable by the application.
4. The method of claim 1 , wherein the buffer is readable by an operating system and not the application.
5. The method of claim 1 , wherein the hardware unit tracks dirty cache lines by:
detecting a write back of a cache line on a coherence interconnect; and
adding the detected cache line to a list of dirty cache lines maintained by the hardware unit.
6. The method of claim 1 , wherein the hardware unit tracks cache lines corresponding to the list of physical addresses in response to receiving a command to register the list of physical addresses for tracking.
7. The method of claim 1 , wherein the hardware unit sends the list of dirty cache lines in response to the request for the list of dirty cache lines.
8. A non-transitory computer-readable medium containing instructions, which when executed by one or more processors, causes the processors to carry out a method for tracking changes made by an application, wherein the method comprises:
starting tracking of an application by sending a command to a hardware unit to register a list of physical addresses for tracking, the list of the physical addresses representing locations in memory changeable by the application;
sending a request to the hardware unit for a list of dirty cache lines after tracking of the application is ended, the list of dirty cache lines being cache lines that were changed and are included in a list of cache lines corresponding to the list of physical addresses registered for tracking;
receiving the list of dirty cache lines from the hardware unit; and
adding the list of dirty cache lines to a buffer.
9. The non-transitory computer-readable medium of claim 8 , wherein registering the list of physical addresses for tracking includes:
receiving a list of virtual memory pages from the application; and
converting the list of virtual memory pages into the list of physical addresses.
10. The non-transitory computer-readable medium of claim 9 , wherein the buffer is readable by the application.
11. The non-transitory computer-readable medium of claim 8 , wherein the buffer is readable by an operating system and not the application.
12. The non-transitory computer-readable medium of claim 8 , wherein the hardware unit tracks dirty cache lines by:
detecting a write back of a cache line on a coherence interconnect; and
adding the detected cache line to a list of dirty cache lines maintained by the hardware unit.
13. The non-transitory computer-readable medium of claim 8 , wherein the hardware unit tracks cache lines corresponding to the list of physical addresses in response to receiving a command to register the list of physical addresses for tracking.
14. The non-transitory computer-readable medium of claim 8 , wherein the hardware unit sends the list of dirty cache lines in response to the request for the list of dirty cache lines.
15. A computing system comprising:
one or more processors running an application and an operating system; and
a hardware unit coupled to the one or more processors, wherein the hardware unit is configured to track dirty cache lines;
wherein the operating system is configured to:
start tracking of an application by sending a command to a hardware unit to register a list of physical addresses for tracking, the list of the physical addresses representing locations in memory changeable by the application;
send a request to the hardware unit for a list of dirty cache lines after tracking of the application is ended, the list of dirty cache lines being cache lines that were changed and are included in a list of cache lines corresponding to the list of physical addresses registered for tracking;
receive the list of dirty cache lines from the hardware unit; and
add the list of dirty cache lines to a buffer.
16. The computing system of claim 15 , wherein the operating system being configured to register the list of physical addresses for tracking includes being configured to:
receive a list of virtual memory pages from the application; and
convert the list of virtual memory pages into the list of physical addresses.
17. The computing system of claim 16 , wherein the buffer is readable by the application.
18. The computing system of claim 15 , wherein the buffer is readable by the operating system and not the application.
19. The computing system of claim 15 , wherein the hardware unit being configured to track dirty cache lines includes being configured to track dirty cache lines corresponding to the physical addresses in response to receiving a command for registering the list of physical addresses for tracking.
20. The computing system of claim 15 , wherein the hardware unit being configured to track dirty cache lines includes being configured to:
detect a write back of a cache line on a coherence interconnect; and
add the detected cache line to a list of dirty cache lines maintained by the hardware unit.
21. The computing system of claim 15 , wherein the hardware unit is configured to send the list of dirty cache lines to the operating system in response to the request for the list of dirty cache lines.