Virtual machine migration method, device, and storage medium
By reading dirty page bitmap information and last-level page table flags, a non-interruptive process of virtual machine migration is realized, which solves the problems of reduced business operation efficiency and CPU exit caused by virtual machine migration in the existing technology, and ensures the stability of the migration process. sex and efficiency.
Patent Information
- Application Number
- PCT/CN2024/071201
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-23
- Filing Date
- 2024-01-08
- Publication Date
- 2024-08-29
AI Technical Summary
The existing technology requires the virtual machine CPU to exit during the virtual machine migration process, resulting in reduced business operation efficiency and possible abnormalities.
By reading the dirty page bitmap information from the bitmap storage space, determine the dirty pages to be sent, pause the virtual machine within the preset pause time, read the dirty page bit flag in the last-level page table, and update the bitmap information. Avoid CPU exit and achieve interruption-free migration.
It improves the business operation efficiency during the virtual machine migration process, avoids the CPU exit phenomenon, and ensures the normal operation of the business.
Smart Images

Figure CN2024071201_29082024_PF_FP_ABST
Abstract
Description
Virtual machine migration method, device and storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application No. 202310158284.6 filed on February 23, 2023, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of computer technology, and in particular to a virtual machine migration method, device, and storage medium. Background Art
[0004] In cloud scenarios, migrating a running virtual machine from one physical server to another requires hot migration of the virtual machine's memory while ensuring uninterrupted service. This process requires tracking dirty pages (changed memory) generated by the source virtual machine during the migration on the source server and transferring them to the target migration device.
[0005] However, the existing technology requires the CPU (vcpu) in the virtual machine to exit (VM-EXIT) to track dirty pages, resulting in the vcpu exiting for each dirty page transfer. The vcpu exit operation will reduce the operating efficiency of the business in the virtual machine and may even cause business anomalies.
[0006] The above content is only used to assist in understanding the technical solution of this application and does not constitute an admission that the above content is prior art.
[0007] Summary of the Invention
[0008] The main purpose of this application is to provide a virtual machine migration method, device and storage medium, aiming to solve the technical problem that the existing technology will reduce the operating efficiency of the business in the virtual machine during virtual machine migration and affect the normal operation of the business.
[0009] To achieve the above objectives, the present application provides a virtual machine migration method, the method comprising:
[0010] Reading dirty page bitmap information from the bitmap storage space, and determining the dirty page to be sent according to the dirty page bitmap information;
[0011] When the dirty page to be sent and the preset pause duration meet the final iteration condition, pausing the source virtual machine and reading the dirty page bit flag in the last-level page table;
[0012] Update the dirty page bitmap information according to the dirty page bit flag to obtain current bitmap information;
[0013] The current dirty page to be sent is determined according to the current bitmap information, and the current dirty page to be sent is sent to the target migration device.
[0014] In addition, to achieve the above-mentioned purpose, an embodiment of the present application also provides a virtual machine migration device, which includes: a processor, a memory, and a virtual machine migration program stored on the memory and runnable on the processor, and when the virtual machine migration program is executed by the processor, the steps of the virtual machine migration method described above are implemented.
[0015] In addition, to achieve the above-mentioned purpose, an embodiment of the present application further provides a computer-readable storage medium, on which a virtual machine migration program is stored, and when the virtual machine migration program is executed, the steps of the virtual machine migration method described above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] FIG1 is a schematic diagram of the structure of an electronic device in a hardware operating environment according to an embodiment of the present application;
[0017] FIG2 is a flow chart of a first embodiment of a virtual machine migration method of the present application;
[0018] FIG3 is a flow chart of a second embodiment of the virtual machine migration method of the present application;
[0019] FIG4 is a flow chart of a third embodiment of the virtual machine migration method of the present application;
[0020] FIG5 is a schematic diagram of a device assembly according to an embodiment of the present application;
[0021] FIG6 is a schematic diagram of component interaction according to an embodiment of the present application;
[0022] FIG7 is a structural block diagram of the first embodiment of the virtual machine migration device of the present application.
[0023] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0024] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.
[0025] Refer to Figure 1, which is a schematic diagram of the structure of a virtual machine migration device in a hardware operating environment involved in an embodiment of the present application.
[0026] As shown in Figure 1, 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. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may include a standard wired interface and a wireless interface (such as a wireless fidelity (WI-FI) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0027] Those skilled in the art will appreciate that the structure shown in FIG1 does not limit the electronic device and may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0028] As shown in FIG. 1 , the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a virtual machine migration program.
[0029] In the electronic device shown in Figure 1, 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 the memory 1005 in the electronic device of the present application can be set in a virtual machine migration device, and 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 the present application.
[0030] An embodiment of the present application provides a virtual machine migration method. Referring to FIG. 2 , FIG. 2 is a flow chart of a first embodiment of a virtual machine migration method of the present application.
[0031] In this embodiment, the virtual machine migration method includes the following steps:
[0032] Step S100: reading dirty page bitmap information from the bitmap storage space, and determining dirty pages to be sent according to the dirty page bitmap information.
[0033] The executing entity of this embodiment can be the virtual machine migration device, and the virtual machine migration device can be a server or personal computer equipped 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 method of this application is explained using the virtual machine migration device as an example.
[0034] The bitmap storage space can be a memory space in the virtual machine migration device, which is used to store the dirty page bitmap. The dirty page bitmap can be a dot matrix map or a raster map, where each dot or raster corresponds to a page in the virtual machine. The data stored in the point or raster indicates whether the virtual machine page corresponding to the point or raster has changed, that is, whether it is a dirty page.
[0035] For example, a dot matrix is used as a dirty page bitmap, and each dot stores 1 bit of data. If the data stored in the dot is 0, it means that the virtual machine page corresponding to the dot is not a dirty page; if the data stored in the dot is 1, it means that the virtual machine page corresponding to the dot is a dirty page.
[0036] After the dirty page bitmap is read from the bitmap storage space and the dirty page bitmap information is obtained, all dirty pages in the source virtual machine can be determined according to the identifiers of each point in the dirty page bitmap information, thereby obtaining the dirty pages to be sent.
[0037] Step S200: When 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.
[0038] When hot migrating a virtual machine, the administrator of the virtual machine migration device will set the maximum duration for which the virtual machine is allowed to pause during the last dirty page transfer, that is, the preset pause duration. If the dirty page to be sent can 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 final iteration conditions.
[0039] If the final iteration conditions are met, this will be the last iteration, i.e., the last dirty page transfer. To avoid data loss, the source VM must be paused and the dirty page flag in the VM's last-level page table must be read. The last-level page table can be a resident memory block of the hypervisor during the VM's lifecycle.
[0040] Step S300: updating the dirty page bitmap information according to the dirty page bit flag to obtain current bitmap information.
[0041] After the dirty page bit flag is read, the dirty page bitmap information stored in the bitmap storage space may be updated according to the dirty page bit flag, thereby obtaining the latest bitmap information, ie, the current bitmap information.
[0042] Step S400: determining a dirty page to be sent currently according to the current bitmap information, and sending the dirty page to be sent currently to a target migration device.
[0043] During the last dirty page transfer, the source virtual machine has been suspended. 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 is determined based on the current bitmap information, which can avoid data loss during the virtual machine migration process.
[0044] After determining the dirty pages to be sent, the dirty pages to be sent can be sent to the target migration device, thereby 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 virtual machine migration process, such as a server or a personal computer.
[0045] In actual use, after the dirty pages to be sent are sent to the target migration device, the overall virtual machine migration process has been completed. At this time, the source virtual machine can be destroyed and memory release and other operations can be performed to reduce resource usage in the device.
[0046] 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; when 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 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 the current dirty page to be sent is sent to the target migration device. Since dirty page tracking is not performed using the existing method during the virtual machine migration process, but dirty page bitmap information is used to track dirty pages and determine the current dirty page to be sent, it will not cause a page fault exception in the virtual machine CPU, thereby avoiding the virtual machine CPU exit phenomenon and reducing the impact on the operating efficiency of the business in the virtual machine.
[0047] Refer to FIG3 , which is a flow chart of a second embodiment of a virtual machine migration method of the present application.
[0048] Based on the first embodiment described above, the virtual machine migration method of this embodiment further includes, before step S100:
[0049] Step S010: Determine the last-level page table memory according to the memory size of the source virtual machine.
[0050] This embodiment modifies the page table memory managed by the existing hypervisor. When creating a virtual machine, the memory size required to store the final page table is calculated based on the virtual machine's memory size. The final page table memory is then allocated in one go. When allocating memory, 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.
[0051] Step S020: constructing a final-level page table according to the final-level page table memory.
[0052] When a virtual machine is created, it constructs an address-mapping page table to store the guest physical address (GPA) and the host physical address (HPA). After the final-level page table memory is allocated, the final-level page table is constructed based on the allocated final-level page table memory. That is, when the virtual machine monitor creates the address-mapping page table (GPA->HPA page table), it uses the final-level page table memory as the final-level page table.
[0053] In actual use, during the virtual machine migration process, the last-level page table is required to track the dirty pages of the virtual machine. With the original page table memory management method, the virtual machine will have a page fault exception due to an incomplete migration process, resulting in a vcpu exit. After the page table memory management method is modified, the already applied memory can be directly used as the memory of the last-level page table, thereby avoiding the phenomenon of vcpu exit due to a page fault exception in the virtual machine.
[0054] Step S030: 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.
[0055] The final-level page table contains multiple page table entries, each corresponding to a page in the virtual machine. If a page in the virtual machine changes while the virtual machine is running, the page table entry for that page in the final-level page table will have a dirty page flag set to indicate that the page is dirty. Updating the dirty page bitmap information in the bitmap storage space based on the dirty page bit flag can involve updating the data stored in points or grids in the dirty page bitmap in the bitmap storage space based on the dirty page bit flag.
[0056] Reading the dirty page bit flag in the last-level page table requires scanning the page table entries in the last-level page table one by one, which is relatively time-consuming and cannot be directly applied in the dirty page transmission process. At this time, in order to facilitate dirty page transmission, a dirty page bitmap can be created in the bitmap storage space, and 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 transmission process, only the dirty page bitmap information needs to be read to determine the dirty page.
[0057] During implementation, a CPU thread may 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. CPU threads may be divided into user-mode threads and kernel-mode threads. If a kernel-mode thread is created for execution, step S030 in this embodiment may include:
[0058] Create a kernel thread;
[0059] The kernel state thread polls the dirty page bit flag in the last level page table at a preset period to obtain dirty page flag information;
[0060] The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.
[0061] Kernel-mode threads have higher access privileges and can directly access memory in the virtual machine monitor. If a kernel-mode thread is created, it directly has access to the last-level page table. In this case, the kernel-mode thread can poll the dirty page flag in the last-level page table at a preset period and update the dirty page bitmap information in the bitmap storage space based on the dirty page flag information. The preset period can be pre-set by the administrator of the virtual machine migration device, for example, 30 seconds.
[0062] If a user-mode thread is created, then step S030 in this embodiment may include:
[0063] Create a user-mode thread, create a memory mapping for the user-mode thread, and map the memory space corresponding to the last-level page table to the user-mode address space;
[0064] Based on the memory mapping, the user state thread polls the dirty page bit flag in the last level page table at a preset period to obtain dirty page flag information;
[0065] The dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.
[0066] User-mode threads have lower access rights and cannot directly access the memory in the virtual machine monitor. In order to ensure that the created user-mode thread can normally read the dirty page bit flag in the last-level page table and update the dirty page bitmap information, a memory mapping can be created to map the memory space corresponding to the last-level page table to the user-mode address space. At this time, the user-mode thread can read the dirty page bit flag in the last-level page table from the user-mode address space according to the created memory mapping, and update the dirty page bitmap information in the bitmap storage space according to the dirty page bit flag information read. Among them, the memory mapping can be created through the MMU function of the CPU, and before sending the dirty page memory, the dirty page bitmap information and dirty page bit flag corresponding to the batch of dirty page memories sent can be directly cleaned up through memory mapping in the user-mode address space.
[0067] In a possible implementation of this embodiment, the dirty page bit flag in the last-level page table may be read by the DPU accelerator card instance, and the dirty page bitmap information in the bitmap storage space may be updated. In this case, step S030 of this embodiment may include:
[0068] Creating a polling instance in the DPU accelerator card, creating a memory mapping for the DPU accelerator card, and mapping the memory space and bitmap storage space corresponding to the last-level page table to the DPU accelerator card;
[0069] Based on the memory mapping, polling the dirty page bit flag in the last-level page table at a preset period through the polling instance to obtain dirty page flag information;
[0070] Based on the memory mapping, dirty page bitmap information in the bitmap storage space is updated according to the dirty page flag information.
[0071] Since the instance created in the data processing unit (DPU) accelerator card has low access rights and cannot directly access the memory space and bitmap storage space corresponding to the last-level page table, in order to ensure that the created polling instance can normally read the dirty page bit flag in the last-level page table and update the dirty page bitmap information in the bitmap storage space, it is necessary to create a memory mapping, map the memory space and bitmap storage space corresponding to the last-level page table to the DPU accelerator card, and after the memory mapping is established, the created polling instance can access the memory space and bitmap storage space corresponding to the last-level page table. At this time, the polling instance can be used to poll the dirty page bit flag in the last-level page table at a preset period, and update the dirty page bitmap information in the bitmap storage space according to the obtained dirty page flag information. When creating a memory mapping, the IOMMU function can be used to create a memory mapping.
[0072] In a possible implementation of this embodiment, when reading the dirty page bit flag in the last-level page table, the more page table entries are read, the longer the execution time is. In order to improve the reading efficiency, step S03 in this embodiment may include the following steps:
[0073] Read dirty page bitmap information from the bitmap storage space;
[0074] Determine a non-dirty page item according to the dirty page bitmap information;
[0075] The dirty page bit flag corresponding to the non-dirty page entry in the last-level page table is read, and the dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag.
[0076] If a page has been marked as a dirty page, even if the memory corresponding to the page is changed again, the page will still be a dirty page. In fact, the fact that the page is a dirty page has been written into the dirty page bitmap information. At this time, in order to improve reading efficiency, before reading the dirty page bit flag in the last-level page table, you can first read the dirty page bitmap information, determine the non-dirty page item at the time of last reading based on the dirty page bitmap information, and then read the dirty page bit flag corresponding to the non-dirty page item in the last-level page table, and then update the dirty page bitmap information in the bitmap storage space based on the dirty page bit flag corresponding to the non-dirty page item. This can reduce the page table entries that need to be read when reading the last-level page table, thereby improving reading efficiency.
[0077] This embodiment determines the final page table memory based on the source virtual machine's memory size; constructs the final page table based on this final page table memory; reads the dirty page bit flag in the final page table, and updates the dirty page bitmap information in the bitmap storage space based on the dirty page bit flag. Because the final page table memory is pre-determined based on the source virtual machine's memory size and constructed based on this final page table memory, this ensures that the virtual machine CPU will not exit due to page faults during virtual machine migration, further minimizing the impact on virtual machine services.
[0078] Refer to FIG4 , which is a flow chart of a third embodiment of a virtual machine migration method of the present application.
[0079] Based on the first embodiment described above, after step S100, the virtual machine migration method of this embodiment further includes:
[0080] Step S200 ′: when the dirty pages to be sent and the preset pause time meet the continuous iteration condition, a 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.
[0081] When hot migrating a virtual machine, the administrator of the virtual machine migration device will set the maximum duration for which the virtual machine is allowed to pause during the last dirty page transfer, that is, 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 continuous iteration conditions.
[0082] If the dirty pages to be sent and the preset pause time meet the continuous iteration conditions, it means that only a part of the dirty pages can be transmitted this time. Therefore, some dirty pages can be selected from the dirty pages to be sent as the dirty pages to be sent this time, and then the dirty page bitmap information is updated according to the dirty pages sent this time to avoid repeated dirty page transmission in the future.
[0083] In actual use, in order to reasonably select the dirty page to be sent this time, 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 this time may include:
[0084] Selecting the dirty page to be sent this time from the dirty pages to be sent according to the upper limit of a single transmission;
[0085] The bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information is cleared.
[0086] The upper limit of a single transmission may be determined by a preset pause duration and the transmission bandwidth of the virtual machine migration device, or may be pre-set by an administrator of the virtual machine migration device, and this embodiment does not impose any limitation thereto. Selecting the dirty pages to be sent from the dirty pages to be sent according to the upper limit of a single transmission may be selecting a dirty page whose size is less than or equal to the preset upper limit from the dirty pages to be sent as the dirty page to be sent.
[0087] In actual use, clearing the bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information can be done by searching for 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 mark data corresponding to the non-dirty page.
[0088] For example, if the data stored at a point in the dirty page bitmap information is 0, it indicates that the virtual machine page corresponding to the point is not a dirty page; if the data stored at the point is 1, it indicates that the virtual machine page corresponding to the point is a dirty page, then the data stored at the point corresponding to the dirty page sent this time in the dirty page bitmap information is set to 0.
[0089] Step S300 ′: clearing the dirty page flag corresponding to the dirty page sent this time, and sending the dirty page sent this time to the target migration device.
[0090] If the dirty page sent this time is sent to the target migration device, it means that the memory of the dirty page sent this time has been synchronized to the target migration device. In order to avoid subsequent repeated dirty page transmission, before sending the dirty page sent this time to the target migration device, the dirty page bit flag corresponding to the dirty page sent this time in the last-level page table can be cleared.
[0091] The following is explained in conjunction with Figures 5 and 6, but does not limit the present application scheme. Figure 5 is a schematic diagram of the device components of this embodiment. As shown in Figure 5, the virtual machine migration device includes a final page table, a polling module, a dirty page bitmap, a migration thread, and a virtual machine monitor (hypervisor), wherein the virtual machine monitor is responsible for the management of the GPA->HPA page table. The final page table is a resident memory during the life cycle of the virtual machine; the polling module is responsible for polling the dirty page bit in the final page table, and synchronizing the result to the dirty page bitmap information stored in the bitmap storage space; the migration thread is responsible for notifying the virtual machine monitor of the dirty page tracking method, reading the dirty page bitmap information and sending the dirty page, and is responsible for cleaning the dirty page bitmap and notifying the virtual machine monitor to clean the dirty page bit flag in the page table. The dirty page bitmap is stored in the bitmap storage space, and each bit in the bitmap corresponds to a page of the virtual machine. 0 represents that the page of the virtual machine is not a dirty page, and 1 represents that the page of the virtual machine is a dirty page.
[0092] Figure 6 is a schematic diagram of the component interactions in this embodiment. As shown in Figure 6, the component interaction process 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 allocates it, preferably using contiguous memory. 2. When the hypervisor establishes the GPA->HPA page table, it uses the allocated memory as its last-level page table. The page table's memory address offset is calculated based on the current virtual machine's physical address page frame number (GFN). 3. When the virtual machine begins migration, the migration thread notifies the hypervisor to use polling to track dirty pages, and the hypervisor disables the existing dirty page tracking mechanism. 4. The polling module begins polling the dirty page bits in the page table and updates the dirty page bitmap information. It may only poll the page table memory that is not dirty in the dirty page bitmap information. 5. The migration thread obtains the dirty page bitmap information. Before sending a batch of dirty page memory, it clears the dirty page bitmap corresponding to the batch and notifies the hypervisor to clear the dirty page bits in the page table. 6. The migration thread iterates and sends dirty pages. 7. When the migration thread enters its final iteration, it pauses the VM and waits for the polling module to complete a polling operation before retrieving the dirty page bitmap. 8. The migration thread sends the final batch of dirty page memory. 9. When the migration is complete, the source VM is destroyed, the polling module exits, and the VM monitor releases the page table memory.
[0093] In this embodiment, when the dirty pages to be sent and the preset pause time meet the continuous iteration condition, 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; the dirty page bit flag corresponding to the dirty page to be sent this time is cleared, and the dirty page to be sent this time is sent to the target migration device. Since the dirty page to be sent this time is selected from the dirty pages to be sent for dirty page transmission when the dirty pages to be sent and the preset pause time meet the continuous iteration condition, rather than all of them are transmitted at once, the phenomenon of continuously transmitting a large amount of data and reducing the operating efficiency of the virtual machine business is avoided, and the dirty page bitmap information is updated according to the dirty page to be sent this time before the transmission, and the dirty page bit flag corresponding to the dirty page to be sent this time is cleared, which can avoid the transmission of duplicate data when the dirty page is subsequently transmitted, thereby improving the execution efficiency of the virtual machine migration method of this embodiment.
[0094] In addition, an embodiment of the present application further provides a storage medium, on which a virtual machine migration program is stored. When the virtual machine migration program is executed by a processor, the steps of the virtual machine migration method described above are implemented.
[0095] Refer to FIG. 7 , which is a structural block diagram of the first embodiment of the virtual machine migration apparatus of the present application.
[0096] As shown in FIG7 , the virtual machine migration device proposed in the embodiment of the present application includes:
[0097] 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 according to the dirty page bitmap information;
[0098] 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 when the dirty page to be sent and the preset pause time meet the final iteration condition;
[0099] The data updating module 30 is configured to update the dirty page bitmap information according to the dirty page bit flag to obtain current bitmap information;
[0100] The data migration module 40 is configured to determine the dirty page to be sent currently according to the current bitmap information, and send the dirty page to be sent currently to the target migration device.
[0101] 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; when 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 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 the current dirty page to be sent is sent to the target migration device. Since dirty page tracking is not performed using the existing method during the virtual machine migration process, but dirty page bitmap information is used to track dirty pages and determine the current dirty page to be sent, it will not cause a page fault exception in the virtual machine CPU, thereby avoiding the virtual machine CPU exit phenomenon and reducing the impact on the operating efficiency of the business in the virtual machine.
[0102] In a 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.
[0103] In a 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 items based on the dirty page bitmap information; read the dirty page bit flag corresponding to the non-dirty page item 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.
[0104] In a possible implementation of this embodiment, the information acquisition module 10 is further configured to determine a last-level page table memory according to the memory size of the source virtual machine; and construct a last-level page table according to the last-level page table memory.
[0105] In a possible implementation of this embodiment, the information acquisition module 10 is also 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.
[0106] In a possible implementation of this embodiment, the information acquisition module 10 is also configured to create a user-state thread and create a memory mapping for the user-state thread, mapping the memory space corresponding to the last-level page table to the user-state address space; based on the memory mapping, the user-state thread polls the dirty page bit flag in the last-level page table at a preset period to obtain dirty page flag information; and the dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag information.
[0107] In a 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 and bitmap storage space corresponding to the last-level page table to the DPU accelerator card; based on the memory mapping, polling the dirty page bit flag in the last-level page table at a preset period through the polling instance to obtain dirty page flag information; based on the memory mapping, updating the dirty page bitmap information in the bitmap storage space according to the dirty page flag information.
[0108] In a possible implementation of this embodiment, the logic judgment module 20 is also configured to select the dirty page to be sent from the dirty pages to be sent when the dirty page to be sent and the preset pause time meet the continuous iteration condition, and 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.
[0109] In a possible implementation of this embodiment, the logic judgment module 20 is further configured to select the dirty page to be sent this time from the dirty pages to be sent according to the upper limit of a single transmission;
[0110] The bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information is cleared.
[0111] The above is only an example and does not constitute any limitation to the technical solution of the present application. In specific applications, technicians in this field can make settings as needed, and the present application does not impose any restrictions on this.
[0112] The workflow described above is merely illustrative and does not limit the scope of protection of this application. In actual applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the embodiment scheme, and no limitation is made here.
[0113] In addition, for technical details not fully described in this embodiment, please refer to the virtual machine migration method provided in any embodiment of the present application, and will not be repeated here.
[0114] In addition, it should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0115] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0116] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0117] The above are merely optional embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A virtual machine migration method, wherein: The virtual machine migration method comprises: Reading dirty page bitmap information from the bitmap storage space, and determining the dirty page to be sent according to the dirty page bitmap information; When the dirty page to be sent and the preset pause time meet the final iteration condition, pausing the source virtual machine and reading the dirty page bit flag in the last-level page table; The dirty page bitmap information is updated according to the dirty page bit flag to obtain current bitmap information; The dirty page to be sent currently is determined according to the current bitmap information, and the dirty page to be sent currently is sent to the target migration device.
2. The virtual machine migration method according to claim 1, wherein: The method further includes: reading dirty page bitmap information from the bitmap storage space and determining the dirty page to be sent according to the dirty page bitmap information; The dirty page bit flag in the last-level page table is read, and the dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag.
3. The virtual machine migration method according to claim 2, wherein: 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: Read dirty page bitmap information from the bitmap storage space; Determine a non-dirty page item according to the dirty page bitmap information; The dirty page bit flag corresponding to the non-dirty page entry in the last-level page table is read, and the dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag.
4. The virtual machine migration method according to claim 2, wherein: Before the dirty page bit flag in the last-level page table is read and the dirty page bitmap information in the bitmap storage space is updated according to the dirty page bit flag, the method further includes: Determine the last-level page table memory according to the memory size of the source virtual machine; A final-level page table is constructed according to the final-level page table memory.
5. The virtual machine migration method according to claim 2, wherein: 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: Create a kernel-mode thread; The kernel state thread polls the dirty page bit flag in the last-level page table at a preset period to obtain dirty page flag information; 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 according to claim 2, wherein: 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: Create a user state thread, and create a memory mapping for the user state thread, mapping the memory space corresponding to the last level page table to the user state address space; Based on the memory mapping, the dirty page bit flag in the last-level page table is polled by the user-mode thread at a preset period to obtain dirty page flag information; 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 according to claim 2, wherein: 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: Create a polling instance in the DPU accelerator card, create a memory mapping for the DPU accelerator card, and map the memory space and the bitmap storage space corresponding to the last-level page table to the DPU accelerator card; Based on the memory mapping, the dirty page bit flag in the last-level page table is polled at a preset period by the polling instance 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.
8. The virtual machine migration method according to any one of claims 1 to 7, wherein: After reading the dirty page bitmap information from the bitmap storage space and determining the dirty page to be sent according to the dirty page bitmap information, the method further includes: When the dirty pages to be sent and the preset pause time meet the continuous iteration condition, the dirty pages to be sent this time are selected from the dirty pages to be sent, and the dirty page bitmap information is updated according to the dirty pages to be sent this time; The dirty page bit flag corresponding to the dirty page sent this time is cleared, and the dirty page sent this time is sent to the target migration device.
9. The virtual machine migration method according to claim 8, wherein: The step of selecting the dirty page to be sent this time from the dirty pages to be sent, and updating the dirty page bitmap information according to the dirty page to be sent this time, includes: Selecting the dirty page to be sent this time from the dirty pages to be sent according to the upper limit of a single transmission; The bitmap information corresponding to the dirty page sent this time in the dirty page bitmap information is cleared.
10. A virtual machine migration device, wherein: 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, the steps of the virtual machine migration method according to any one of claims 1 to 9 are implemented.
11. A computer-readable storage medium, wherein: The computer-readable storage medium stores a virtual machine migration program, and when the virtual machine migration program is executed, the steps of the virtual machine migration method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Migrating method and device for virtual machine, as well as physical host
CN103955399A
Virtual machine migration method and device, electronic equipment and storage medium
CN111638937A
Virtual machine migration method and device, electronic equipment and storage medium
CN111638938A
Method for processing dirty page of virtual machine, processing chip, computer equipment and storage medium
CN112241305A
Virtual machine migration acceleration with page state indicators
US9727368B1
