Virtual machine migration method, device and storage medium

By utilizing dirty page bitmap information for dirty page tracking during virtual machine migration, the efficiency reduction caused by CPU exit in existing technologies is solved, achieving efficient virtual machine migration.

CN118535313BActive Publication Date: 2026-06-12ZTE CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZTE CORP
Filing Date
2023-02-23
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Existing technologies require CPU timeouts for dirty page tracking during virtual machine migration, which can reduce operational efficiency or even cause anomalies.

Method used

By reading dirty page bitmap information from the bitmap storage space, pausing the source virtual machine and reading the dirty page bit flag in the last-level page table, updating the dirty page bitmap information, identifying and sending dirty pages to the target migration device, the CPU exits.

🎯Benefits of technology

It reduces virtual machine CPU exits, improves virtual machine service operation efficiency, and avoids data loss.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535313B_ABST
    Figure CN118535313B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of computers and discloses a virtual machine migration method, device and storage medium. The application reads dirty page bitmap information from a bitmap storage space and determines a to-be-sent dirty page according to the dirty page bitmap information. In the case that the to-be-sent dirty page and a preset suspension duration meet final iteration conditions, the source virtual machine is suspended, and a dirty page bit flag in a last-level page table is read. The dirty page bitmap information is updated according to the dirty page bit flag to obtain current bitmap information. The current to-be-sent dirty page is determined according to the current bitmap information, and the current to-be-sent dirty page is sent to a target migration device. In the virtual machine migration process, the existing method is not used for dirty page tracking, but the dirty page bitmap information is used for dirty page tracking to determine the current to-be-sent dirty page, so that the virtual machine CPU does not appear to be in a page fault exception, the virtual machine CPU exit phenomenon is avoided, and the influence on the running efficiency of the business in the virtual machine is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a virtual machine migration method, device and storage medium. Background Technology

[0002] In a cloud environment, migrating a running virtual machine from one physical server to another requires a hot-migration operation to ensure uninterrupted service within the virtual machine. This process necessitates tracking dirty pages (changed memory) generated by the source virtual machine during the migration on the source server and transferring these dirty pages to the target migration device.

[0003] Existing technologies require the virtual machine's CPU (vCPU) to exit (VM-EXIT) in order to perform dirty page tracking. This means that the vCPU needs to exit for every dirty page transfer. The vCPU's exit operation reduces the operating efficiency of services within the virtual machine and may even cause service anomalies.

[0004] The above content is only used to help understand the technical solution of this application and does not represent an admission that the above content is prior art. Summary of the Invention

[0005] The main purpose of this application is to provide a virtual machine migration method, device, and storage medium, which aims to solve the technical problem that existing technologies reduce the operating efficiency of services in virtual machines and affect the normal operation of services when migrating virtual machines.

[0006] To achieve the above objectives, this application provides a virtual machine migration method, the method comprising:

[0007] Read dirty page bitmap information from the bitmap storage space, and determine the dirty page to be sent based on the dirty page bitmap information;

[0008] If the dirty page to be sent and the preset pause duration meet the final iteration conditions, pause the source virtual machine and read the dirty page bit flag in the last-level page table;

[0009] The dirty page bitmap information is updated based on the dirty page position flag to obtain the current bitmap information;

[0010] The current dirty page to be sent is determined based on the current bitmap information, and the current dirty page to be sent is sent to the target migration device.

[0011] In one possible implementation of this application, before reading dirty page bitmap information from the bitmap storage space and determining the dirty page to be sent based on the dirty page bitmap information, the method further includes:

[0012] Read the dirty page bit flag from the last-level page table, and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag.

[0013] In one possible implementation of this application, the step of reading the dirty page bit flag in the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes:

[0014] Read dirty page bitmap information from bitmap storage space;

[0015] Non-dirty page items are determined based on the dirty page bitmap information;

[0016] Read the dirty page bit flag corresponding to the non-dirty page entry in the last-level page table, and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag.

[0017] In one possible implementation of this application, before reading the dirty page bit flag in the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag, the method further includes:

[0018] The memory size of the final page table is determined based on the memory size of the source virtual machine;

[0019] Construct the final page table based on the memory of the final page table.

[0020] In one possible implementation of this application, the step of reading the dirty page bit flag in the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes:

[0021] Create kernel-mode threads;

[0022] The dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the kernel-mode thread.

[0023] The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.

[0024] In one possible implementation of this application, the step of reading the dirty page bit flag in the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes:

