Dirty Page Sending Method, External Device, and Computing Device
By using page table entries in the address translation page table to register whether the memory page is dirty, the problem of low resource utilization caused by CPU polling registers is solved, and more efficient CPU resource utilization and dirty page reporting efficiency is achieved.
Patent Information
- Application Number
- CN202310936593.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-27
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2043-07-27
AI Technical Summary
In the prior art, the CPU acquires dirty pages through polling registers, resulting in a decrease in the available resources of the CPU and reducing the possibility of fully utilizing CPU resources.
Use the method of registering whether the memory page is dirty page by converting the page table entry in the address translation page table to avoid CPU polling the registers and improve CPU resource utilization.
This improves the utilization rate of CPU resources, reduces the possibility of memory pages being repeatedly registered, and improves the efficiency of dirty page reporting.
Smart Images

Figure CN117193931B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a dirty page sending method, an external device, and a computing device. Background Art
[0002] A virtual machine (VM) is a virtual environment created on a physical hardware system (either external or internal) that acts as a virtual computer system. It emulates its own complete set of hardware, including a CPU, memory, network interface, and storage. Through software called a hypervisor, users can separate and properly allocate the resources of the machine for use by the virtual machine.
[0003] Generally, a virtual machine (VM) can be migrated from one host computing system (i.e., the source host) to another host computing system (i.e., the destination host). To reduce the VM downtime caused by the migration process, the virtual machine in the source host does not stop running during the migration. Generally, the memory state of the virtual machine is synchronized between the source host and the destination host through an iterative copy method, that is: each time, only the content newly modified since the last copy dependency is transmitted to the destination physical machine. The VM can control external devices, such as a network card, or a disk. The external device can also cause changes in the content of the virtual machine's memory. Therefore, it is also necessary to obtain the dirty page situation caused by the external device. Since the external device does not pass through the Central Processing Unit (CPU) when modifying the memory, the CPU cannot perceive the dirty page situation caused by the external device. Therefore, it is required that the external device has the ability to report dirty pages, so that the CPU can perceive the dirty page situation of the external device.
[0004] In the related art, when an external device modifies the memory, it inputs the modified memory page (dirty page) to the CPU through a register; the CPU obtains the dirty page by polling the register and determines whether the external device can output the next dirty page.
[0005] However, the above solution using the polling method may reduce the available resources of the CPU and reduce the possibility of fully utilizing the CPU resources.
[0006] The information disclosed in this background art section is only intended to enhance the overall understanding of the present application and should not be regarded as an admission or any form of suggestion that this information constitutes prior art already known to those of ordinary skill in the art. Summary of the Invention
[0007] The embodiments of the present application provide a dirty page sending method, an external device, and a computing device. On the one hand, it is not necessary for the CPU to poll the register, which increases the possibility of making full use of CPU resources. On the other hand, when using the page table entries in the address translation page table to register whether the memory page is a dirty page, it is not required that the currently modified memory page is the same as the previously modified one.
[0008] In a first aspect, the embodiments of the present application provide a dirty page sending method, which is applied to an external device in a first computing device. The first computing device includes an address translation page table, and the address translation page table indicates the page table entries corresponding to the memory pages of the virtual machine. The page table entries indicate the physical addresses of the memory pages in the first computing device; the address translation page includes a first page table entry corresponding to a first memory page; the method includes:
[0009] Receiving a first piece of information, where the first piece of information indicates the data to be modified corresponding to the virtual machine; based on the first piece of information, determining to process the data to be modified in the first memory page; determining whether to register the first memory page as a dirty page in the first page table entry; if not, registering the first memory page as a dirty page in the first page table entry; and sending the information of the first memory page (such as the virtual page frame number) to the first computing device.
[0010] In this solution, on the one hand, it is not necessary for the CPU to poll the register, which increases the possibility of making full use of CPU resources. On the other hand, when using the page table entries in the address translation page table to register whether the memory page is a dirty page, it is not required that the currently modified memory page is the same as the previously modified one.
[0011] In a possible implementation, the external device is a non-volatile memory, and the first piece of information is a data operation request, and the data operation request indicates the data to be modified and the first memory page, and is used to request to process the data to be modified in the first memory page.
[0012] In a possible implementation, the external device is a network card, the first piece of information is a packet sent to the virtual machine, and the first memory page is the memory page of the virtual machine determined by the external device to write the packet.
[0013] In a possible implementation, the first memory page is divided into multiple sub-pages, and the information of the first memory page includes the address of the target sub-page, and the target sub-page is the sub-page in the first memory page that processes the data to be modified.
[0014] In a possible implementation, sending the information of the first memory page to the first computing device includes: recording the information of the first memory page in the dirty page information set stored locally; and sending the information in the dirty page information set to the first computing device. Exemplarily, the memory address is the physical address of the virtual machine.
[0015] In this solution, after caching the information of the memory page through the dirty page information set and then reporting it, before reporting, the memory pages that have been registered as dirty pages can be repeatedly modified without being registered as dirty pages again. After being reported to the computing device, the computing device will clear the information that registers the memory page as a dirty page. After that, the memory page may still be modified, and at this time, the memory page needs to be registered as a dirty page again. Therefore, by delaying the reporting through the dirty page information set cache, the possibility of the memory page being repeatedly registered can be reduced to a certain extent.
[0016] In an example of this implementation manner, sending the information in the dirty page information set to the first computing device includes: when the amount of information in the dirty page information set reaches a preset threshold, or when a query command from the first computing device is received, sending the information in the dirty page information set to the first computing device.
[0017] In a possible implementation manner, registering the first memory page as a dirty page in the first page table entry includes: setting a preset bit in the first page table entry to a preset value for indicating a dirty page, and the preset bit is the ignored bit in the page table entry.
[0018] In this solution, the registration of whether the memory page is a dirty page is implemented through the ignored bit in the page table entry, so that the external device can obtain whether the memory page is a dirty page through the direct memory access method.
[0019] In a possible implementation manner, the method further includes: when the first memory page is registered as a dirty page in the first page table entry, maintaining the situation where the first memory page is registered as a dirty page in the first page table entry.
[0020] In this solution, before the external device reports the dirty page, multiple modifications to a memory page are only registered once, and there is no need to report each time the memory page is modified, so that the efficiency of dirty page reporting can be improved to a certain extent.
[0021] In a possible implementation manner, the first information is the information received by the external device during the normal operation of the virtual machine when the virtual machine migrates to the second computing device.
[0022] In a possible implementation manner, the method further includes: based on the matching of the first identifier of the first memory page and the cached page table entry information, determining the first page table entry; wherein, the page table entry information includes the first page table entry and the first identifier corresponding to the first page table entry.
[0023] In this solution, through the caching method of the external device, the page table entry can be quickly determined, thereby improving the efficiency of judging whether the memory page is registered as a dirty page.
[0024] In an example of this implementation manner, the first memory page is the memory page modified under the first memory copy count; wherein, the first memory copy count indicates the number of times of copying the memory in the first computing device; the page table entry information is the information cached under the first memory copy count.
[0025] In this solution, by means of the page table entry information under the memory copy count, the accuracy of determining whether a memory page is registered as a dirty page is improved.
[0026] In a possible implementation manner, the first page table entry corresponds to a second memory page, the second memory page includes multiple memory pages, and the multiple memory pages include the first memory page.
[0027] In a possible case, the first page table entry is used to record whether each of the multiple memory pages is logged as a dirty page.
[0028] In this solution, by recording whether each of the multiple memory pages is registered as a dirty page through the page table entry, the utilization rate of the page table entry is improved.
[0029] In another possible case, the first page table entry registers the second memory page as a dirty page; the method further includes: updating the first page table entry to determine the updated first page table entry; wherein, the first memory page is not registered as a dirty page in the updated first page table entry; based on the updated first page table entry, it is determined that the first memory page is not registered as a dirty page in the first page table entry.
[0030] In this solution, when recording whether a memory page with a large space is registered as a dirty page through the page table entry, the memory page with a large space is split to determine whether the memory pages with a small space are registered as dirty pages, so as to flexibly adapt to various scenario requirements.
[0031] In a second aspect, an embodiment of the present application provides a dirty page sending method, which is applied to a first computing device, and the first computing device includes an external device; the first computing device includes an address translation page table, the address translation page table indicates the page table entry corresponding to the memory page of the virtual machine, and the page table entry indicates the physical address of the memory page in the first computing device; the address translation page includes a first page table entry corresponding to the first memory page; the method includes:
[0032] Receiving the information of the first memory page sent by the external device; wherein, the external device is used to receive the first information, and the first information indicates the data to be modified corresponding to the virtual machine; based on the first information, determining to process the data to be modified in the first memory page; determining whether the first memory page is registered as a dirty page in the first page table entry; if not, registering the first memory page as a dirty page in the first page table entry; sending the information of the first memory page to the first computing device; clearing the information registering the first memory page as a dirty page in the first page table entry; and processing the page data of the first memory page.
[0033] In this solution, on the one hand, there is no need for the CPU to poll the register, which increases the possibility of making full use of the CPU resources. On the other hand, when using the method of registering whether the memory page is a dirty page in the page table entry of the address translation page table, it is not required that the currently modified memory page is the same as the previous one. On the other hand, first clear the information indicating that the memory page registered in the page table entry is a dirty page, and then process the page data of the memory page, thereby reducing the possibility of missing the modified content of the memory page during the process of processing the page data of the memory page.
[0034] In a possible implementation manner, the first information is the information received by the external device during the normal operation of the virtual machine when the virtual machine migrates to the second computing device. Processing the page data in the first memory page includes: sending the page data in the first memory page to the second computing device.
[0035] Thirdly, the embodiment of the present application provides a dirty page sending device. The dirty page sending device includes several modules, and each module is used to execute each step in the dirty page sending method provided in the first aspect of the embodiment of the present application. The division of the modules is not limited here. For the specific functions executed by each module of the dirty page sending device and the beneficial effects achieved, please refer to the functions of each step in the dirty page sending method provided in the first aspect of the embodiment of the present application, which will not be elaborated here.
[0036] Exemplarily, the dirty page sending device is deployed in the external device of the first computing device. The first computing device includes an address translation page table, and the address translation page table indicates the page table entry corresponding to the memory page of the virtual machine. The page table entry indicates the physical address of the memory page in the first computing device. The address translation page includes a first page table entry corresponding to the first memory page, including:
[0037] An information receiving module, configured to receive the first information, where the first information indicates the data to be modified corresponding to the virtual machine;
[0038] A page determination module, configured to determine, based on the first information, to process the data to be modified in the first memory page;
[0039] A determination module, configured to determine whether the first memory page is registered as a dirty page in the first page table entry;
[0040] A registration module, configured to register the first memory page as a dirty page in the first page table entry if the first memory page is not registered as a dirty page in the first page table entry;
[0041] A sending module, configured to send the information of the first memory page to the first computing device.
[0042] In a possible implementation, the external device is a non-volatile memory, the first information is a data operation request for requesting modification of a first memory page.
[0043] In a possible implementation, the external device is a network card, the first information is a packet sent to a virtual machine, and the first memory page is the memory page of the virtual machine determined by the external device for writing the packet.
[0044] In a possible implementation, the sending module includes a caching unit and a sending unit; wherein,
[0045] The caching unit is configured to record the information of the first memory page into a set of dirty page information stored locally.
[0046] The sending unit is configured to send the information in the set of dirty page information to the first computing device.
[0047] In an example of this implementation, the sending unit is configured to send the information in the set of dirty page information to the first computing device when the amount of information in the set of dirty page information reaches a preset threshold or when a query command from the first computing device is received.
[0048] In a possible implementation, the registering module is configured to set a preset bit in the first page table entry to a preset value for indicating a dirty page, and the preset bit is an ignored bit in the page table entry.
[0049] In a possible implementation, the judging module is configured to maintain the situation where the first memory page is registered as a dirty page in the first page table entry when the first memory page is registered as a dirty page in the first page table entry.
[0050] In a possible implementation, the first information is the information received by the external device during the normal operation of the virtual machine during the migration of the virtual machine to the second computing device.
[0051] In a possible implementation, the judging module is configured to determine the first page table entry based on the matching of the first identifier of the first memory page and the cached page table entry information; wherein, the page table entry information includes the first page table entry and the first identifier corresponding to the first page table entry.
[0052] In an example of this implementation, the first memory page is the memory page modified under the first memory copy count; wherein, the first memory copy count indicates the number of copies of the memory in the first computing device; and the page table entry information is the information cached under the first memory copy count.
[0053] In a possible implementation, the first page table entry corresponds to a second memory page, the second memory page includes multiple memory pages, and the multiple memory pages include the first memory page.
[0054] In a possible case, the first page table entry is used to record whether multiple memory pages are respectively logged as dirty pages;
[0055] In another possible case, the first page table entry registers the second memory page as a dirty page; a judgment module is used to update the first page table entry and determine the updated first page table entry; wherein, the first memory page is not registered as a dirty page in the updated first page table entry; based on the updated first page table entry, it is determined that the first memory page is not registered as a dirty page in the first page table entry.
[0056] Fourthly, an embodiment of the present application provides a dirty page sending device, which includes several modules, and each module is used to execute each step in the dirty page sending method provided in the second aspect of the embodiment of the present application. The division of the modules is not limited here. For the specific functions executed by each module of the dirty page sending device and the beneficial effects achieved, please refer to the functions of each step in the dirty page sending method provided in the second aspect of the embodiment of the present application, which will not be elaborated here.
[0057] Exemplarily, the dirty page sending device is deployed in the first computing device, and the first computing device includes an address translation page table, which indicates the page table entry corresponding to the memory page of the virtual machine, and the page table entry indicates the physical address of the memory page in the first computing device; the address translation page includes the first page table entry corresponding to the first memory page; the device includes:
[0058] A receiving module, configured to receive information of the first memory page sent by an external device; wherein, the first memory page is registered as a dirty page in the first page table entry;
[0059] A clearing module, configured to clear the information that the first memory page is registered as a dirty page in the first page table entry;
[0060] A processing module, configured to process the page data of the first memory page.
[0061] In a possible implementation manner, the first information is the information received by the external device during the normal operation of the virtual machine during the migration of the virtual machine to the second computing device; the processing module is configured to send the page data in the first memory page to the second computing device.
[0062] Fifthly, an embodiment of the present application provides a dirty page sending device, including: at least one memory, configured to store a program; at least one processor, configured to execute the program stored in the memory, and when the program stored in the memory is executed, the processor is configured to execute the method provided in the second aspect.
[0063] Sixth aspect, an embodiment of the present application provides a dirty page sending device, which runs computer program instructions to execute the method provided in the second aspect. Exemplarily, the device may be a chip or a processor.
[0064] In one example, the device may include a processor, which may be coupled to a memory, read instructions in the memory, and execute the method provided in the second aspect according to the instructions. Among them, the memory may be integrated in the chip or the processor, or may be independent of the chip or the processor.
[0065] Seventh aspect, an embodiment of the present application provides an external device, which is used to execute the method provided in the first aspect. Exemplarily, the external device may be a network card or a hard disk.
[0066] Eighth aspect, an embodiment of the present application provides a first computing device, which is used to execute the method provided in the second aspect.
[0067] Exemplarily, the first computing device includes: a processor and an external device;
[0068] The external device is used to receive first information, where the first information indicates data to be modified corresponding to a virtual machine; based on the first information, determine to process the data to be modified in the first memory page; determine whether to register the first memory page as a dirty page in the first page table entry; if not, then register the first memory page as a dirty page in the first page table entry; send information of the first memory page to the processor;
[0069] The processor is used to receive the information of the first memory page sent by the external device; clear the information registering the first memory page as a dirty page in the first page table entry; process the page data of the first memory page.
[0070] In a feasible implementation manner, the first information is information received by the external device during the normal operation of the virtual machine when the virtual machine migrates to the second computing device; the processor is used to send the page data in the first memory page to the second computing device.
[0071] Ninth aspect, an embodiment of the present application provides a computer storage medium, in which instructions are stored. When the instructions run on a computer, the computer is caused to execute the method provided in the first aspect, or execute the method provided in the second aspect.
[0072] Tenth aspect, an embodiment of the present application provides a computer program product containing instructions. When the instructions run on a computer, the computer is caused to execute the method provided in the first aspect, or execute the method provided in the second aspect. Description of the Drawings
[0073] Figure 1 It is a schematic structural diagram of a computing device provided by an embodiment of the present application;
[0074] Figure 2 It is a schematic diagram of memory address translation provided by an embodiment of the present application;
[0075] Figure 3a It is a schematic diagram of an EPT page table provided by an embodiment of the present application;
[0076] Figure 3b It is a schematic diagram of querying the physical address of the host machine through the EPT page table provided by an embodiment of the present application;
[0077] Figure 4a It is a flowchart of a dirty page sending method provided by an embodiment of the present application Figure 1 ;
[0078] Figure 4b It is a flowchart of a dirty page sending method provided by an embodiment of the present application Figure 2 ;
[0079] Figure 4c It is Figure 4a and Figure 4b A scenario example diagram of the dirty page sending method provided;
[0080] Figure 5a It is Figure 4c A scenario schematic diagram for determining the first page table entry in Figure 1 ;
[0081] Figure 5b It is Figure 4c A scenario schematic diagram for determining the first page table entry in Figure 2 ;
[0082] Figure 5c It is Figure 4c The third scenario schematic diagram for determining the first page table entry in
[0083] Figure 5d It is Figure 4c A scenario example diagram of the dirty page sending method provided;
[0084] Figure 6a It is Figure 4c A scenario schematic diagram for reporting the VPN of the first memory page to the host in Figure 1 ;
[0085] Figure 6b It is Figure 4c A scenario schematic diagram for reporting the VPN of the first memory page to the host in Figure 2 ;
[0086] Figure 6c It is Figure 4cSchematic diagram three of reporting the VPN of the first memory page to the host;
[0087] Figure 6d Yes Figure 4c Schematic diagram four of reporting the VPN of the first memory page to the host;
[0088] Figure 7 Schematic structural diagram of a dirty page reporting system provided by an embodiment of the present application;
[0089] Figure 8a Schematic flowchart three of a dirty page sending method provided by an embodiment of the present application;
[0090] Figure 8b Schematic flowchart four of a dirty page sending method provided by an embodiment of the present application;
[0091] Figure 9 Yes Figure 8a And Figure 8b Schematic diagram of the scenario of the dirty page sending method provided;
[0092] Figure 10 Schematic structural diagram of a dirty page sending device provided by an embodiment of the present application Figure 1 ;
[0093] Figure 11 Schematic structural diagram of a dirty page sending device provided by an embodiment of the present application Figure 2 。 Detailed implementation manners
[0094] In order to make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
[0095] In the description of the embodiments of the present application, words such as "exemplary", "for example", or "for illustration" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary", "for example", or "for illustration" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary", "for example", or "for illustration" is intended to present relevant concepts in a specific manner.
[0096] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, B exists alone, and both A and B exist simultaneously. In addition, unless otherwise specified, the meaning of the term "plurality" refers to two or more. For example, a plurality of systems refers to two or more systems, and a plurality of terminals refers to two or more terminals.
[0097] In addition, the terms "first" and "second" are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the technical features indicated. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. The terms "comprise", "include", "have" and their variants all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0098] Hereinafter, some terms in this embodiment will be explained. It should be noted that these explanations are for the convenience of those skilled in the art and do not constitute a limitation on the scope of protection required by this application.
[0099] Central Processing Unit (CPU for short): The operation and control core of a computer system, which is the final execution unit for information processing and program operation.
[0100] Live Migration: Also known as dynamic migration or real-time migration, that is, virtual machine save / restore. Usually, the running state of the entire virtual machine is completely saved, and at the same time, it can be quickly restored to the original hardware platform or even a different hardware platform. After restoration, the virtual machine still runs smoothly and users will not notice any differences.
[0101] Direct Memory Access (DMA): A function provided by some computer bus architectures that enables data to be directly sent from an attached device (such as a disk drive) to the memory of the computer motherboard.
[0102] External device: A general term for input / output devices and external memories in a computer system. It plays a role in transmitting, relaying, and storing data and information. It is an important part of a computer system. Peripherals involve any device other than the computer core (CPU and memory), and peripherals are used to interact with the computer core for data and information, achieving the functions of transmission, relay, and storage.
[0103] Virtual address (VA, virtual address): For a running process, the addresses pointed to by pointers in code instructions, function entry addresses, return addresses, etc., which are addresses that the process can directly see, belong to virtual addresses.
[0104] Physical address (PA, physical address): For a physical CPU, when the CPU executes specific instructions, it needs to obtain specific data information in some addresses. At this time, the addresses it accesses belong to physical addresses.
[0105] Virtual Machine (VM): A special software. A virtual machine can create an environment between a computer platform and an end user, so that the end user can operate other software based on the environment created by the virtual machine. From the perspective of an application program, the program runs on the virtual machine in the same way as it runs on its corresponding physical computer.
[0106] Virtual Machine Monitor (VMM): A special software. The VMM can manage and externally monitor the VM. Additionally, the VMM is also called a hypervisor (management program).
[0107] Host physical page: The physical storage space is divided into physical pages (Physical Page, PP), also known as page frames, abbreviated as real pages, with a size of P = 2^n bytes. It is used to store the memory addresses of the instruction stream and data. In the embodiments of the present application, the host physical page is simply referred to as the physical page.
[0108] Page frame number (PFN): The so-called page frame refers to the physical memory. The physical memory is divided into regions of page size one by one, and each page is numbered, and this number is the PFN. Assuming the physical memory starts from address 0, then the page frame with PFN equal to 0 is the page starting from address 0 (physical address). Assuming the physical memory starts from address x, then the first page frame number is (x >> PAGE_SHIFT).
[0109] Virtual Page (VP): By dividing the virtual storage space into virtual pages (Vitual Page, VP) of fixed size, abbreviated as virtual pages, and the size of each virtual page is P = 2^n bytes. In the embodiments of the present application, the virtual pages of the virtual machine are referred to as memory pages.
[0110] Virtually page number (abbreviated as VPN): The page number of the virtual page (VP), which can also be considered as the virtually page number.
[0111] Guest Physical Address (GPA): In the embodiments of the present application, it is called the virtual machine physical address, such as the virtual page number (VPN) of the virtual page.
[0112] Guest Virtual Address (GVA) of the guest process: In the embodiments of the present application, it is called the virtual machine virtual address.
[0113] Host Physical Address (HPA): The actual physical address of the memory. For example, it can be the page frame number (PFN) of a physical page.
[0114] Extended page - table (EPT): A mechanism for implementing the conversion from guest physical address (GPA) to host physical address (HPA); on Intel CPUs, this mechanism is called EPT, and on AMD CPUs, this mechanism is called Nested Page Tables (NPT). In the embodiments of this application, the term EPT is uniformly used. In a system that supports EPT, the physical address conversion from guest physical address (GPA) to host physical address (HPA) is achieved through a series of EPT page - table structures.
[0115] Dirty page: A concept in the Linux kernel. Since the read - write speed of the hard disk is much slower than that of the memory, the system pre - places the data that is read and written frequently into the memory in advance to improve the read - write speed. This is called caching. Linux uses pages as the unit of caching. When a process modifies the data in the cache, the page is marked as a dirty page by the kernel.
[0116] Packet: The data unit for exchange and transmission in a network, that is, the data block that a site wants to send at one time. A packet contains the complete data information to be sent, and its length varies greatly, with no limit and being variable.
[0117] The embodiments of this application provide a computing device. As Figure 1As shown, the computing device 100 includes a host 101 and an external device 102. The host 101 includes hardware (CPU and memory), on which a virtual machine monitor (VMM) and several virtual machines (VMs) are deployed. Among them, the virtual machine (VM) is equivalent to a host and includes an operating system and several applications. Exemplarily, the host may include 2 virtual machines (VMs). One virtual machine (VM) includes the operating system Windows and N applications, and the other virtual machine (VM) includes the operating system Linux and M applications. Among them, the external device 102 is a device for data interaction with the host 101. For example, a network card and a non-volatile memory. Exemplarily, the non-volatile storage may be a hard disk, and the hard disk may include a solid state disk (Solid State Disk or Solid State Drive, SSD) and / or a hard disk drive (Hard Disk Drive, HDD). It should be noted that multiple virtual machines can be created on one host 100, and the number of virtual machines created depends on the hardware configuration of the host 100 itself and the specifications of the virtual machines to be created. In a possible application scenario, the host 101 may be a server that provides various cloud services.
[0118] Among them, virtualization technology introduces a new software layer, namely the virtual machine monitor (VMM), in the host 101. The virtual machine monitor (VMM) provides the required runtime environment abstraction for the virtual machines, and at the same time can control and manage the access and use of the virtual machines to real physical resources, such as the CPU, memory, and external devices, etc., and virtualize the underlying hardware resources, such as memory virtualization and CPU virtualization, so as to abstract them into corresponding virtual device interfaces for the virtual machines to use. Correspondingly, each virtual machine has its own virtual hardware (such as CPU, memory, and external devices, etc.) to provide an independent virtual machine execution environment.
[0119] In the technology of memory virtualization, memory address translation is one of the bases of memory virtualization. The purpose of memory address translation is to provide a virtual machine with a memory space starting from zero and being continuous, and it is necessary to effectively isolate, schedule, and share memory resources among virtual machines. To achieve this goal, the VMM introduces a new address space, namely the Guest Physical Address (GPA). This address space is not a real physical address space. It is just a mapping of the host memory address translation space in the virtual machine address space. For each virtual machine running on the host, it can see an independent, continuous guest physical address starting from zero. However, for the host, the guest physical addresses are not necessarily continuous, and the guest physical addresses may be mapped to several discontinuous host physical addresses. The main task of memory virtualization is to implement the virtualization of the virtual machine address space. After introducing the guest physical address space, memory virtualization supports the virtualization of the address space through two address translations. As Figure 2 shown, when performing address translation, it is necessary to translate from the Guest Virtual Address (GVA) to the Guest Physical Address (GPA), and then from the Guest Physical Address (GPA) to the Host Physical Address (HPA). Among them, the translation from the guest physical address (GPA) to the host physical address (HPA) is usually implemented by a page table. In the embodiments of this application, this page table is referred to as the address translation page table and is located in the Virtual Machine Monitor (VMM).
[0120] For the convenience of description and distinction, the address translation page table is first introduced.
[0121] The address translation page table is used to store the correspondence between the guest physical address (GPA) and the host physical address (HPA). It should be noted that the address translation page table is a two-dimensional page table (2-dimension page table). In virtual machine technology, the two-dimensional page table is used for the mapping from the guest physical address (GPA) to the host physical address (HPA). For example, it can be an Extended Page Table (EPT), a Stage-2 Page Table (SPT), etc.
[0122] Exemplarily, the address translation page table can be an EPT page table. The EPT page table includes multiple levels of page tables, and the number of levels of the page table can be determined according to the size of the memory page. For example, when the size of the physical page is 4k, the EPT page table includes 4 levels of page tables. Another example is that when the size of the physical page is 2M, the EPT page table includes 3 levels of page tables. For example, as Figure 3aAs shown, the EPT page table may include a 4-level page table, a 3-level page table, a 2-level page table, and a 1-level page table. Among them, the 4-level page table has one page; the 3-level page table may have 512 pages (only two pages are shown in the figure); the 2-level page table may have 512 * 512 = 262144 pages (only four pages are shown in the figure); the 1-level page table may have 262144 * 512 = 134217728 pages (only eight pages are shown in the figure). Among them, each page may include 512 entries (only two entries are shown in Figure 3), and each entry is 8 bytes. That is to say, each page has 512 * 8 = 4096 bytes, that is, each page is 4k. Among them, each entry of the 4-level page table corresponds to each page of the 3-level page table. Similarly, each entry of the 3-level page table corresponds to each page of the 2-level page table, each entry of the 2-level page table corresponds to each page of the 1-level page table, and each entry of the 1-level page table corresponds to each page of the physical page. In the embodiments of the present application, the entries of the first level are called page table entries.
[0123] Next, the content of the page table entry is introduced. Specifically, as Figure 3b shown, the page table entry includes the physical page base address (which can be considered as the host physical address (HPA) in the embodiments of the present application), the ignore bit (the bit that the CPU does not care about), and the concern bit (the bit that the CPU cares about). The ignore bit can be configured by the user and is some flexible and configurable bits.
[0124] Next, it is introduced how the EPT page table indicates the correspondence between the virtual machine physical address (GPA) and the host physical address (HPA), and how the CPU determines the host physical address (HPA) corresponding to the virtual machine physical address (GPA) according to the EPT.
[0125] In the virtual machine, all addresses are virtual addresses, which are converted by the CPU into the virtual machine physical address (GPA) based on the information stored in a set of tables maintained by the VMM. To perform this conversion, the virtual storage space is usually divided into blocks that can be called "virtual pages (VP)". In the embodiments of the present application, these virtual pages (VP) are called memory pages. These memory pages can be of the same size, and each memory page is assigned a unique virtual page number (VPN), and each memory page corresponds to a physical page. The virtual page number (VPN) is used in the virtual address; correspondingly, the virtual machine physical address (GPA) may include the virtual page number (VPN). The CPU can convert the virtual page number (VPN) into the page frame number (PFN) of the physical page through one or more EPT page tables. Correspondingly, the EPT page table indicates the correspondence between the virtual page number (VPN) of the memory page and the page frame number (PFN) of the physical page. Among them, the virtual page number (VPN) can be understood as the address of the memory page, and the page frame number (PFN) can be understood as the address of the physical page.
[0126] In specific implementation, as Figure 3bAs shown, the CPU determines the page frame number (PFN) of the physical page corresponding to the virtual machine physical address (GPA) level by level according to the virtual page number (VPN) in the virtual machine physical address (GPA) and the page tables at all levels in the EPT page table. For each level of page table, both the number of pages of this level of page table and the entry of this page need to be determined. The number of pages of this level of page table can be determined according to the entry of the previous level of page table. For example, the entry of this page can be determined according to the decimal value converted from the virtual machine physical address (GPA) in binary. It should be noted that the physical address of the top-level page of the EPT page table is provided by the Extended Page Table Pointer (EPTP) field.
[0127] It should be noted that the above EPT page table is only an example of the address conversion page and does not constitute a specific limitation. For the convenience of description, the embodiments of the present application are described by taking the EPT page table as an example. Any page table with a structure similar to the EPT page table can apply the solution provided by the embodiments of the present application.
[0128] It should be noted that the virtual machine monitor (VMM) can also set various software for providing services. As Figure 1 shown, it can include page table management software, and the page table management software can assist in implementing the dirty page sending method provided by the embodiments of the present application. In addition, the host 101 can set a dirty page processing service, and this dirty page processing service can also assist in implementing the dirty page sending method provided by the embodiments of the present application. In some possible cases, as Figure 1 shown, the dirty page processing service can be set outside the virtual machine monitor (VMM). In other possible cases, the dirty page processing service can be set inside the virtual machine monitor (VMM). The embodiments of the present application do not intend to limit the relationship between the dirty page processing service and the virtual machine monitor (VMM), and can be specifically designed in combination with actual requirements.
[0129] Based on this, the embodiments of the present application propose a technical solution for dirty page reporting.
[0130] This method uses the page table entries in the address translation page table to record whether the corresponding memory page is a dirty page; where the corresponding memory page is the memory page of the virtual machine indicated by the page table entry. Subsequently, for the external device 102 controlled by the virtual machine, when the external device 102 modifies the memory page, it can detect whether the page table entry corresponding to the memory page in the address translation page table registers the memory page as a dirty page. If it has been registered, it will not be registered again; if it has not been registered, it will register the memory page as a dirty page through the page table entry corresponding to the memory page, and report the information of the memory page (used to identify the memory page, such as the virtual page number (VPN)) to the host 101. In this way, on the one hand, there is no need for the CPU to poll the register, which improves the possibility of making full use of the CPU resources; on the other hand, when using the page table entries in the address translation page table to register whether the memory page is a dirty page, it is not required that the currently modified memory page is the same as the previously modified one; on the third hand, before reporting, multiple modifications to a memory page are only registered once, thus improving the efficiency of dirty page reporting to a certain extent. This is only a brief description of the method, and for the detailed content of this method, please refer to the following description.
[0131] It should be noted that in specific implementation, the external device 102 can receive the information sent by the virtual machine of the host 101 or other devices to the virtual machine (for the convenience of description and distinction, it can be called the first information), and the first information indicates the data to be modified. During the process of processing the first information, the data to be modified is processed in the memory page.
[0132] In an example, the external device 102 can be a hard disk; the first information can be an external operation request; in specific implementation, the external device 102 can receive the data operation request sent by the host 101, and the external device 102 can process the data operation request and modify the memory page.
[0133] Exemplarily, when the data operation request is deletion or modification, the external device 102 modifies the memory page by means of DMA to perform data deletion or modification; when the data operation request is insertion, the external device 102 needs to determine the memory page for writing data and modifies the memory page by means of DMA to implement data insertion; since the host 101 does not know the result of the external device 102 processing the data operation request, it is necessary to report the dirty page to the host 101 so that the host 101 can know the memory page modified by the external device 102.
[0134] Exemplarily, the data operation request may indicate an operation of deleting data, updating data, or writing data to a memory page. At this time, the external device 102 determines the memory page indicated by the data operation request and modifies the memory page. Since the host 101 does not know whether the external device 102 processes according to the data operation request, it is necessary to report the dirty page to the host 101 so that the host 101 knows that the external device 102 has modified the memory page.
[0135] In one example, the external device 102 may be a network card; the first information may be a packet; in a specific implementation, the external device 102 may receive a packet sent by another device. Then, it is necessary to determine the memory page for writing the packet, modify the memory page by DMA, and write the packet sent by the other device to the host 101; exemplarily, the host 101 will send a data write instruction and the range of the memory page where data can be written to the external device 102. The data write instruction instructs the external device 102 to write the data to the memory page when the data is received; correspondingly, the external device 102 can select a memory page from the memory pages where data can be written and write the packet. Since the host 101 does not know where the external device 102 stores the packet sent by the other device to the host 101, it is necessary to report the dirty page to the host 101 so that the host 101 knows the memory page where the external device 102 stores the packet.
[0136] Exemplarily, the other device may be a terminal, or another computing device 100, or a device in the computing device 100, such as another network card, another host, etc. The terminal may be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices.
[0137] The following part will elaborate on the preferred embodiments of the present application in conjunction with the accompanying drawings.
[0138] Figure 4a It is a schematic flowchart of the dirty page sending method provided by the embodiment of the present application. This embodiment can be applied to the computing device 100. The computing device 100 runs a virtual machine. The host 101 of the computing device includes an address translation page table; the address translation page table indicates the correspondence between the address of the memory page (which can be understood as the virtual machine physical address (GPA) in the embodiment of the present application, such as the virtual page number (VPN)) and the physical address of the physical page (which can be understood as the host physical address (HPA) in the embodiment of the present application); in a specific implementation, the address translation page table includes page table entries corresponding to the memory pages of the virtual machine, and the page table entries indicate the physical address (the address of the physical page) of the memory page in the host 101; including the first page table entry corresponding to the first memory page; then as Figure 4a , the dirty page sending method provided by the embodiment of the present application at least includes the following steps:
[0139] Step 401: The host 101 sends a first piece of information to the external device 102, and the first piece of information indicates the data to be modified corresponding to the virtual machine.
[0140] Exemplarily, when the external device 102 is a hard disk, the virtual machine running on the host 101 can determine the first piece of information and send it to the external device 102. The first piece of information may be a data operation request, and the data operation request is used to indicate deleting, updating, or inserting data. Exemplarily, the first piece of information may indicate a first memory page and the data to be modified.
[0141] Exemplarily, as Figure 4c shown, the host 101 sends a data operation request ( Figure 4c step (1a) in the figure) to the external device 102, and this data operation request is determined by the virtual machine.
[0142] It should be noted that the data to be modified corresponding to the virtual machine can be considered as data related to the virtual machine. For example, it needs to be generated during the operation of the virtual machine or sent to the virtual machine.
[0143] Step 402: The external device 102 determines to process the data to be modified in the first memory page based on the first piece of information.
[0144] In a specific implementation, the external device 102 can process the first piece of information to determine the address of the first memory page for processing the data to be modified, such as the virtual machine physical address (GPA).
[0145] In some possible cases, the virtual machine physical address (GPA) may be the virtual page number (VPN). This application embodiment describes the solution taking this as an example; when the first memory page is divided into multiple sub - pages, the multiple sub - pages are numbered in sequence as the addresses of the sub - pages, and the virtual machine physical address (GPA) may be the virtual page number (VPN) and the address (number) of the target sub - page.
[0146] Exemplarily, when the external device 102 is a hard disk, the first piece of information may be a data operation request, and the data operation request is used to indicate processing such as data deletion, data update, or data writing to the first memory page; the external device 102 determines the first memory page based on the first piece of information, and then processes the data to be modified in the first memory page; here, processing the data to be modified in the first memory page may be deleting, updating, or inserting the data to be modified in the first memory page.
[0147] Step 403: The external device 102 determines whether to register the first memory page as a dirty page in the first page table entry. If not, execute step 404.
[0148] Step 404: The external device 102 registers the first memory page as a dirty page in the first page table entry.
[0149] According to a feasible implementation, the external device 102 determines whether to register the first memory page as a dirty page according to the information of the preset bit in the first page table entry. The preset bit is the Ignore bit in the first page table entry. Exemplarily, as Figure 4c shown, in specific implementation, the external device 102 reads the information of the preset bit ( Figure 4c step (5) in), and determines whether the first memory page is registered as a dirty page based on the information of the preset bit ( Figure 4c step (6) in).
[0150] In specific implementation, to facilitate the page table management software to freely arrange the uses of multiple Ignore bits in the EPT page table, the external device 102 can provide a Dirty bit mask to the page table management software. For example, when the mask is 0x8000000000000000, it means that the external device 102 uses the 63rd bit of the page table entry as the Dirty bit. In this way, the page table management software can set the 63rd bit in the page table entry as the preset bit to record whether the memory page corresponding to the page table entry is a dirty page. Subsequently, the external device 102 can determine the preset bit according to the first page table entry and the preset Dirty bit mask; and determine whether to register the first memory page as a dirty page based on the information of the preset bit.
[0151] It should be noted that the external device 102 can determine whether the first memory page is registered as a dirty page in the first page table entry after completing the modification of the first memory page. It can also determine whether the first memory page is registered as a dirty page in the first page table entry before modifying the first memory page; or it can determine whether the first memory page is registered as a dirty page during the modification of the first memory page. The embodiments of the present application do not intend to limit the timing of determining whether the first memory page is registered as a dirty page in the first page table entry, which can be specifically determined in combination with actual requirements. For example, when data security is highly emphasized, the external device 102 can determine whether the first memory page is registered as a dirty page in the first page table entry after completing the modification of the first memory page.
[0152] In this implementation, the external device 102 registering the first memory page as a dirty page in the first page table entry includes: the external device 102 sets the preset bit in the first page table entry to a preset value for indicating a dirty page. Exemplarily, as Figure 4c shown, in specific implementation, when the external device 101 determines that the first memory page is not registered as a dirty page, it modifies the information of the preset bit ( Figure 4c step (7) in), so as to register the first memory page as a dirty page in the first page table entry.
[0153] According to a feasible implementation, before step 403, the external device 102 may also determine a first page table entry based on the identifier of the first memory page.
[0154] In practical applications, the address translation page table is located in the memory of the host 101. In a possible scenario, the external device 102 determines the address of the first page table entry in the memory and reads the first page table entry from the memory based on this address. Specifically, the external device 102 may read the first page table entry through DMA. Exemplarily, as Figure 5a shown, the external device 102 reads the EPTP field of the EPT page table from the host 101 ( Figure 5a step (411) in), and based on the EPTP field and the virtual page number (VPN) of the first memory page, calculates the address of the first page table entry (an entry in the level 1 page table of the EPT page table) according to the Figure 3b described method ( Figure 5a step (412) in); the external device 102 reads the first page table entry from the memory of the host 101 through DMA based on this address ( Figure 5a step (413) in). It should be noted that Figure 5a steps (411), (412), and (413) in are Figure 4c a possible implementation of step (4) in.
[0155] In another possible scenario, the external device 102 can cache the page table entry and the identifier of the memory page corresponding to the page table entry inside. Correspondingly, the external device 102 can perform a match based on the identifier of the first memory page and the cached identifier, and use the page table entry corresponding to the matched cached identifier as the first page table entry. This way, there is no need to read the first page table entry through DMA, reducing the data processing volume and improving the processing efficiency.
[0156] Exemplarily, as Figure 5b shown, the external device 102 can cache the page table entry and the virtual page number (VPN) of the memory page corresponding to the page table entry inside. Correspondingly, the external device 102 can perform a match based on the virtual page number (VPN) of the first memory page and the cached virtual page number (VPN) ( Figure 5b step (421) in), and use the page table entry corresponding to the matched virtual page number (VPN) as the first page table entry ( Figure 5b step (422) in). It should be noted that Figure 5b steps (421) and (422) in are Figure 4c a possible implementation of step (4) in.
[0157] In addition, the external device 102 can match based on the identifier of the first memory page and the identifier of the cache. If there is no matching cache identifier, it is necessary to determine the address of the first page table entry in the memory, and read the first page table entry from the memory based on this address.
[0158] Exemplarily, as Figure 5c shown, the external device 102 can cache the page table entry and the virtual page number (VPN) of the memory page corresponding to the page table entry internally. Correspondingly, the external device 102 can match based on the virtual page number (VPN) of the first memory page and the virtual page number (VPN) of the cache ( Figure 5c step (421) in); if the match fails ( Figure 5c step (423) in), read the EPTP field of the EPT page table from the host 101 ( Figure 5c step (411) in), and based on the EPTP field and the virtual page number (VPN) of the first memory page, calculate the address of the first page table entry (the entry in the first-level page table of the EPT page table) according to the Figure 3b described method ( Figure 5c step (412) in); the external device 102 reads the first page table entry from the memory of the host 101 through DMA based on this address ( Figure 4c step (413) in). It should be noted that Figure 5c steps (421), (423), (411), (412), (413) in are Figure 4c a possible implementation manner of step (4) in.
[0159] According to a feasible implementation manner, the external device 102 can determine whether the first memory page is registered as a dirty page in the first page table entry based on the information recorded in the preset bit in the first page table entry.
[0160] In a possible case of this implementation manner, the first page table entry can correspond to a second memory page, and the second memory page includes multiple memory pages, including the first memory page. For example, the size of the second memory page is 2M, and the size of the first memory page can be 4K.
[0161] In an example of this case, the first page table entry is used to record whether each memory page in the second memory page is registered as a dirty page. In a specific implementation, multiple Ignore bits in the first page table entry respectively correspond one by one to multiple memory pages in the second memory page. For each of the multiple Ignore bits, the information of the Ignore bit is used to indicate whether the corresponding memory page is registered as a dirty page. Exemplarily, assume that the size of the second memory page is 2M, and the Ignore bits in the first page table entry include Bit61:62, Bit59, Bit52:56, Bit11. When using Bit61:62, Bit59, Bit52:56 to mark dirty pages, 2MB can be divided into 8 regions, so that each region corresponds to 256KB of physical memory.
[0162] In another example of this case, the first page table entry is used to record whether the second memory page is registered as a dirty page. If the first page table entry records that the second memory page is registered as a dirty page, it indicates that there are dirty pages in the second memory page at this time, but it is not known which memory page is the dirty page; in addition, the external device 102 will consider the entire second memory page as a dirty page, and at this time, it cannot be determined whether the first memory page is registered as a dirty page. For such a situation, the host 101 can actively split the address translation page table to obtain an updated first page table entry. The updated first page table entry corresponds to the first memory page and is used to record whether the first memory page is registered as a dirty page; subsequently, the external device 102 determines the address of the updated first page table entry in the memory and reads out the updated first page table entry from the memory based on this address. It should be noted that after the host 101 splits the address translation page table, it needs to re-register the address translation page table in the external device 102. After receiving the request to register the address translation page table, the external device 102 needs to discard the relevant information of the previous address translation page table, such as the cached page table entries, to ensure the use of the latest address translation page table. It is worth noting that when the host 101 splits the address translation page table, the preset bits in the page table entry that record whether the corresponding memory page is a dirty bit remain unchanged. Subsequently, the external device 102 determines whether to register the first memory page as a dirty page according to the information of the preset bits in the updated first page table entry. If the first memory page is not registered as a dirty page, the preset bits in the updated first page table entry are set to a preset value for indicating a dirty page.
[0163] Exemplarily, as Figure 5d shown, when the external device 102 determines the first page table entry corresponding to the second memory page ( Figure 5d step (431) in), when the second memory page indicated by the first page table entry is a large page, such as a 2M memory page; at this time, the external device 102 notifies the host 101 to update the EPT page table ( Figure 5dIn step (432)); the host 101 splits the EPT page table to obtain the updated EPT page table; subsequently, the external device 102 reads the updated EPTP field of the updated EPT page table from the host 101 ( Figure 5d In step (433)), based on the updated EPTP field and the virtual page number (VPN) of the first memory page, according to the Figure 3b described method, calculate the address of the updated first page table entry (the entry in the level-1 page table of the updated EPT page table) ( Figure 5d In step (434)); the external device 102 reads the updated first page table entry from the memory of the host 101 based on this address ( Figure 5d In step (435)); subsequently, based on the information of the preset bit in the updated first page table entry ( Figure 5d In step (5)), determine whether the first memory page is registered as a dirty page ( Figure 5d In step (6)). It should be noted that Figure 5d Steps (431), (432), (433), (434), and (435) in Figure 4c are a possible implementation of step (4) in
[0164] Step 405, the external device 102 sends the information of the first memory page to the host 101.
[0165] It should be noted that the information of the first memory page indicates the address of the first memory page, so that the host 101 can access the first memory page.
[0166] Exemplarily, as Figure 4c , Figure 5a , Figure 5b , Figure 5c , Figure 5d , Figure 6a , Figure 6b shown, the information of the first memory page can be the virtual page number (VPN) of the first memory page.
[0167] In some other possible cases, the first memory page is divided into multiple sub-pages, and the information of the first memory page includes the address of the target sub-page, and the target sub-page indicates the sub-page in the first memory page that processes the data to be modified.
[0168] Exemplarily, as Figure 4c shown, the host 101 is provided with a dirty page reception buffer, and the dirty page reception buffer is used to receive the information of the first memory page provided by the external device 102; the host 101 will process the information in the dirty page reception buffer.
[0169] In a possible case, as Figure 6aAs shown, a dirty page information buffer can be set inside the external device 102. This dirty page information buffer can be regarded as a set of dirty page information. In practical applications, information can be continuously added to the dirty page information buffer until the capacity of the dirty page information buffer is reached.
[0170] In a specific implementation, the external device 102 writes the information of the first memory page into the dirty page information buffer (set of dirty page information) stored locally; and provides the information in the dirty page information buffer (set of dirty page information) to the host 101. In a specific implementation, the external device 102 can provide all the information in the dirty page information buffer (set of dirty page information) to the host 101, or can also provide partial information to the host 101.
[0171] In a possible implementation manner, as Figure 6a shown, the external device 102 writes the virtual page number (VPN) of the first memory page into the dirty page information buffer stored locally ( Figure 6a in step (811)); and provides the information in the dirty page information buffer to the host 101 after meeting the preset conditions ( Figure 6a in step (812)).
[0172] In an example of this implementation manner, the external device 102 can actively provide the information in the dirty page information buffer to the host 101. Optionally, the preset condition can be that the amount of information in the dirty page information buffer reaches a preset threshold. The preset threshold can be determined in combination with actual requirements, and the embodiments of the present application do not make specific limitations on this.
[0173] In another example of this implementation manner, the external device 102 can passively provide the information in the dirty page information buffer to the host 101. Optionally, the preset condition can be receiving a query command. Among them, the query command can be actively sent by the processor of the host 101, or can also be sent by the processor of the host 101 after the external device 102 notifies the host 101. In a specific implementation, as Figure 6c shown, the external device 102 has a command interface, and the host 101 can send a query command to the external device 102 through the command interface.
[0174] In a possible situation, a dirty page information buffer (set of dirty page information) can be set outside the external device 102. In a specific implementation, as Figure 6b shown, the dirty page information buffer (set of dirty page information) can be set in the host 101. At this time, the process of the external device 102 writing the information of the first memory page into the dirty page information buffer (set of dirty page information) can be regarded as reporting to the host 101. Exemplarily, the external device 102 writes the information of the first memory page into the dirty page information buffer (set of dirty page information) by means of DMA.
[0175] Subsequently, as Figure 6b shown, the host 101 caches the information in the dirty page information buffer (dirty page information set), and when a preset condition is met, provides the information in the dirty page information buffer (dirty page information set) to the dirty page information receiving buffer for subsequent processing.
[0176] In the first example, the preset condition can be that the amount of information in the dirty page information set reaches a preset threshold.
[0177] In the second example, the preset condition can be receiving a query command.
[0178] In the third example, as Figure 6c shown, the preset condition can be that after the external device 102 receives a query command, it receives a dirty page transfer completion instruction sent by the external device 102.
[0179] In the fourth example, as Figure 6d shown, the preset condition can be receiving a dirty page transfer completion instruction sent by the external device 102, and the amount of information in the dirty page information set is greater than the threshold.
[0180] It should be noted that the external device 102 usually writes information of a fixed data amount at one time. Therefore, when the information in the first memory page does not reach the fixed data amount, the information of the first memory page needs to be cached, and the cached information is written into the dirty page information set until it reaches the fixed data amount. In the embodiments of the present application, in order that when the host 101 processes the information in the dirty page information set, the external device 102 does not cache the information of the first memory page. The following two processing methods can be adopted:
[0181] Processing method 1: As Figure 6c and Figure 6d shown, when the external device 102 does not cache the information of the dirty page internally, it reports a dirty page transfer completion instruction to the host 101. Under the conditions of this processing method 1, subsequently, the host 101 can process the information in the dirty page information set when the preset condition in the above fourth example is met.
[0182] Processing method 2: As Figure 6c shown, when the external device 102 receives a query command sent by the host 101, after writing the cached information of the dirty page into the dirty page receiving buffer (dirty page information set) set by the host 101, it reports a dirty page transfer completion instruction to the host 101. Under the conditions of this processing method 2, subsequently, the host 101 can process the information in the dirty page information set when the preset condition in the above third example is met.
[0183] Step 406: The host 101 processes the page data of the first memory page.
[0184] Exemplarily, the information of the first memory page may be the virtual page number (VPN) of the first memory page; then the host 101 can process all the page data of the first memory page.
[0185] Exemplarily, the information of the first memory page may be the address (number) of the target sub-page in the first memory page; then the host 101 only needs to process the page data of the target sub-page.
[0186] In this solution, on the one hand, there is no need for the CPU to poll the register, which increases the possibility of making full use of the CPU resources; on the other hand, when using the page table entry in the address translation page table to register whether the memory page is a dirty page, it is not required that the currently modified memory page is the same as the previous one; on the other hand, before reporting, multiple modifications to a memory page are only registered once, thereby improving the efficiency of dirty page reporting to a certain extent.
[0187] Based on the above-provided dirty page sending method, the specific application of the dirty page sending method will be described.
[0188] Figure 4c It is a schematic diagram of a specific application of a dirty page sending method provided for the implementation of this application. As Figure 4c shown, it specifically includes: the host 101 sends a data operation request to the external device 102. The data operation request includes the virtual page number (VPN) of the first memory page and the data to be modified. The data operation request is used to process the data to be modified in the first memory page; the external device 102 receives the data operation request sent by the host 101 and determines the virtual page number (VPN) of the first memory page for processing the data to be modified; the external device 102 modifies the first memory page to process the data to be modified in the first memory page; the external device 102 determines the first page table entry and reads the information of the preset bit, so as to determine whether the first memory page is registered as a dirty page in the first page table entry. If not, the external device 102 modifies the information of the preset bit to register the first memory page as a dirty page in the first page table entry; the external device 102 sends the virtual page number (VPN) of the first memory page to the host 101; the host 101 determines the first memory page based on the virtual page number (VPN) of the first memory page and processes the page data of the first memory page.
[0189] Among them, for different ways of how the external device 102 determines the first page table entry, reference can be made to Figure 5a steps (411), (412), (413) in Figure 5b steps (421), (422) in Figure 5c steps (421), (423), (411), (412), (413) in Figure 5dSteps (431), (432), (433), (434), (435) in; For different ways on how the host 101 obtains the virtual page number (VPN) from the external device 102, refer to Figure 6a Steps (811), (812) in Figure 6b Steps (821), (822), (9) in
[0190] Figure 4b is a schematic flowchart of the dirty page sending method provided by an embodiment of the present application; This embodiment can be applied to the computing device 100. The computing device 100 runs a virtual machine. The host 101 of the computing device includes an address translation page table; The address translation page table indicates the correspondence between the address of the memory page (which can be understood as the virtual machine physical address (GPA) in the embodiments of the present application) and the physical address of the physical page (which can be understood as the host physical address (HPA) in the embodiments of the present application). Specifically, when implemented, the address translation page table includes page table entries corresponding to the memory pages of the virtual machine, and the page table entries indicate the physical address (the address of the physical page) of the memory page in the host 101; including a first page table entry corresponding to the first memory page; then as Figure 4b shown, the dirty page sending method provided by the embodiments of the present application at least includes the following steps:
[0191] Step 411, Another device sends first information to the external device 102, and the first information indicates the data to be modified corresponding to the virtual machine.
[0192] Exemplarily, the external device 102 is a network card, and the first information can be a message sent by a device outside the computing device 100. Exemplarily, as Figure 4c shown, the host 101 sends a message ( Figure 4c step (1b) in), and this message needs to be sent to the virtual machine.
[0193] Exemplarily, the other device is a device outside the computing device 100, such as a terminal, or a network card, or another computing device 100. The terminal can be, but is not limited to, various personal computers, laptop computers, smartphones, tablet computers, and portable wearable devices.
[0194] Exemplarily, the other device can be a host other than the host 101 in the computing device 100 or a network card accessed by another host other than the external device 102.
[0195] Step 412, The external device 102 determines to process the data to be modified in the first memory page based on the first information.
[0196] Exemplarily, the host 101 sends a data writing instruction and the range of memory pages where data can be written to the external device 102. The data writing instruction instructs the external device 102 to write the data to the memory page when the data is received. Correspondingly, the external device 102 can select the first memory page from the memory pages where data can be written and write the first information. Here, processing the data to be modified in the first memory page can be inserting the data to be modified in the first memory page.
[0197] Step 413: The external device 102 determines whether the first memory page is registered as a dirty page in the first page table entry. If not, step 414 is executed.
[0198] Step 414: The external device 102 registers the first memory page as a dirty page in the first page table entry.
[0199] For the detailed content, refer to step 403 and step 404, which will not be elaborated here.
[0200] Step 415: The external device 102 sends the information of the first memory page to the host 101.
[0201] For the detailed content, refer to step 405, which will not be elaborated here.
[0202] Step 416: The host 101 processes the page data of the first memory page.
[0203] For the detailed content, refer to step 406, which will not be elaborated here.
[0204] In this solution, on the one hand, there is no need for the CPU to poll the register, which improves the possibility of making full use of CPU resources; on the other hand, when using the method of registering whether a memory page is a dirty page in the page table entry of the address translation page table, it is not required that the currently modified memory page is the same as the previously modified one; on the other hand, before reporting, multiple modifications to a memory page are only registered once, thus improving the efficiency of dirty page reporting to a certain extent.
[0205] Based on the above-provided dirty page sending method, the specific application of the dirty page sending method is described.
[0206] Figure 4c It is a schematic diagram of the specific application of a dirty page sending method provided for the implementation of this application. As Figure 4cAs shown in the figure, it specifically includes: other devices send packets that need to be sent to the virtual machine to the external device 102; the external device 102 determines the virtual page number (VPN) of the first memory page for processing the data to be modified; the external device 102 modifies the first memory page, thereby writing the packet into the first memory page; the external device 102 determines the first page table entry, reads the information of the preset bit, and thereby determines whether the first memory page is registered as a dirty page in the first page table entry. If not, the external device 102 modifies the information of the preset bit to register the first memory page as a dirty page in the first page table entry; the external device 102 sends the virtual page number (VPN) of the first memory page to the host 101; the host 101 determines the first memory page based on the virtual page number (VPN) of the first memory page, and processes the page data of the first memory page. Among them, for different ways of how the external device 102 determines the first page table entry, reference can be made to Figure 5a the steps (411), (412), (413) in Figure 5b the steps (421), (422) in Figure 5c the steps (421), (423), (411), (412), (413) in Figure 5d and the steps (431), (432), (433), (434), (435) in Figure 6a For different ways of how the host 101 obtains the virtual page number (VPN) from the external device 102, reference can be made to Figure 6b the steps (811), (812) in
[0207] Next, the dirty page reporting system that the dirty page sending method provided by the embodiments of the present application may apply to will be introduced. Figure 7 The figure shows an architecture example diagram of a dirty page reporting system provided by the embodiments of the present application. The dirty page sending method provided by the embodiments of the present application can be applied to a system architecture diagram such as Figure 7 shown in the figure.
[0208] Such as Figure 7As shown in the figure, the dirty page reporting system includes a first computing device 100A and a second computing device 100B. The first computing device 100A includes a host 101A and an external device 102A, and the second computing device 100B includes a host 101B and an external device 102B. In the embodiments of the present application, the running state of the virtual machine running in the host 101A can be migrated to any virtual machine in the host 101B. For example, migrate virtual machine 1 to virtual machine 2. In a possible application scenario, the hosts 101A and 101B can be servers that provide various cloud services. In the embodiments of the present application, the migrated virtual machine (VM) can be referred to as the source virtual machine (VM); the virtual machine (VM) after migrating to the host 101B can be referred to as the destination virtual machine (VM).
[0209] Among them, the first computing device 100A and the second computing device 100B communicate with each other through a network. The network can be a wired network or a wireless network. Exemplarily, the wired network can be a cable network, an optical fiber network, a Digital Data Network (DDN), etc., and the wireless network can be a telecommunication network, an internal network, the Internet, a Local Area Network (LAN), a Wide Area Network (WAN), a Wireless Local Area Network (WLAN), a Metropolitan Area Network (MAN), etc. or any combination thereof. It can be understood that the network can use any known network communication protocol to implement communication between different client layers and gateways, and the above network communication protocols can be various wired or wireless communication protocols, such as communication protocols such as Ethernet.
[0210] Next, in combination with the dirty page reporting system provided above, a dirty page sending method provided in the embodiments of the present application will be introduced in detail.
[0211] Figure 8a It is a schematic flowchart of the dirty page sending method provided in the embodiments of the present application. This embodiment can be applied to the first computing device 100A. The host 101A of the computing device 100A runs a virtual machine. The host 101A includes an address translation page table, and the address translation page table indicates the correspondence between the address of the memory page (which can be understood as the virtual machine physical address (GPA) in the embodiments of the present application, such as the virtual page number (VPN)) and the physical address of the physical page (which can be understood as the host physical address (HPA) in the embodiments of the present application); specifically, when implemented, the address translation page table includes page table entries corresponding to the memory pages of the virtual machine, and the page table entries indicate the physical address (the address of the physical page) of the memory page in the host 101, including the first page table entry corresponding to the first memory page. As Figure 8aAs shown in the figure, the dirty page sending method provided by the embodiment of the present application at least includes the following steps:
[0212] Step 801: The host 101 sends a first piece of information to the external device 102. The first piece of information indicates the data to be modified corresponding to the virtual machine. The first piece of information is the information received by the external device during the normal operation of the source virtual machine during the process of migrating the source virtual machine to the destination virtual machine.
[0213] For the detailed content, refer to step 401, which will not be elaborated here.
[0214] In addition, the first piece of information is the information received by the external device during the normal operation of the source virtual machine during the process of migrating the source virtual machine to the destination virtual machine.
[0215] Step 802: The external device 102A determines to process the data to be modified in the first memory page based on the first piece of information.
[0216] For the detailed content, refer to step 402, which will not be elaborated here.
[0217] Step 803: The external device 102A determines whether to register the first memory page as a dirty page in the first page table entry. If not, execute step 804.
[0218] Step 804: The external device 102A registers the first memory page as a dirty page in the first page table entry.
[0219] For the detailed content, refer to the descriptions of step 403 and step 404, which will not be elaborated here.
[0220] In addition, in this embodiment, during the live migration of the virtual machine, during the first migration, the content in the memory of the source virtual machine (VM) can be copied to the destination virtual machine (VM) all at once; since the source virtual machine (VM) is still running normally, after the first migration, the memory of the source virtual machine (VM) will still be modified. Therefore, after the first migration, multiple rounds of iterative copying are required to complete the live migration of the virtual machine.
[0221] Specifically, the host 101A of the first computing device 100A copies the memory pages of the source virtual machine to the host 101B of the second computing device 100B in an iterative manner. During this stage, the source virtual machine is still running. In the first memory copy, the host 101A copies all the memory pages and sends all the copied memory pages to the host 101B of the second computing device 100B. Then, during the second memory copy process, there are still memory pages in the source virtual machine in a changed state, that is, the memory pages that have been modified during the previous round of copying and sending processes, which are the dirty pages described in the embodiment of the present application.
[0222] When the external device 102 can cache the page table entries and the identifiers of the memory pages corresponding to the page table entries, in a possible example of this case, the external device 102 can also cache the number of memory copies of the page table entries (i.e., the number of memory copies). Correspondingly, for the page table entry corresponding to the identifier that matches the identifier of the first memory page, if the number of memory copies of this page table entry is the same as the current number of memory copies, it is considered that the information recorded in the cached page table entry about whether the first memory page is a dirty page is valid; otherwise, it is invalid. In the case of invalidity, the external device 102 needs to determine the address of the first page table entry in the memory, and read the first page table entry from the memory based on this address. In a specific implementation, as Figure 9 shown, the external device 102 has a round setting interface, and the host 101 can send the number of memory copies to the external device 102 through the round setting interface.
[0223] Exemplarily, as Figure 9 shown, the external device 102 can cache page table entries, the virtual page number (VPN) of the memory page corresponding to the page table entry, and the number of memory copies. Correspondingly, the external device 102 can perform a match based on the virtual page number (VPN) of the first memory page and the virtual page number (VPN) of the current number of memory copies ( Figure 9 step (441) in); determine the page table entry corresponding to the matched virtual page number (VPN) as the first page table entry ( Figure 9 step (442) in).
[0224] In Figure 9 a scenario not shown, if the virtual page number (VPN) of the first memory page fails to match the cached virtual page number (VPN), then the external device 102A reads the EPTP field of the EPT page table from the host 101, and based on the EPTP field and the virtual page number (VPN) of the first memory page, calculates the address of the first page table entry (the entry in the first-level page table of the EPT page table) according to the method described in Figure 3b ; the external device 102A reads the first page table entry from the memory of the host 101 based on this address.
[0225] Step 805, the external device 102A sends the information of the first memory page to the host 101A.
[0226] For the detailed content, refer to the description of step 405 and will not be elaborated here.
[0227] Step 806, the host 101A clears the information in the first page table entry registering the first memory page as a dirty page.
[0228] It should be noted that if the host 101A does not clear the information in the first page table entry that registers the first memory page as a dirty page; subsequently, if the first memory page is modified, the external device 102A will not register the first memory page as a dirty page in the first page table entry again, and thus will not report the information of the first memory page; subsequently, the host 101A will not process the information of the first memory page that has been modified again, resulting in omission of the processing of the first memory page. Therefore, it is necessary for the host 101A to clear the information in the first page table entry that registers the first memory page as a dirty page. Subsequently, when the first memory page is modified, the external device 102A can register the first memory page as a dirty page in the first page table entry again and report the information of the first memory page; subsequently, the host 101A can process the information of the first memory page that has been modified again.
[0229] Step 807, the host 101A sends the page data of the first memory page to the host 101B.
[0230] In this solution, on the one hand, there is no need for the CPU to poll the register, which increases the possibility of making full use of the CPU resources; on the other hand, when using the page table entry in the address translation page table to register whether the memory page is a dirty page, it is not required that the currently modified memory page is the same as the previously modified one; on the other hand, before reporting, multiple modifications to a memory page are only registered once, thereby improving the efficiency of dirty page reporting to a certain extent.
[0231] Based on the above-provided dirty page sending method, the specific application of the dirty page sending method will be described.
[0232] As Figure 9 shown, the dirty page sending method may specifically include: the host 101A sends a data operation request determined by the virtual machine to the external device 102A, and the data operation request includes the virtual page number (VPN) of the first memory page and the data to be modified. The data operation request is used to process the data to be modified in the first memory page; the external device 102A receives the data operation request sent by the host 101 and determines the virtual page number (VPN) of the first memory page for processing the data to be modified; the external device 102A modifies the first memory page to process the data to be modified in the first memory page; the external device 102A determines the first page table entry and reads the information of the preset bit, so as to determine whether the first memory page is registered as a dirty page in the first page table entry. If not, the external device 102A modifies the information of the preset bit to register the first memory page as a dirty page in the first page table entry; the external device 102A sends the virtual page number (VPN) of the first memory page to the host 101A; the host 101A determines the first memory page based on the virtual page number (VPN) of the first memory page and sends the page data of the first memory page to the host 101B. Among them, for different ways of how the external device 102A determines the first page table entry, reference can be made toFigure 5a Steps (411), (412), and (413) in Figure 5b Steps (421) and (422) in Figure 5c Steps (421), (423), (411), (412), and (413) in Figure 5d Steps (431), (432), (433), (434), and (435) in; for different ways on how the host 101A obtains the virtual page number (VPN) from the external device 102A, reference can be made to Figure 6a Steps (811) and (812) in Figure 6b Steps (821), (822), and (9) in
[0233] Figure 8b It is a schematic flowchart of the dirty page sending method provided by the embodiments of the present application. This embodiment can be applied to the first computing device 100A. The host 101A of the computing device 100A runs a virtual machine. The host 101A of the computing device includes an address translation page table, and the address translation page table indicates the corresponding relationship between the address of the memory page (which can be understood as the virtual machine physical address (GPA) in the embodiments of the present application, such as the virtual page number (VPN)) and the physical address of the physical page (which can be understood as the host physical address (HPA) in the embodiments of the present application); specifically, when implemented, the address translation page table includes page table entries corresponding to the memory pages of the virtual machine, and the page table entries indicate the physical address (the address of the physical page) of the memory page in the host 101, including the first page table entry corresponding to the first memory page. As Figure 8b As shown, the dirty page sending method provided by the embodiments of the present application at least includes the following steps:
[0234] Step 811: Another device sends a first piece of information to the external device 102, and the first piece of information indicates the data to be modified corresponding to the virtual machine.
[0235] For detailed content, reference can be made to step 411, which will not be elaborated here.
[0236] Step 812: The external device 102A determines to process the data to be modified in the first memory page based on the first piece of information. The first memory page is the memory page that the source virtual machine needs to modify during the process of migrating from the source virtual machine to the destination virtual machine.
[0237] For detailed content, reference can be made to step 412, which will not be elaborated here.
[0238] Step 813: The external device 102A determines whether to register the first memory page as a dirty page in the first page table entry. If not, step 814 is executed.
[0239] Step 814: The external device 102A registers the first memory page as a dirty page in the first page table entry.
[0240] For the detailed content, refer to the description in step 804 and it will not be elaborated here.
[0241] Step 815: The external device 102A sends the information of the first memory page to the host 101A.
[0242] For the detailed content, refer to the description in step 405 and it will not be elaborated here.
[0243] Step 816: The host 101A clears the information in the first page table entry that registers the first memory page as a dirty page.
[0244] For the detailed content, refer to the description in step 806 and it will not be elaborated here.
[0245] Step 817: The host 101A sends the page data of the first memory page to the host 101B.
[0246] In this solution, on the one hand, there is no need for the CPU to poll the register, which improves the possibility of making full use of CPU resources; on the other hand, when using the method of registering whether a memory page is a dirty page in the address translation page table, it is not required that the currently modified memory page is the same as the previous one; on the other hand, before reporting, multiple modifications to a memory page are only registered once, thus improving the efficiency of dirty page reporting to a certain extent.
[0247] Based on the above provided dirty page sending method, the specific application of the dirty page sending method will be described.
[0248] As Figure 9 shown, the dirty page sending method may specifically include: other devices send a message that needs to be sent to the virtual machine to the external device 102A; the external device 102A determines the virtual page number (VPN) of the first memory page for processing the data to be modified; the external device 102A modifies the first memory page, thereby writing the message into the first memory page; the external device 102A determines the first page table entry and reads the information of the preset bit, thereby judging whether the first memory page is registered as a dirty page in the first page table entry. If not, the external device 102A modifies the information of the preset bit to register the first memory page as a dirty page in the first page table entry; the external device 102A sends the virtual page number (VPN) of the first memory page to the host 101A; the host 101A determines the first memory page based on the virtual page number (VPN) of the first memory page and sends the page data of the first memory page to the host 101B. Among them, regarding different ways for the external device 102A to determine the first page table entry, reference can be made to Figure 5a steps (411), (412), (413) in Figure 5b steps (421), (422) in Figure 5cSteps (421), (423), (411), (412), (413) in, and Figure 5d Steps (431), (432), (433), (434), (435) in; for different ways on how host 101A obtains a virtual page number (VPN) from external device 102A, reference can be made to Figure 6a Steps (811), (812) in, Figure 6b Steps (821), (822), (9) in.
[0249] Based on the same concept as the method embodiment of this application, an embodiment of this application further provides a dirty page sending device, which is deployed in an external device. The dirty page sending device includes several modules, and each module is used to execute each step in the dirty page sending method provided by the embodiment of this application. The division of the modules is not limited here. In addition, the specific names of each module are only for the convenience of distinguishing from each other and do not limit the protection scope of this application. For the specific working process of the modules in the above device, reference can be made to the steps executed by external device 102 or external device 102A in the foregoing method embodiment, which will not be elaborated here.
[0250] Exemplarily, the dirty page sending device is used to execute the steps executed by external device 102 or external device 102A provided by the embodiment of this application, Figure 10 is a schematic structural diagram of the dirty page sending device provided by the embodiment of this application. The dirty page sending device is deployed in an external device, the external device is located in a computing device, and the computing device runs a virtual machine; the computing device includes an address translation page table, the address translation page table indicates the page table entries corresponding to the memory pages of the virtual machine, and the page table entries indicate the physical addresses of the memory pages in the first computing device; as Figure 10 shown, the dirty page sending device 1000 provided by the embodiment of this application includes:
[0251] An information receiving module 1001, configured to receive first information, where the first information indicates data to be modified corresponding to the virtual machine;
[0252] A page determination module 1002, configured to determine, based on the first information, to process the data to be modified in the first memory page;
[0253] A judgment module 1003, configured to determine whether to register the first memory page as a dirty page in the first page table entry; the first page table entry indicates the physical address of the first memory page in the computing device;
[0254] A registration module 1004, configured to, if the first memory page is not registered as a dirty page in the first page table entry, register the first memory page as a dirty page in the first page table entry;
[0255] A sending module 1005, configured to send information of a first memory page to a first computing device.
[0256] Based on the same concept as the method embodiment of this application, an embodiment of this application further provides a dirty page sending device, which is deployed in a host. The dirty page sending device includes several modules, and each module is configured to execute each step in the dirty page sending method provided by the embodiment of this application. There is no limitation on the division of the modules herein. Additionally, the specific names of the modules are only for facilitating mutual distinction and do not limit the protection scope of this application. The specific working processes of the modules in the above device can refer to the steps executed by the host 101 or the host 101A in the foregoing method embodiment, which will not be elaborated herein.
[0257] Exemplarily, the dirty page sending device is configured to execute the steps executed by the host 101 or the host 101A provided by the embodiment of this application. Figure 11 It is a schematic structural diagram of the dirty page sending device provided by the embodiment of this application. The dirty page sending device runs a virtual machine; the dirty page sending device includes an address translation page table, the address translation page table indicates the page table entries corresponding to the memory pages of the virtual machine, and the page table entries indicate the physical addresses of the memory pages; the address translation page includes a first page table entry corresponding to the first memory page; the dirty page sending device 1100 provided by the embodiment of this application includes:
[0258] A receiving module 1101, configured to receive information of a first memory page sent by an external device; wherein, in the first page table entry, the first memory page is registered as a dirty page; the first page table entry indicates the physical address of the first memory page in the computing device.
[0259] A clearing module 1102, configured to clear the information registering the first memory page as a dirty page in the first page table entry.
[0260] A processing module 1103, configured to process the page data of the first memory page.
[0261] In addition to the above methods, devices, and electronic devices, embodiments of the present application may also provide a computer program product, which includes computer program instructions. When the computer program instructions are run by a processor, the processor is caused to execute the steps in the dirty page sending methods of various embodiments of the present application described in the "Methods" section of this specification above. Among them, the computer program product may be written in any combination of one or more programming languages for computer program code to execute the operations of the embodiments of the present application. The programming languages include object-oriented programming languages such as Java, C++, etc., and also include conventional procedural programming languages such as the "C" language or similar programming languages. Among them, the computer program code may be in the form of source code, object code, executable file, or some intermediate form, etc. The computer program code may be executed entirely on the user's computing device, partially on the user's device, executed as an independent software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0262] In addition, embodiments of the present application may also provide a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are run by a processor, the processor is caused to execute the steps in the dirty page sending methods according to various embodiments of the present disclosure described in the "Methods" section of this specification above. The computer-readable storage medium may adopt any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may, for example, include but is not limited to an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. It should be noted that the content included in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0263] In the above embodiments, the descriptions of the various embodiments have their own focuses. For parts not detailed or recorded in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0264] It should be understood that the sequence numbers of the steps in the above embodiments do not imply the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
[0265] The basic principles of the present application have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, benefits, effects, etc. mentioned in the present application are only examples and not limitations. It cannot be considered that these advantages, benefits, effects, etc. are essential for each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and easy understanding, rather than limitations. The above details do not limit the present disclosure to necessarily adopt the above specific details for implementation.
[0266] The block diagrams of the devices, apparatuses, equipment, and systems involved in the present disclosure are only illustrative examples and do not intend to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open-ended terms, meaning "including but not limited to", and can be used interchangeably with each other. The word "or" and "and" used herein refer to the word "and / or" and can be used interchangeably with it, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to" and can be used interchangeably with it.
[0267] It should also be noted that in the devices, equipment, and methods of the present disclosure, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present disclosure.
[0268] The above description has been given for purposes of illustration and description. In addition, this description does not intend to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions, and sub-combinations thereof.
[0269] It can be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and do not limit the scope of the embodiments of the present application.
Claims
1. A method for sending dirty pages, characterized in that, it is applied to an external device in a first computing device; the first computing device includes an address translation page table, the address translation page table indicates page table entries corresponding to memory pages of a virtual machine, and the page table entries indicate physical addresses of the memory pages in the first computing device; the address translation page table includes a first page table entry corresponding to a first memory page; the method includes: receiving first information, the first information indicating data to be modified corresponding to the virtual machine; based on the first information, determining to process the data to be modified in the first memory page; determining whether to register the first memory page as a dirty page in the first page table entry; if not, registering the first memory page as a dirty page in the first page table entry; sending information of the first memory page to the first computing device; wherein, the information of the first memory page is used to indicate the address of the first memory page; registering the first memory page as a dirty page in the first page table entry includes: setting a preset bit in the first page table entry to a preset value for indicating a dirty page, and the preset bit is an ignored bit in the page table entry.
2. The method according to claim 1, characterized in that, sending the information of the first memory page to the first computing device includes: recording the information of the first memory page into a set of dirty page information stored locally; sending the information in the set of dirty page information to the first computing device.
3. The method according to claim 2, characterized in that, sending the information in the set of dirty page information to the first computing device includes: when the amount of information in the set of dirty page information reaches a preset threshold, or when a query command from the first computing device is received, sending the information in the set of dirty page information to the first computing device.
4. The method according to any one of claims 1 to 3, characterized in that, the method further includes: when registering the first memory page as a dirty page in the first page table entry, maintaining the situation of registering the first memory page as a dirty page in the first page table entry.
5. The method according to claim 1, characterized in that, the first information is information received by the external device during normal operation of the virtual machine during the process of migrating the virtual machine to a second computing device; and / or, the first memory page is divided into multiple sub - pages, and the information of the first memory page includes the address of a target sub - page, and the target sub - page is the sub - page in the first memory page where the data to be modified is processed.
6. The method according to claim 1, characterized in that, the method further includes: based on the matching of the first identifier of the first memory page and cached page table entry information, determining the first page table entry; wherein, the page table entry information includes the first page table entry and the first identifier corresponding to the first page table entry.
7. The method according to claim 6, characterized in that, The first memory page is the memory page modified under the first memory copy count; wherein, the first memory copy count indicates the number of times of copying the memory in the first computing device; The page table entry information is the information cached under the first memory copy count.
8. The method according to claim 1, wherein, The first page table entry corresponds to a second memory page, the second memory page includes a plurality of memory pages, and the plurality of memory pages includes the first memory page; The first page table entry is used to record whether each of the plurality of memory pages is logged as a dirty page; Or, The first page table entry registers the second memory page as a dirty page; The method further includes: Updating the first page table entry to determine the updated first page table entry; wherein, the first memory page is not registered as a dirty page in the updated first page table entry; Based on the updated first page table entry, it is determined that the first memory page is not registered as a dirty page in the first page table entry.
9. A method for sending dirty pages, wherein, It is applied to a first computing device; the first computing device includes an address translation page table, the address translation page table indicates the page table entry corresponding to the memory page of the virtual machine, and the page table entry indicates the physical address of the memory page in the first computing device; The address translation page table includes a first page table entry corresponding to a first memory page; the method includes: Receiving the information of the first memory page sent by an external device; wherein, the external device is used to receive a first piece of information, the first piece of information indicates the data to be modified corresponding to the virtual machine; based on the first piece of information, it is determined that the data to be modified is processed in the first memory page; determining whether the first memory page is registered as a dirty page in the first page table entry; if not, registering the first memory page as a dirty page in the first page table entry; sending the information of the first memory page to the first computing device; registering the first memory page as a dirty page in the first page table entry includes: setting a preset bit in the first page table entry to a preset value for indicating a dirty page, and the preset bit is the ignore bit in the page table entry; wherein, the information of the first memory page is used to indicate the address of the first memory page; Clearing the information that the first memory page is registered as a dirty page in the first page table entry; Processing the page data of the first memory page.
10. The method according to claim 9, wherein, The first piece of information is the information received by the external device during the normal operation of the virtual machine when the virtual machine migrates to a second computing device; The processing of the page data in the first memory page includes: Sending the page data in the first memory page to the second computing device.
11. An external device, wherein, The external device is used to execute any one of the methods described in claims 1 to 8.
12. A first computing device, wherein, The first computing device is used to execute the method described in claim 9 or 10.
Citation Information
Patent Citations
Method for processing dirty page of virtual machine, processing chip, computer equipment and storage medium
CN112241305A