[0025] Create a user-mode thread and create a memory mapping for the user-mode thread, mapping the memory space corresponding to the last-level page table to the user-mode address space;

[0026] Based on the memory mapping, the dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the user-mode thread;

[0027] The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.

[0028] In one possible implementation of this application, the step of reading the dirty page bit flag in the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes:

[0029] Create a polling instance in the DPU accelerator card and create a memory mapping for the DPU accelerator card, mapping the memory space corresponding to the last-level page table and the bitmap storage space to the DPU accelerator card.

[0030] Based on the memory mapping, the dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the polling instance;

[0031] Based on the memory mapping, the dirty page bitmap information in the bitmap storage space is updated according to the dirty page flag information.

[0032] In one possible implementation of this application, after reading dirty page bitmap information from the bitmap storage space and determining the dirty page to be sent based on the dirty page bitmap information, the method further includes:

[0033] If the dirty page to be sent and the preset pause duration meet the continuous iteration condition, then the dirty page to be sent this time is selected from the dirty pages to be sent, and the dirty page bitmap information is updated according to the dirty page to be sent this time.

[0034] Clear the dirty page bit flag corresponding to the dirty page sent this time, and send the dirty page sent this time to the target migration device.

[0035] In one possible implementation of this application, the step of selecting the currently transmitted dirty page from the list of dirty pages to be transmitted and updating the dirty page bitmap information based on the currently transmitted dirty page includes:

[0036] Select the dirty page to be sent this time from the dirty pages to be sent according to the single transmission limit;

[0037] Clear the bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information.

[0038] Furthermore, to achieve the above objectives, embodiments of this application also provide a virtual machine migration apparatus, the virtual machine migration apparatus comprising:

[0039] The information acquisition module is configured to read dirty page bitmap information from the bitmap storage space and determine the dirty page to be sent based on the dirty page bitmap information;

[0040] The logic judgment module is configured to pause the source virtual machine and read the dirty page bit flag in the last-level page table if the dirty page to be sent and the preset pause duration meet the final iteration condition.

[0041] The data update module is configured to update the dirty page bitmap information based on the dirty page bit flag to obtain the current bitmap information;

[0042] The data migration module is configured to determine the currently dirty page to be sent based on the current bitmap information and send the currently dirty page to the target migration device.

[0043] In addition, to achieve the above objectives, this application embodiment also provides a virtual machine migration device, which includes: a processor, a memory, and a virtual machine migration program stored in the memory and executable on the processor. When the virtual machine migration program is executed by the processor, it implements the steps of the virtual machine migration method as described above.

[0044] In addition, to achieve the above objectives, embodiments of this application also provide a computer-readable storage medium storing a virtual machine migration program, which, when executed, implements the steps of the virtual machine migration method described above.

[0045] This application reads dirty page bitmap information from the bitmap storage space and determines the dirty page to be sent based on the dirty page bitmap information. When the dirty page to be sent and the preset pause duration meet the final iteration conditions, the source virtual machine is paused, and the dirty page bit flag in the last-level page table is read. The dirty page bitmap information is updated based on the dirty page bit flag to obtain the current bitmap information. The current dirty page to be sent is determined based on the current bitmap information and sent to the target migration device. Because dirty page tracking is not performed using existing methods during virtual machine migration, but rather using dirty page bitmap information to determine the currently pending dirty page, page fault exceptions will not occur in the virtual machine CPU, thus avoiding virtual machine CPU exit and reducing the impact on the operating efficiency of services within the virtual machine. Attached Figure Description

[0046] Figure 1 This is a schematic diagram of the structure of an electronic device in the hardware operating environment involved in the embodiments of this application;

[0047] Figure 2 This is a flowchart illustrating the first embodiment of the virtual machine migration method of this application;

[0048] Figure 3 This is a flowchart illustrating the second embodiment of the virtual machine migration method of this application;

[0049] Figure 4This is a flowchart illustrating the third embodiment of the virtual machine migration method of this application;

[0050] Figure 5 This is a schematic diagram of a device component according to an embodiment of this application;

[0051] Figure 6 This is a schematic diagram of component interaction according to an embodiment of this application;

[0052] Figure 7 This is a structural block diagram of the first embodiment of the virtual machine migration device of this application.

[0053] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0054] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of this application.

[0055] Reference Figure 1 , Figure 1 This is a schematic diagram of the virtual machine migration device structure of the hardware operating environment involved in the embodiments of this application.

[0056] like Figure 1 As shown, the electronic device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.

[0057] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0058] like Figure 1As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a virtual machine migration program.

[0059] exist Figure 1 In the electronic device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and memory 1005 in the electronic device of this application can be set in the virtual machine migration device. The electronic device calls the virtual machine migration program stored in the memory 1005 through the processor 1001 and executes the virtual machine migration method provided in the embodiment of this application.

[0060] This application provides a virtual machine migration method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of a virtual machine migration method according to this application.

[0061] In this embodiment, the virtual machine migration method includes the following steps:

[0062] Step S100: Read dirty page bitmap information from the bitmap storage space, and determine the dirty page to be sent based on the dirty page bitmap information.

[0063] It should be noted that the execution subject of this embodiment can be the virtual machine migration device, which can be a server or personal computer with an active virtual machine. Of course, it can also be other devices with the same or similar functions. This embodiment does not limit this. In this embodiment and the following embodiments, the virtual machine migration device is used as an example to illustrate the virtual machine migration method of this application.

[0064] It should be noted that the bitmap storage space can be a memory space in the virtual machine migration device used to store dirty page bitmaps. The dirty page bitmap can be a raster or a grid map, where each point or grid corresponds to a page in the virtual machine. The data stored in the point or grid indicates whether the virtual machine page corresponding to that point or grid has changed, i.e., whether it is a dirty page.

[0065] For example, using a bitmap as a dirty page bitmap, each dot stores 1 bit of data. If the data stored in a dot is 0, it means that the virtual machine page corresponding to that dot is not a dirty page; if the data stored in a dot is 1, it means that the virtual machine page corresponding to that dot is a dirty page.

[0066] It is understandable that after reading the dirty page bitmap from the bitmap storage space and obtaining the dirty page bitmap information, all the dirty pages in the source virtual machine can be determined based on the identifiers of each point in the dirty page bitmap information, thereby obtaining the dirty pages to be sent.

[0067] Step S200: If the dirty page to be sent and the preset pause duration meet the final iteration conditions, pause the source virtual machine and read the dirty page bit flag in the last-level page table.

[0068] It should be noted that when performing a hot migration of a virtual machine, the administrator of the virtual machine migration device will set the maximum duration for which the virtual machine can pause during the last dirty page transfer, i.e., the preset pause duration. If the dirty page to be sent can be transferred within the preset pause duration, then it can be determined that the dirty page to be sent and the preset pause duration meet the final iteration conditions.

[0069] If the final iteration conditions are met, this will be the last iteration, meaning the last dirty page transfer. To avoid data loss, the source virtual machine needs to be paused, and then the dirty page flag in the virtual machine's last-level page table needs to be read. The last-level page table can be a resident memory block of the virtual machine monitor (Hypervisor) throughout the virtual machine's lifecycle.

[0070] Step S300: Update the dirty page bitmap information according to the dirty page position flag to obtain the current bitmap information.

[0071] It is understandable that after reading the dirty page bit flag, the dirty page bitmap information stored in the bitmap storage space can be updated according to the dirty page bit flag, so as to obtain the latest bitmap information, that is, the current bitmap information.

[0072] Step S400: Determine the current dirty page to be sent based on the current bitmap information, and send the current dirty page to be sent to the target migration device.

[0073] It should be noted that during the last dirty page transfer, the source virtual machine has already been paused. At this time, no new dirty pages will be generated in the source virtual machine. After obtaining the current bitmap information, the current dirty page to be sent can be determined based on the current bitmap information, which can avoid data loss during virtual machine migration.

[0074] Understandably, once the current dirty pages to be sent are identified, they can be sent to the target migration device, thus completing the hot migration of the virtual machine. The target migration device can be the device to which the virtual machine is migrated during the migration process, such as a server or personal computer.

[0075] In actual use, after the current dirty pages to be sent are sent to the target migration device, the entire virtual machine migration process has been completed. At this time, the source virtual machine can be destroyed and memory release operations can be performed to reduce the resource consumption in the device.

[0076] This embodiment reads dirty page bitmap information from the bitmap storage space and determines the dirty page to be sent based on the dirty page bitmap information. If the dirty page to be sent and the preset pause duration meet the final iteration condition, the source virtual machine is paused, and the dirty page bit flag in the last-level page table is read. The dirty page bitmap information is updated according to the dirty page bit flag to obtain the current bitmap information. The current dirty page to be sent is determined based on the current bitmap information and sent to the target migration device. Because dirty page tracking is not performed using existing methods during virtual machine migration, but rather using dirty page bitmap information to determine the current dirty page to be sent, page fault exceptions will not occur in the virtual machine CPU, thus avoiding virtual machine CPU exit and reducing the impact on the operating efficiency of services within the virtual machine.

[0077] refer to Figure 3 , Figure 3 This is a flowchart illustrating a second embodiment of a virtual machine migration method according to this application.

[0078] Based on the first embodiment described above, the virtual machine migration method of this embodiment further includes, before step S100:

[0079] Step S010: Determine the memory of the final page table based on the memory size of the source virtual machine.

[0080] It should be noted that this embodiment modifies the page table memory managed by the original hypervisor. When creating a virtual machine, the memory size required for storing the final-level page table is first calculated based on the virtual machine's memory size, and then the final-level page table memory is determined. Memory allocation is then performed all at once. During memory allocation, contiguous memory space is prioritized, and the memory offset address of the page table within this memory space is calculated based on the physical address page frame number (GFN) of the current virtual machine.

[0081] Step S020: Construct the final page table based on the final page table memory.

[0082] It should be noted that when a virtual machine is created, it constructs an address mapping page table to store the virtual machine's physical address (Guest Physical Address, GPA) and the host physical address (HPA). After allocating the memory for the final-level page table, the final-level page table is constructed based on the allocated memory. That is, when the address mapping page table (GPA->HPA page table) is established in the virtual machine monitor, the memory for the final-level page table is used as the basis for its construction.

[0083] In practical use, during virtual machine migration, tracking dirty pages in memory during the migration process requires the use of the last-level page table. With the original page table memory management method, the virtual machine may experience page faults due to incomplete migration, leading to vCPU exit. However, after modifying the page table memory management method, the allocated memory can be directly used as the memory for the last-level page table, thus avoiding vCPU exit due to page faults in the virtual machine.

[0084] Step S030: Read the dirty page bit flag in the last-level page table, and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag.

[0085] It's important to note that the final-level page table contains multiple page table entries, each corresponding to a page within the virtual machine. During virtual machine operation, if a page within the virtual machine changes, a dirty page flag is written to the page table entry for that page, indicating that the page is dirty. Updating the dirty page bitmap information in the bitmap storage space based on the dirty page flag can be done by updating the data stored as points or grids in the dirty page bitmap within the bitmap storage space.

[0086] It should be understood that reading the dirty page bit flag in the last-level page table requires scanning each page table entry in the last-level page table, which is relatively time-consuming and cannot be directly applied in the dirty page transfer process. In this case, to facilitate dirty page transfer, a dirty page bitmap can be created in the bitmap storage space. Then, the dirty page bit flag in the last-level page table is read periodically. After reading the dirty page bit flag in the last-level page table, the dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag. Then, during the dirty page transfer process, only the dirty page bitmap information needs to be read to determine the dirty page.

[0087] In the implementation process, a CPU thread can be created to periodically read the dirty page bit flag in the last-level page table and update the dirty page bitmap information in the bitmap storage space. The CPU thread can be divided into user-mode threads and kernel-mode threads. If a kernel-mode thread is created for execution, then step S030 in this embodiment may include:

[0088] Create kernel-mode threads;

[0089] The dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the kernel-mode thread.

[0090] The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.

[0091] It should be noted that kernel-mode threads have higher access permissions, allowing direct access to memory in the virtual machine monitor. If a kernel-mode thread is created, it directly has access to the final-level page table. In this case, the kernel-mode thread can directly poll the dirty page flag in the final-level page table at a preset period and update the dirty page bitmap information in the bitmap storage space based on the obtained dirty page flag information. The preset period can be pre-set by the administrator of the virtual machine migration device; for example, it can be set to 30 seconds.

[0092] If a user-mode thread is created, then step S030 in this embodiment may include:

[0093] Create a user-mode thread and create a memory mapping for the user-mode thread, mapping the memory space corresponding to the last-level page table to the user-mode address space;

[0094] Based on the memory mapping, the dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the user-mode thread;

[0095] The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.

[0096] It should be noted that user-mode threads have limited access permissions and cannot directly access memory in the virtual machine monitor. To ensure that created user-mode threads can correctly read the dirty page bit flag in the final-level page table and update the dirty page bitmap information, a memory mapping can be created. This maps the memory space corresponding to the final-level page table to the user-mode address space. The user-mode thread can then use this memory mapping to read the dirty page bit flag from the final-level page table in the user-mode address space and update the dirty page bitmap information in the bitmap storage space based on the read dirty page bit flag information. Specifically, the memory mapping can be created using the CPU's MMU function. Furthermore, before sending dirty page memory, the dirty page bitmap information and dirty page bit flag corresponding to the batch of dirty page memory to be sent can be directly cleaned up in the user-mode address space through the memory mapping.

[0097] In one possible implementation of this embodiment, the dirty page bit flag in the final page table can be read and the dirty page bitmap information in the bitmap storage space can be updated through the DPU accelerator card instance. In this case, step S030 of this embodiment may include:

[0098] Create a polling instance in the DPU accelerator card and create a memory mapping for the DPU accelerator card, mapping the memory space corresponding to the last-level page table and the bitmap storage space to the DPU accelerator card.

[0099] Based on the memory mapping, the dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the polling instance;

[0100] Based on the memory mapping, the dirty page bitmap information in the bitmap storage space is updated according to the dirty page flag information.

[0101] It should be noted that, due to the limited access permissions of instances created within the Data Processing Unit (DPU) accelerator card, they cannot directly access the memory space and bitmap storage space corresponding to the final-level page table. Therefore, to ensure that the created polling instances can correctly read the dirty page bit flag in the final-level page table and update the dirty page bitmap information in the bitmap storage space, a memory mapping needs to be created. This mapping maps the memory space corresponding to the final-level page table and the bitmap storage space to the DPU accelerator card. After the memory mapping is established, the created polling instances can access the memory space and bitmap storage space corresponding to the final-level page table. At this point, the polling instances can poll the dirty page bit flag in the final-level page table at a preset period and update the dirty page bitmap information in the bitmap storage space based on the obtained dirty page flag information. The IOMMU function can be used to create the memory mapping.

[0102] In one possible implementation of this embodiment, since the more page table entries read when reading the dirty page bit flag in the last-level page table, the longer the execution time, in order to improve reading efficiency, step S03 in this embodiment may include the following steps:

[0103] Read dirty page bitmap information from bitmap storage space;

[0104] Non-dirty page items are determined based on the dirty page bitmap information;

[0105] Read the dirty page bit flag corresponding to the non-dirty page entry in the last-level page table, and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag.

[0106] It should be noted that if a page has been marked as a dirty page, it will remain a dirty page even if the memory corresponding to that page changes again. The dirty page designation is actually written into the dirty page bitmap information. To improve read efficiency, before reading the dirty page flag in the last-level page table, the dirty page bitmap information can be read first. Based on this information, the non-dirty page entries from the last read can be determined. Then, the dirty page flags corresponding to the non-dirty page entries in the last-level page table are read. Finally, the dirty page bitmap information in the bitmap storage space is updated based on these flags. This reduces the number of page table entries that need to be read when accessing the last-level page table, thus improving read efficiency.

[0107] This embodiment determines the final-level page table memory based on the source virtual machine's memory size; constructs the final-level page table based on the final-level page table memory; reads the dirty page bit flag in the final-level page table; and updates the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag. Because the final-level page table memory is determined in advance based on the source virtual machine's memory size, and the final-level page table is constructed based on the final-level page table memory, it ensures that the virtual machine will not experience CPU exit due to page faults during virtual machine migration, further reducing the impact on virtual machine services.

[0108] refer to Figure 4 , Figure 4 This is a flowchart illustrating a third embodiment of a virtual machine migration method according to this application.

[0109] Based on the first embodiment described above, after step S100 of the virtual machine migration method in this embodiment, the method further includes:

[0110] Step S200': If the dirty page to be sent and the preset pause duration meet the continuous iteration condition, then select the dirty page to be sent this time from the dirty pages to be sent, and update the dirty page bitmap information according to the dirty page to be sent this time.

[0111] It should be noted that when performing a hot migration of a virtual machine, the administrator of the virtual machine migration device will set the maximum duration for which the virtual machine can pause during the last dirty page transfer, i.e., the preset pause duration. If the dirty page to be sent cannot be transferred within the preset pause duration, it can be determined that the dirty page to be sent and the preset pause duration meet the conditions for continuous iteration.

[0112] It is understandable that if the dirty pages to be sent and the preset pause duration meet the continuous iteration condition, it means that only a portion of the dirty pages can be sent in this dirty page transmission. Therefore, a portion of the dirty pages to be sent can be selected as the dirty pages to be sent in this transmission, and then the dirty page bitmap information can be updated according to the dirty pages to be sent in this transmission, so as to avoid repeated dirty page transmission in the future.

[0113] In practical use, in order to reasonably select the dirty page to be sent, the step of selecting the dirty page to be sent from the dirty pages to be sent and updating the dirty page bitmap information according to the dirty page to be sent in this embodiment may include:

[0114] Select the dirty page to be sent this time from the dirty pages to be sent according to the single transmission limit;

[0115] Clear the bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information.

[0116] It should be noted that the single transmission limit can be determined by the preset pause duration and the transmission bandwidth of the virtual machine migration device, or it can be preset by the administrator of the virtual machine migration device. This embodiment does not impose any restrictions on this. Selecting the dirty page to be sent from the dirty pages to be sent according to the single transmission limit can be done by selecting a dirty page whose size is less than or equal to the preset transmission limit from the dirty pages to be sent as the dirty page to be sent this time.

[0117] In practical use, clearing the bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information can be done by finding the point or grid corresponding to the dirty page sent this time in the dirty page bitmap information and adjusting the data recorded therein to the marker data corresponding to the non-dirty page.

[0118] For example: if the data stored at a point in the dirty page bitmap information is 0, it means that the virtual machine page corresponding to that point is not a dirty page; if the data stored at a point is 1, it means that the virtual machine page corresponding to that point is a dirty page. In this case, the data stored at the point corresponding to the dirty page sent in the dirty page bitmap information will be set to 0.

[0119] Step S300': Clear the dirty page bit flag corresponding to the dirty page sent this time, and send the dirty page sent this time to the target migration device.

[0120] It is understandable that if the dirty page is sent to the target migration device, it means that the memory of the dirty page has been synchronized to the target migration device. In order to avoid repeated dirty page transfers in the future, the dirty page bit flag corresponding to the dirty page in the last-level page table can be cleared before sending the dirty page to the target migration device.

[0121] To facilitate understanding, we will now combine... Figure 5 and 6 This explanation does not limit the scope of this application. Figure 5 This is a schematic diagram of the device components in this embodiment, as shown below. Figure 5 As shown, the virtual machine migration device includes a last-level page table, a polling module, a dirty page bitmap, a migration thread, and a virtual machine monitor (hypervisor). The virtual machine monitor is responsible for managing the GPA->HPA page table. The last-level page table is a resident memory location throughout the virtual machine's lifecycle. The polling module polls the dirty page bits in the last-level page table and synchronizes the results to the dirty page bitmap information stored in the bitmap storage space. The migration thread is responsible for informing the virtual machine monitor of the dirty page tracking method, reading the dirty page bitmap information, sending dirty pages, and cleaning up the dirty page bitmap and notifying the virtual machine monitor to clean up the dirty page bit flags in the page table. The dirty page bitmap is stored in the bitmap storage space. Each bit in the bitmap corresponds to a page of the virtual machine; 0 indicates that the page is not dirty, and 1 indicates that the page is dirty.

[0122] Figure 6 This is a schematic diagram of component interaction in this embodiment, such as... Figure 6 As shown, the interaction flow of each component is as follows: 1. When a virtual machine is created, the hypervisor calculates the memory size required for the last-level page table in its managed page tables based on the virtual machine's memory size and requests it, preferably using contiguous memory. 2. When the GPA->HPA page table is established, the hypervisor uses the requested memory as its last-level page table. The memory address offset of the page table is calculated by the physical address page frame number (GFN) of the current virtual machine. 3. When the virtual machine starts migrating, the migration thread notifies the hypervisor to use polling to track dirty pages, and the hypervisor disables its original dirty page tracking mechanism. 4. The polling module starts polling the dirty page bits in the page table and updates the dirty page bitmap information. It can poll only the page table memory that is not a dirty page in the dirty page bitmap information. 5. The migration thread obtains the dirty page bitmap information, cleans up the dirty page bitmap corresponding to the batch of dirty page memory before sending it, and notifies the hypervisor to clean up the dirty page bits in the page table. 6. The migration thread iteratively sends dirty pages. 7. When the migration thread enters its final iteration, pause the virtual machine and wait for the polling module to complete one polling operation before obtaining the dirty page bitmap. 8. The migration thread sends the last batch of dirty page memory. 9. Migration completes, the source virtual machine is destroyed, the polling module exits its work, and the virtual machine monitor releases the page table memory.

[0123] In this embodiment, when the conditions for continuous iteration are met (both the pending dirty pages and the preset pause duration), a dirty page is selected from the pending dirty pages for transmission, and the dirty page bitmap information is updated based on this dirty page. The dirty page bit flag corresponding to this dirty page is cleared, and the dirty page is then sent to the target migration device. Because the dirty page is selected for transmission based on the pending dirty pages and the preset pause duration, instead of transmitting all at once, the phenomenon of continuously transmitting large amounts of data and reducing the operating efficiency of virtual machine services is avoided. Furthermore, before transmission, the dirty page bitmap information is updated based on this dirty page, and the dirty page bit flag corresponding to this dirty page is cleared, which avoids transmitting duplicate data during subsequent dirty page transmissions, thus improving the execution efficiency of the virtual machine migration method in this embodiment.

[0124] Furthermore, this application also proposes a storage medium storing a virtual machine migration program, which, when executed by a processor, implements the steps of the virtual machine migration method described above.

[0125] Reference Figure 7 , Figure 7 This is a structural block diagram of the first embodiment of the virtual machine migration device of this application.

[0126] like Figure 7 As shown, the virtual machine migration apparatus proposed in this application includes:

[0127] The information acquisition module 10 is configured to read dirty page bitmap information from the bitmap storage space and determine the dirty page to be sent based on the dirty page bitmap information;

[0128] The logic judgment module 20 is configured to pause the source virtual machine and read the dirty page bit flag in the last-level page table if the dirty page to be sent and the preset pause duration meet the final iteration condition.

[0129] The data update module 30 is configured to update the dirty page bitmap information according to the dirty page bit flag to obtain the current bitmap information;

[0130] The data migration module 40 is configured to determine the current dirty page to be sent based on the current bitmap information and send the current dirty page to the target migration device.

[0131] This embodiment reads dirty page bitmap information from the bitmap storage space and determines the dirty page to be sent based on the dirty page bitmap information. If the dirty page to be sent and the preset pause duration meet the final iteration condition, the source virtual machine is paused, and the dirty page bit flag in the last-level page table is read. The dirty page bitmap information is updated according to the dirty page bit flag to obtain the current bitmap information. The current dirty page to be sent is determined based on the current bitmap information and sent to the target migration device. Because dirty page tracking is not performed using existing methods during virtual machine migration, but rather using dirty page bitmap information to determine the current dirty page to be sent, page fault exceptions will not occur in the virtual machine CPU, thus avoiding virtual machine CPU exit and reducing the impact on the operating efficiency of services within the virtual machine.

[0132] In one possible implementation of this embodiment, the information acquisition module 10 is further configured to read the dirty page bit flag in the last-level page table and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag.

[0133] In one possible implementation of this embodiment, the information acquisition module 10 is further configured to read dirty page bitmap information from the bitmap storage space; determine non-dirty page entries based on the dirty page bitmap information; read the dirty page bit flag corresponding to the non-dirty page entry in the last-level page table; and update the dirty page bitmap information in the bitmap storage space based on the dirty page bit flag.

[0134] In one possible implementation of this embodiment, the information acquisition module 10 is further configured to determine the final-level page table memory based on the memory size of the source virtual machine; and construct the final-level page table based on the final-level page table memory.

[0135] In one possible implementation of this embodiment, the information acquisition module 10 is further configured to create a kernel-mode thread; obtain dirty page flag information by polling the dirty page bit flag in the last-level page table at a preset period through the kernel-mode thread; and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag information.

[0136] In one possible implementation of this embodiment, the information acquisition module 10 is further configured to create a user-mode thread and create a memory mapping for the user-mode thread, mapping the memory space corresponding to the last-level page table to the user-mode address space; based on the memory mapping, the user-mode thread polls the dirty page bit flag in the last-level page table at a preset period to obtain dirty page flag information; and updates the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag information.

[0137] In one possible implementation of this embodiment, the information acquisition module 10 is further configured to create a polling instance in the DPU accelerator card and create a memory mapping for the DPU accelerator card, mapping the memory space corresponding to the last-level page table and the bitmap storage space to the DPU accelerator card; based on the memory mapping, the polling instance polls the dirty page bit flag in the last-level page table at a preset period to obtain dirty page flag information; based on the memory mapping, the dirty page bitmap information in the bitmap storage space is updated according to the dirty page flag information.

[0138] In one possible implementation of this embodiment, the logic judgment module 20 is further configured to, when the dirty page to be sent and the preset pause duration meet the continuous iteration condition, select the dirty page to be sent this time from the dirty pages to be sent, update the dirty page bitmap information according to the dirty page to be sent this time, clear the dirty page bit flag corresponding to the dirty page to be sent this time, and send the dirty page to the target migration device.

[0139] In one possible implementation of this embodiment, the logic judgment module 20 is further configured to select the dirty page to be sent from the dirty pages to be sent based on the single transmission limit;

[0140] Clear the bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information.

[0141] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solution of this application. In specific applications, those skilled in the art can make settings as needed, and this application does not impose any restrictions on this.

[0142] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this application. In practical applications, those skilled in the art can select some or all of it to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.

[0143] In addition, for technical details not described in detail in this embodiment, please refer to the virtual machine migration method provided in any embodiment of this application, which will not be repeated here.

[0144] Furthermore, it should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0145] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0146] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0147] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A virtual machine migration method, characterized in that, The virtual machine migration method includes: Dirty page bitmap information is read from the bitmap storage space, and dirty pages to be sent are determined based on the dirty page bitmap information; wherein, after creating the dirty page bitmap in the bitmap storage space, the dirty page bit flag in the last-level page table is periodically read. The dirty page bit flag is used to update the dirty page bitmap information in the bitmap storage space. The last-level page table is constructed based on the allocated last-level page table memory. The dirty page bit flag refers to the dirty page bit flag corresponding to a non-dirty page entry. If the dirty page to be sent and the preset pause duration meet the final iteration conditions, pause the source virtual machine and read the dirty page bit flag in the last-level page table; The dirty page bitmap information is updated based on the dirty page position flag to obtain the current bitmap information; The current dirty page to be sent is determined based on the current bitmap information, and the current dirty page to be sent is sent to the target migration device.

2. The virtual machine migration method as described in claim 1, characterized in that, Before reading dirty page bitmap information from the bitmap storage space and determining the dirty page to be sent based on the dirty page bitmap information, the method further includes: Read the dirty page bit flag from the last-level page table, and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag.

3. The virtual machine migration method as described in claim 2, characterized in that, The step of reading the dirty page bit flag from the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes: Read dirty page bitmap information from bitmap storage space; Non-dirty page items are determined based on the dirty page bitmap information; Read the dirty page bit flag corresponding to the non-dirty page entry in the last-level page table, and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag.

4. The virtual machine migration method as described in claim 2, characterized in that, Before reading the dirty page bit flag from the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag, the method further includes: The memory size of the final page table is determined based on the memory size of the source virtual machine; Construct the final page table based on the memory of the final page table.

5. The virtual machine migration method as described in claim 2, characterized in that, The step of reading the dirty page bit flag from the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes: Create kernel-mode threads; The dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the kernel-mode thread. The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.

6. The virtual machine migration method as described in claim 2, characterized in that, The step of reading the dirty page bit flag from the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes: Create a user-mode thread and create a memory mapping for the user-mode thread, mapping the memory space corresponding to the last-level page table to the user-mode address space; Based on the memory mapping, the dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the user-mode thread; The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.

7. The virtual machine migration method as described in claim 2, characterized in that, The step of reading the dirty page bit flag from the last-level page table and updating the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag includes: Create a polling instance in the DPU accelerator card and create a memory mapping for the DPU accelerator card, mapping the memory space corresponding to the last-level page table and the bitmap storage space to the DPU accelerator card. Based on the memory mapping, the dirty page flag information is obtained by polling the dirty page bit flag in the last-level page table at a preset period through the polling instance; Based on the memory mapping, the dirty page bitmap information in the bitmap storage space is updated according to the dirty page flag information.

8. The virtual machine migration method according to any one of claims 1-7, characterized in that, After reading the dirty page bitmap information from the bitmap storage space and determining the dirty page to be sent based on the dirty page bitmap information, the method further includes: If the dirty page to be sent and the preset pause duration meet the continuous iteration condition, then the dirty page to be sent this time is selected from the dirty pages to be sent, and the dirty page bitmap information is updated according to the dirty page to be sent this time. Clear the dirty page bit flag corresponding to the dirty page sent this time, and send the dirty page sent this time to the target migration device.

9. The virtual machine migration method as described in claim 8, characterized in that, The step of selecting the current dirty page from the list of dirty pages to be sent and updating the dirty page bitmap information based on the current dirty page includes: Select the dirty page to be sent this time from the dirty pages to be sent according to the single transmission limit; Clear the bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information.

10. A virtual machine migration device, characterized in that, The virtual machine migration device includes: a processor, a memory, and a virtual machine migration program stored in the memory and executable on the processor. When the virtual machine migration program is executed by the processor, it implements the steps of the virtual machine migration method as described in any one of claims 1-9.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a virtual machine migration program, which, when executed, implements the steps of the virtual machine migration method as described in any one of claims 1-9.