Virtual machine dirty marking method and device, equipment and storage medium

By accurately determining the bitmap space and memory page status of the virtual machine in the server, the problem of low efficiency in winning bids for hot migration of virtual machines is solved, and more efficient resource utilization and user experience improvement is achieved.

CN119829192APending Publication Date: 2025-04-15CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Application Number
CN202411725881.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

In the prior art, during the hot migration of virtual machines, the efficiency of dirty standards is not high, which affects the user experience.

Method used

By determining the size of the occupied space of the target virtual machine in the server, accurately determine the mapping relationship between bits and page size in the host, reasonably determine the bitmap space, and record the memory page status through the migration bitmap during the memory hot migration process, monitor and mark dirty pages.

Benefits of technology

It improves the migration efficiency of virtual machine hot migration, achieves more flexible hardware dirty, improves user experience, and reduces resource consumption and costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829192A_ABST
    Figure CN119829192A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a virtual machine dirty marking method, device and equipment and a storage medium, which are applied to a server, the server comprises a host and a programmable logic controller, and the programmable logic controller comprises a plurality of virtual machines; according to the method, the size of the occupied space of the target virtual machine can be determined firstly, the mapping relation between the bit and the page size in the host can be accurately determined according to the actual situation, then the bitmap space is reasonably determined, the problem that the bitmap space is distributed too large or too small is solved, efficient adaptation and accurate utilization of resources are achieved, and the user experience is improved. Resource consumption and cost are reduced, and the overall storage resource utilization efficiency of the server can be improved; according to the method and the device, the migration efficiency of live migration can be adjusted by adjusting the mapping relation between the bits and the page sizes, so that more flexible hardware marking is realized, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for marking a virtual machine as dirty. Background Art

[0002] Hot migration is actually the migration of data. During the hot migration of virtual machines, the source host business may continue to provide services related to memory writes and generate new memory that has not been migrated. This is the so-called "dirty memory". Hardware dirty marking means that during the hot migration process, the hardware will mark the "dirty memory" and notify the software to migrate the corresponding memory data to achieve the purpose of imperceptible migration. In the existing technology, the hot migration efficiency when marking virtual machines dirty is not high, which greatly affects the user experience. Summary of the invention

[0003] In view of the above problems, embodiments of the present invention are proposed to provide a method, apparatus, device and storage medium for marking a virtual machine dirty, which overcome the above problems or at least partially solve the above problems.

[0004] In order to solve the above problem, an embodiment of the present invention discloses a method for marking a virtual machine as dirty, which is applied to a server, wherein the server includes a host and a programmable logic controller, and the programmable logic controller includes a plurality of virtual machines;

[0005] The method comprises:

[0006] Determine the occupied space size of the target virtual machine in the programmable logic controller;

[0007] Determining a mapping relationship between bits and page sizes in the host according to the size of the space occupied by the target virtual machine;

[0008] Determine a corresponding bitmap space in the host according to the mapping relationship;

[0009] Obtaining the source address and maximum size in the bitmap space;

[0010] The source address, the maximum size, and the page size in the bitmap space are written into a virtual function corresponding to the target virtual machine, and the target virtual machine is marked dirty.

[0011] Optionally, marking the target virtual machine dirty includes:

[0012] During the memory hot migration process of the target virtual machine, the state of each memory page of the virtual machine is recorded through a migration bitmap, and whether the memory page of the target virtual machine changes is monitored through a virtual machine monitor;

[0013] When the target virtual machine monitor detects that the memory page of the target virtual machine has changed, the changed memory page is marked as a dirty page in the migration bitmap.

[0014] Optionally, it also includes:

[0015] When the new virtual machine needs to be marked dirty, detecting whether the bitmap data in the target virtual machine has been migrated;

[0016] If the bitmap data in the target virtual machine has not been migrated, releasing the bitmap space of the target virtual machine after the bitmap data in the target virtual machine has been migrated;

[0017] When the bitmap space of the target virtual machine is released, the new virtual machine is marked dirty.

[0018] Optionally, determining a mapping relationship between bits and storage pages in a host according to the size of the occupied space of the target virtual machine includes:

[0019] When the occupied space size of the target virtual machine is smaller than a first threshold, it is determined that the mapping relationship between the bit in the host and the storage page is a first mapping relationship.

[0020] Optionally, the determining, according to the occupied space size of the target virtual machine, a mapping relationship between bits in the host and storage pages, further includes:

[0021] When the occupied space size of the target virtual machine is greater than the first threshold, it is determined that the mapping relationship between the bit in the host and the storage page is a second mapping relationship.

[0022] Optionally, it also includes:

[0023] During the memory hot migration process of the target virtual machine, determining the amount of remaining dirty page memory in the target virtual machine;

[0024] Determining the migration state of the target virtual machine according to the amount of remaining dirty page memory in the target virtual machine;

[0025] When the migration state is the first state, start the shutdown migration of the target virtual machine.

[0026] Optionally, determining the migration state of the target virtual machine according to the amount of remaining dirty page memory in the target virtual machine includes:

[0027] Determine whether the amount of the remaining dirty page memory is less than a first amount threshold;

[0028] When the amount of the remaining dirty page memory is less than the first amount threshold, determining that the migration state of the target virtual machine is the first state;

[0029] If the amount of the remaining dirty page memory is greater than the first amount threshold, it is determined that the migration state of the target virtual machine is a second state.

[0030] The present invention also discloses a virtual machine dirty marking device, which is applied to a server, wherein the server includes a host and a programmable logic controller, and the programmable logic controller includes a plurality of virtual machines; the device includes:

[0031] A first determination module is used to determine the occupied space size of the target virtual machine in the programmable logic controller;

[0032] A second determination module is used to determine the mapping relationship between the bit and the page size in the host according to the occupied space size of the target virtual machine;

[0033] A space determination module, used to determine a corresponding bitmap space in the host according to the mapping relationship;

[0034] An acquisition module, used for acquiring a source address and a maximum size in the bitmap space;

[0035] The dirty marking module is used to write the source address, the maximum size and the page size in the bitmap space into the virtual function corresponding to the target virtual machine, and mark the target virtual machine dirty.

[0036] Optionally, the dirty marking module includes:

[0037] A recording submodule, used for recording the status of each memory page of the virtual machine through a migration bitmap during the memory hot migration of the target virtual machine, and monitoring whether the memory page of the target virtual machine changes through a virtual machine monitor;

[0038] A marking gate is used to mark the changed memory page as a dirty page in the migration bitmap when the target virtual machine monitor detects that the memory page of the target virtual machine has changed.

[0039] Optionally, it also includes:

[0040] A detection module, used for detecting whether the bitmap data in the target virtual machine has been migrated when the new virtual machine needs to be marked dirty;

[0041] A release module, configured to release the bitmap space of the target virtual machine after the migration of the bitmap data in the target virtual machine is completed if the migration of the bitmap data in the target virtual machine is not completed;

[0042] When the bitmap space of the target virtual machine is released, the new virtual machine is marked dirty.

[0043] Optionally, the second determining module includes:

[0044] The first determination submodule is used to determine that the mapping relationship between the bit in the host and the storage page is a first mapping relationship when the occupied space size of the target virtual machine is less than a first threshold.

[0045] Optionally, the second determining module further includes:

[0046] The second determining submodule is used to determine that the mapping relationship between the bit in the host and the storage page is a second mapping relationship when the occupied space size of the target virtual machine is greater than the first threshold.

[0047] Optionally, it also includes:

[0048] A third determination module is used to determine the amount of remaining dirty page memory in the target virtual machine during the memory hot migration process of the target virtual machine;

[0049] A fourth determination module, configured to determine the migration state of the target virtual machine according to the amount of remaining dirty page memory in the target virtual machine;

[0050] A starting module is used to start the shutdown migration of the target virtual machine when the migration state is the first state.

[0051] Optionally, the fourth determining module includes:

[0052] A judging submodule, used to judge whether the amount of the remaining dirty page memory is less than a first amount threshold;

[0053] a third determining submodule, configured to determine that the migration state of the target virtual machine is a first state when the amount of the remaining dirty page memory is less than the first amount threshold;

[0054] The fourth submodule is configured to determine that the migration state of the target virtual machine is a second state if the amount of the remaining dirty page memory is greater than the first amount threshold.

[0055] The present invention also discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the above-mentioned virtual machine dirty marking method are implemented.

[0056] The present invention also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned method for marking a dirty virtual machine are implemented.

[0057] The embodiments of the present invention include the following advantages:

[0058] The present invention can first determine the size of the space occupied by the target virtual machine, and can accurately determine the mapping relationship between the bit and the page size in the host according to its actual situation, and then reasonably determine the bitmap space, avoiding the problem of over-large or under-sized bitmap space allocation, achieving efficient adaptation and accurate utilization of resources, reducing resource consumption and costs, and helping to improve the overall storage resource utilization efficiency of the server; the present invention can adjust the migration efficiency of hot migration by adjusting the mapping relationship between the bit and the page size, thereby achieving more flexible hardware dirty marking, thereby improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 It is a flowchart of the steps of a method for marking a virtual machine as dirty provided by an embodiment of the present invention;

[0060] Figure 2 is a schematic diagram of a mapping relationship provided by an embodiment of the present invention;

[0061] Figure 3 is a structural block diagram of a server provided by an embodiment of the present invention;

[0062] Figure 4 It is a flow chart of a method for marking a virtual machine as dirty provided by an embodiment of the present invention;

[0063] Figure 5 It is a structural block diagram of a virtual machine dirty marking device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0064] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0065] One of the core concepts of the embodiments of the present invention is that by first determining the size of the space occupied by the target virtual machine, the mapping relationship between the bit and the page size in the host can be accurately determined according to its actual situation, and then the bitmap space can be reasonably determined, avoiding the problem of too large or too small bitmap space allocation, achieving efficient adaptation and precise utilization of resources, reducing resource consumption and costs, and helping to improve the overall storage resource utilization efficiency of the server; the present invention can adjust the migration efficiency of hot migration by adjusting the mapping relationship between the bit and the page size, thereby achieving more flexible hardware dirty marking, thereby improving user experience.

[0066] Reference Figure 1 , shows a flowchart of the steps of a method for marking a virtual machine dirty provided by an embodiment of the present invention, which is applied to a server, the server includes a host and a programmable logic controller, and the programmable logic controller includes multiple virtual machines; the method may include the following steps:

[0067] Step 101, determining the occupied space size of the target virtual machine in the programmable logic controller.

[0068] In the embodiment of the present invention, there is usually a corresponding mechanism or management module inside the programmable logic controller to record the resources occupied by each virtual machine. The configuration file of the virtual machine may be checked, which may clearly specify the allocated disk space, memory space, etc.; or the resource monitoring and management function of the PLC itself may be used to count the total amount of various resources being used by each virtual machine in real time, and the occupied space size data of the target virtual machine may be obtained through a specific interface or command.

[0069] Step 102: Determine the mapping relationship between the bit and the page size in the host according to the occupied space size of the target virtual machine.

[0070] In an embodiment of the present invention, the host's operating system or related virtualization management software often pre-sets some rules to construct such a mapping. For example, it is known that the target virtual machine occupies S bytes of space, and the host memory page size is set to P bytes. The page size is generally a fixed value pre-configured by the operating system, etc., and is commonly 4KB. Then, the corresponding number of pages N can be obtained by calculating S÷P, and then according to the host's memory management policy, for example, each page can use a number of bits to represent its specific state, and it is determined how many bits are needed in total to correspond to these pages, thereby establishing a clear mapping relationship between bits and page sizes, so that the corresponding memory pages can be quickly located by bits later.

[0071] Step 103: Determine a corresponding bitmap space in the host according to the mapping relationship.

[0072] In the embodiment of the present invention, the bitmap space is a memory area where a set of bits for storing the status of each page is located. By determining this space, the specific memory location range of subsequent operations can be clearly defined, which facilitates accurate management and update of virtual machine-related page status information.

[0073] Based on the mapping relationship determined in the previous step, the operating system or virtualization management system will allocate a continuous area in the host memory as a bitmap space according to its own memory allocation mechanism. The starting address and size range of this area are determined according to a pre-set memory management algorithm combined with the mapping relationship. For example, a suitable continuous memory block will be selected from the free memory pool, marked as a bitmap space, and its corresponding memory starting address and other key information will be recorded for access and operation in subsequent steps.

[0074] Step 104, obtaining the source address and maximum size in the bitmap space.

[0075] In the embodiment of the present invention, the source address is the starting position identifier for accessing the bitmap space, and the maximum size limits the range boundary of this bitmap space. The range of the operation bitmap space can be accurately determined based on the source address and the maximum size, ensuring that no out-of-bounds errors will occur when relevant information is subsequently written to the virtual function corresponding to the target virtual machine, while accurately locating the location of valid data.

[0076] Step 105: write the source address, maximum size and page size in the bitmap space into the virtual function corresponding to the target virtual machine, and mark the target virtual machine as dirty.

[0077] In an embodiment of the present invention, these key bitmap space information can be passed to the virtual function corresponding to the target virtual machine, so that the virtual machine itself and the related virtualization management mechanism can know which memory areas correspond to the status information and how to find them in the bitmap space, thereby completing the dirty marking operation. Dirty marking means marking that certain page data related to the virtual machine has been modified, so that targeted processing can be performed during subsequent data migration.

[0078] Specifically, when a memory page of the target virtual machine is changed, the virtual function may migrate information of the changed memory page to a bitmap space corresponding to the host according to a source address, a maximum size, and a page size in the bitmap space.

[0079] The present invention discloses a method for marking a virtual machine dirty. By first determining the size of the occupied space of the target virtual machine, the mapping relationship between the bit and the page size in the host can be accurately determined according to the actual situation, and then the bitmap space can be reasonably determined, thereby avoiding the problem of over-large or under-sized bitmap space allocation, achieving efficient adaptation and accurate utilization of resources, reducing resource consumption and cost, and helping to improve the overall storage resource utilization efficiency of the server; the present invention can adjust the migration efficiency of hot migration by adjusting the mapping relationship between the bit and the page size, thereby achieving more flexible hardware dirty marking, thereby improving user experience.

[0080] In one embodiment of the present invention, the target virtual machine is marked dirty, including: during the memory hot migration process of the target virtual machine, the status of each memory page of the virtual machine is recorded through a migration bitmap, and whether the memory page of the target virtual machine has changed is monitored through a virtual machine monitor; when the target virtual machine monitor detects that the memory page of the target virtual machine has changed, the changed memory page is marked as a dirty page in the migration bitmap.

[0081] In an embodiment of the present invention, memory hot migration refers to a technology that migrates the memory data of a virtual machine from a source host to a target host while the virtual machine is running. The purpose is to achieve changes in the physical resources where the virtual machine is located without interrupting the operation of the virtual machine. In this process, it is very important to accurately grasp the status of each memory page of the virtual machine, and the migration bitmap plays such a recording role.

[0082] The Virtual Machine Monitor (VMM) is responsible for monitoring the memory pages of the target virtual machine. It can go deep into the memory access level of the virtual machine and capture various read and write operations on the memory pages. Whether it is data modification initiated by the application inside the virtual machine or memory changes caused by related processes at the system level, they are all within its monitoring range. It can intercept the virtual machine's read and write instructions to the memory, and by analyzing the memory addresses involved in these instructions, determine which specific memory page it corresponds to, and then determine whether the memory page has changed. At the same time, it will also interact and collaborate with the memory management module at the operating system level to obtain more comprehensive and accurate memory page status information to ensure that no possible changes are missed.

[0083] When the virtual machine monitor detects that the memory page of the target virtual machine has changed, it will trigger the dirty page marking operation. This change may be caused by various reasons such as the application running in the virtual machine updating the data, the operating system adjusting the memory data, etc. As long as the data content in the monitored memory page is inconsistent with the initial state when the hot migration is started, the triggering condition for dirty page marking is met.

[0084] Once the virtual machine monitor determines that a memory page has changed, the virtual machine monitor will search the corresponding migration bitmap and set the bit corresponding to the memory page to indicate a dirty page state (for example, set it to 1). In this way, in subsequent memory hot migration operations, the migration tool or related management system will see the memory pages marked as dirty pages in the migration bitmap and will know that the data of these pages need to be processed with emphasis, such as giving priority to re-copying or using special synchronization methods, etc., to ensure that the target virtual machine can continue to run accurately on the new host after migration, and the data can be completely and correctly retained and used.

[0085] In one embodiment of the present invention, it also includes: when the new virtual machine needs to be marked dirty, detecting whether the bitmap data in the target virtual machine has been migrated; if the bitmap data in the target virtual machine has not been migrated, releasing the bitmap space of the target virtual machine after the bitmap data in the target virtual machine has been migrated; when the bitmap space of the target virtual machine has been released, marking the new virtual machine dirty.

[0086] In an embodiment of the present invention, a corresponding identification bit or status recording mechanism is usually set in the virtualization system to track the migration progress of the bitmap data. For example, a "migration completed" flag field can be set in the relevant management structure of the bitmap data, and the initial value is false (indicating incomplete). During the migration process, as each part of the bitmap data is successfully migrated to the specified location, the corresponding module will update the value of this flag field. By checking the value of this flag field, it can be determined whether the migration is completed, or it can be determined by comparing the amount of migrated bitmap data with the total amount of bitmap data. If the two are equal, it means that the migration is completed; if the quantities are not equal, it indicates that the migration is still in progress.

[0087] The migration status of the target virtual machine's bitmap data can be continuously monitored. Once it is found that all bitmap data has been migrated, the bitmap space release process will be started. In the host's memory management module, the corresponding memory recovery operation will be performed. For example, the memory block corresponding to the bitmap space will be marked as free so that it can be reallocated to other places that need memory resources.

[0088] After confirming that the bitmap space of the target virtual machine has been successfully released, you can start marking the new virtual machine dirty. This process is similar to the conventional dirty operation introduced earlier. For example, the mapping relationship between the bit and the page size in the host is determined according to the size of the space occupied by the new virtual machine, and then the bitmap space is determined, and its source address, maximum size and other information are obtained. These key information is then written into the virtual function corresponding to the new virtual machine. At the same time, the virtual machine monitor is used to monitor whether the memory pages of the new virtual machine have changed. If there is a change, the changed memory pages will be marked as dirty pages in the corresponding migration bitmap, etc. Through these steps, the new virtual machine can be accurately marked dirty so that it can be integrated into the reasonable memory management and data processing system in the entire virtualization environment.

[0089] In one embodiment of the present invention, the mapping relationship between bits in the host and storage pages is determined according to the size of the space occupied by the target virtual machine, including: when the size of the space occupied by the target virtual machine is less than a first threshold, determining that the mapping relationship between bits in the host and storage pages is a first mapping relationship.

[0090] In an embodiment of the present invention, the first mapping relationship can be determined according to the size of the space occupied by the target virtual machine. When the size of the space occupied by the target virtual machine is less than the first threshold, the mapping relationship between the bit in the host and the storage page can be determined to be the first mapping relationship. For example, the page size of 1bit mapping is 4KByte. The first threshold can be set according to user needs.

[0091] like Figure 2 , shows a schematic diagram of a mapping relationship provided by an embodiment of the present invention, in which the page size mapped per 1 bit is 4KByte.

[0092] In one embodiment of the present invention, the mapping relationship between bits in the host and storage pages is determined according to the size of the space occupied by the target virtual machine, and also includes: when the size of the space occupied by the target virtual machine is greater than a first threshold, determining that the mapping relationship between bits in the host and storage pages is a second mapping relationship.

[0093] In an embodiment of the present invention, when the occupied space of the target virtual machine is greater than the first threshold, the mapping relationship between the bit in the host and the storage page can be determined to be a second mapping relationship. In one example, when the occupied space of the target virtual machine is larger, the second mapping relationship can be determined to be 1 bit mapped with a page size of 8KByte, thereby satisfying virtual machines with different occupied spaces.

[0094] In one embodiment of the present invention, it also includes: when the network bandwidth is abundant but the memory resources are tight, etc., according to the size of the memory space occupied by the source virtual machine, a larger pagesize (such as 8KByte) can be mapped for each bit, and a bitmap space of corresponding size (named bitmap-3) can be applied for recording dirty pages in the iterative migration stage of the virtual machine.

[0095] When the source virtual machine's memory activity is high and the hot migration efficiency needs to be improved, the corresponding size of bitmap space (named bitmap-2) can be applied for to record the dirty pages of the virtual machine during the iterative migration phase, based on the size of the memory space occupied by the source virtual machine, with each bit mapping a smaller page size (such as 2KByte). This allows the hot migration hardware dirty marking granularity to be dynamically adjusted, thereby reducing resource consumption and costs, improving hot migration efficiency, and enhancing user experience.

[0096] In one embodiment of the present invention, it also includes: during the memory hot migration process of the target virtual machine, determining the number of remaining dirty page memory in the target virtual machine; determining the migration state of the target virtual machine based on the number of remaining dirty page memory in the target virtual machine; when the migration state is a first state, starting the shutdown migration of the target virtual machine.

[0097] In an embodiment of the present invention, downtime migration refers to a method of temporarily stopping the operation of the target virtual machine and then quickly migrating the remaining small amount of dirty page memory data to the target location. When the migration state is the first state, it means that the number of remaining dirty pages is small. The advantage of choosing downtime migration at this time is that it can avoid new dirty page data that may be generated during the continued operation of the virtual machine, reduce the subsequent workload of repeated checking and synchronization of dirty page data, and can more efficiently and accurately migrate the remaining dirty page data at one time, and then restore the normal operation of the virtual machine at the target location as soon as possible, minimizing the impact on the overall service.

[0098] When it is determined that the target virtual machine is in the first state, a shutdown instruction is first sent to the virtual machine management system or a related control module. After receiving the instruction, the virtual machine management system will cooperate with the virtual machine operating system and the hardware virtualization layer to suspend all running processes, threads and other operations in the virtual machine, so that the virtual machine enters a suspended state, and then use the existing data transmission channel to copy and migrate the data in the remaining dirty page memory to the memory area corresponding to the target location at the fastest speed. After completing the migration of all remaining dirty page data, the target virtual machine will be subjected to relevant startup configuration checks and other operations at the target location. After ensuring that everything is correct, the virtual machine is restarted to enable it to continue to operate normally at the new location to complete the entire memory hot migration process. The migration status can be determined based on the number of remaining dirty page memory pages, and corresponding strategies such as shutdown migration can be adopted in the appropriate migration status, which helps to improve the efficiency and success rate of memory hot migration and ensure the continuity and stability of the business carried by the virtual machine.

[0099] In one embodiment of the present invention, the migration state of the target virtual machine is determined according to the number of remaining dirty page memories in the target virtual machine, including: when the number of remaining dirty page memories is less than a first quantity threshold, the migration state of the target virtual machine is determined to be a first state; if the number of remaining dirty page memories is greater than the first quantity threshold, the migration state of the target virtual machine is determined to be a second state.

[0100] In an embodiment of the present invention, the current migration progress of the target virtual machine can be classified and judged by the key indicator of the number of remaining dirty pages. Different migration states mean that different operations need to be taken later to ensure the smooth progress of the hot migration process and the rational use of resources.

[0101] It can be set that when the number of remaining dirty page memory is lower than a certain threshold (for example, the number of remaining dirty page memory is set to be less than 10% of the total number of memory pages), the target virtual machine is determined to be in the first state, which means that most of the memory data has been migrated or synchronized, and only a relatively small amount of dirty page data remains to be processed. At this time, it may be considered to take some more efficient but may have a short-term impact on the operation of the virtual machine to quickly complete the migration.

[0102] When the number of remaining dirty memory pages is greater than a certain threshold (for example, the number of remaining dirty memory pages is set to be less than 10% of the total number of memory pages), the migration state of the target virtual machine can be determined to be the second state, and downtime migration is not allowed at this time. The present invention can determine the migration state based on the number of remaining dirty memory pages, and adopt corresponding strategies such as downtime migration under appropriate migration states, which helps to improve the efficiency and success rate of memory hot migration and ensure the continuity and stability of the business carried by the virtual machine.

[0103] like Figure 3 , shows a structural block diagram of a server Server provided in an embodiment of the present invention, and the server may include a central controller CPU, a host memory host DDR, and an FPGA programmable logic controller.

[0104] The CPU can configure the bitmap information of the FPGA to the corresponding register through the PCIe interface. The virtiovf virtual function on the FPGA can perform memory calculations and add a dirty DMA WR channel to update the bitmap based on the configuration value of the hardware dirty register for the corresponding direct memory access write operation. The management software in the CPU can monitor the migration memory data of the virtual machine and configure the FPGA to stop the hardware dirty information to the corresponding register after the migration is completed. The FPGA then stops the hardware dirty of the virtual function.

[0105] like Figure 4 , showing a flow chart of a method for marking dirty virtual machines provided by an embodiment of the present invention, firstly, a corresponding bitmap space is generated in the host, then the source address, maximum size and page size are obtained, and then the source address, maximum size and page size are written into the virtual function of the target virtual machine, and then the marking dirty is turned on. During the hot migration process, it is determined whether there is a historical bitmap that has not been cleared. If there is a historical bitmap that has not been cleared, the historical bitmap is migrated and the memory space is released, the current bitmap is checked, the memory data corresponding to the target virtual machine is migrated and the corresponding bitmap is cleared, and whether the bandwidth resources are greater than the preset bandwidth is monitored. If the bandwidth resources are greater than the preset bandwidth, a larger pagesize is mapped for each 1 bit in the host. If the bandwidth resources are less than the preset bandwidth, the migration is stopped.

[0106] The present invention discloses a method for marking a virtual machine dirty. By first determining the size of the occupied space of the target virtual machine, the mapping relationship between the bit and the page size in the host can be accurately determined according to the actual situation, and then the bitmap space can be reasonably determined, thereby avoiding the problem of over-large or under-sized bitmap space allocation, achieving efficient adaptation and accurate utilization of resources, reducing resource consumption and cost, and helping to improve the overall storage resource utilization efficiency of the server; the present invention can adjust the migration efficiency of hot migration by adjusting the mapping relationship between the bit and the page size, thereby achieving more flexible hardware dirty marking, thereby improving user experience.

[0107] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0108] Reference Figure 5 , shows a virtual machine marking device provided by an embodiment of the present invention, which is applied to a server, the server includes a host and a programmable logic controller, and the programmable logic controller includes multiple virtual machines; the device includes:

[0109] The first determination module 201 is used to determine the occupied space size of the target virtual machine in the programmable logic controller;

[0110] A second determination module 202 is used to determine a mapping relationship between a bit and a page size in the host according to the size of the occupied space of the target virtual machine;

[0111] A space determination module 203, used to determine a corresponding bitmap space in the host according to the mapping relationship;

[0112] An acquisition module 204 is used to acquire a source address and a maximum size in a bitmap space;

[0113] The dirty marking module 205 is used to write the source address, maximum size and page size in the bitmap space into the virtual function corresponding to the target virtual machine, and mark the target virtual machine dirty.

[0114] The present invention discloses a device for marking dirty virtual machines. By first determining the size of the occupied space of the target virtual machine, the mapping relationship between the bit and the page size in the host can be accurately determined according to the actual situation, and then the bitmap space can be reasonably determined, thereby avoiding the problem of over-large or under-sized bitmap space allocation, achieving efficient adaptation and accurate utilization of resources, reducing resource consumption and cost, and helping to improve the overall storage resource utilization efficiency of the server; the present invention can adjust the migration efficiency of hot migration by adjusting the mapping relationship between the bit and the page size, thereby achieving more flexible hardware dirty marking, thereby improving user experience.

[0115] In one embodiment of the present invention, the dirty marking module includes: a recording submodule, which is used to record the status of each memory page of the virtual machine through a migration bitmap during the memory hot migration of the target virtual machine, and monitor whether the memory page of the target virtual machine changes through a virtual machine monitor; a marking gate, which is used to mark the changed memory page as a dirty page in the migration bitmap when the target virtual machine monitor detects that the memory page of the target virtual machine has changed.

[0116] In one embodiment of the present invention, the method further includes: a detection module, which is used to detect whether the bitmap data in the target virtual machine has been migrated when the new virtual machine needs to be marked dirty;

[0117] A release module, used for releasing the bitmap space of the target virtual machine after the bitmap data in the target virtual machine has been migrated if the migration of the bitmap data in the target virtual machine has not been completed;

[0118] When the bitmap space of the target virtual machine is released, the new virtual machine is marked dirty.

[0119] In one embodiment of the present invention, the second determining module includes:

[0120] The first determination submodule is used to determine that the mapping relationship between the bits in the host and the storage pages is a first mapping relationship when the occupied space size of the target virtual machine is less than a first threshold.

[0121] In one embodiment of the present invention, the second determining module further includes:

[0122] The second determination submodule is used to determine that the mapping relationship between the bits in the host and the storage pages is a second mapping relationship when the occupied space size of the target virtual machine is greater than the first threshold.

[0123] In one embodiment of the present invention, it also includes:

[0124] A third determination module is used to determine the amount of remaining dirty page memory in the target virtual machine during the memory hot migration process of the target virtual machine;

[0125] A fourth determination module, used to determine the migration state of the target virtual machine according to the amount of remaining dirty page memory in the target virtual machine;

[0126] The start module is used to start the shutdown migration of the target virtual machine when the migration state is the first state.

[0127] In one embodiment of the present invention, the fourth determining module includes:

[0128] A judging submodule, used to judge whether the amount of the remaining dirty page memory is less than a first amount threshold;

[0129] a third determining submodule, configured to determine that the migration state of the target virtual machine is a first state when the amount of the remaining dirty page memory is less than the first amount threshold;

[0130] The fourth submodule is configured to determine that the migration state of the target virtual machine is a second state if the amount of the remaining dirty page memory is greater than the first amount threshold.

[0131] The present invention discloses a device for marking dirty virtual machines. By first determining the size of the occupied space of the target virtual machine, the mapping relationship between the bit and the page size in the host can be accurately determined according to the actual situation, and then the bitmap space can be reasonably determined, thereby avoiding the problem of over-large or under-sized bitmap space allocation, achieving efficient adaptation and accurate utilization of resources, reducing resource consumption and cost, and helping to improve the overall storage resource utilization efficiency of the server; the present invention can adjust the migration efficiency of hot migration by adjusting the mapping relationship between the bit and the page size, thereby achieving more flexible hardware dirty marking, thereby improving user experience.

[0132] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0133] An embodiment of the present invention further provides an electronic device, including:

[0134] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned virtual machine dirty marking method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0135] An embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the various processes of the above-mentioned virtual machine dirty marking method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0136] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0137] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0138] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0139] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0140] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0141] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0142] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0143] The above is a detailed introduction to a virtual machine dirty marking method, device, equipment and storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A method for marking a virtual machine as dirty, characterized in that: Applied to a server, the server comprising a host and a programmable logic controller, the programmable logic controller comprising a plurality of virtual machines; The method comprises: Determine the occupied space size of the target virtual machine in the programmable logic controller; Determine a mapping relationship between bits and page sizes in the host according to the size of the space occupied by the target virtual machine; Determine a corresponding bitmap space in the host according to the mapping relationship; Obtaining the source address and maximum size in the bitmap space; The source address, the maximum size, and the page size in the bitmap space are written into a virtual function corresponding to the target virtual machine, and the target virtual machine is marked dirty.

2. The method according to claim 1, characterized in that The step of marking the target virtual machine dirty includes: During the memory hot migration process of the target virtual machine, the state of each memory page of the virtual machine is recorded through a migration bitmap, and whether the memory page of the target virtual machine changes is monitored through a virtual machine monitor; When the target virtual machine monitor detects that the memory page of the target virtual machine has changed, the changed memory page is marked as a dirty page in the migration bitmap.

3. The method according to claim 1, characterized in that Also includes: When the new virtual machine needs to be marked dirty, detecting whether the bitmap data in the target virtual machine has been migrated; If the bitmap data in the target virtual machine has not been migrated, releasing the bitmap space of the target virtual machine after the bitmap data in the target virtual machine has been migrated; When the bitmap space of the target virtual machine is released, the new virtual machine is marked dirty.

4. The method according to claim 1, characterized in that: Determining the mapping relationship between bits and storage pages in the host according to the size of the occupied space of the target virtual machine includes: When the occupied space size of the target virtual machine is smaller than a first threshold, it is determined that the mapping relationship between the bit in the host and the storage page is a first mapping relationship.

5. The method according to claim 4, characterized in that The determining, according to the occupied space size of the target virtual machine, a mapping relationship between bits in the host and storage pages, further includes: When the occupied space size of the target virtual machine is greater than the first threshold, it is determined that the mapping relationship between the bit in the host and the storage page is a second mapping relationship.

6. The method according to claim 1, characterized in that Also includes: During the memory hot migration process of the target virtual machine, determining the amount of remaining dirty page memory in the target virtual machine; Determining the migration state of the target virtual machine according to the amount of remaining dirty page memory in the target virtual machine; When the migration state is the first state, start the shutdown migration of the target virtual machine.

7. The method according to claim 6, characterized in that The determining the migration state of the target virtual machine according to the amount of remaining dirty page memory in the target virtual machine includes: Determine whether the amount of the remaining dirty page memory is less than a first amount threshold; When the amount of the remaining dirty page memory is less than the first amount threshold, determining that the migration state of the target virtual machine is the first state; If the amount of the remaining dirty page memory is greater than the first amount threshold, it is determined that the migration state of the target virtual machine is a second state.

8. A dirty marking device for a virtual machine, characterized in that: Applied to a server, the server includes a host and a programmable logic controller, the programmable logic controller includes a plurality of virtual machines; the device includes: A first determination module is used to determine the occupied space size of the target virtual machine in the programmable logic controller; A second determination module is used to determine the mapping relationship between the bit and the page size in the host according to the occupied space size of the target virtual machine; A space determination module, used to determine a corresponding bitmap space in the host according to the mapping relationship; An acquisition module, used for acquiring a source address and a maximum size in the bitmap space; The dirty marking module is used to write the source address, the maximum size and the page size in the bitmap space into the virtual function corresponding to the target virtual machine, and mark the target virtual machine dirty.

9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor is used to execute the steps of the dirty marking method for a virtual machine as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the dirty marking method for a virtual machine according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Method and device for anticipating pre-copy migration stopping

    CN107291527A

  • Methods and apparatus for accelerating virtual machine migration

    CN112148424A

  • Hardware marking implementation method for dirty pages of virtual machine of intelligent network card

    CN115586943A

  • Virtual Machine Hot Migration Method, Apparatus, Electronic Device, and Computer Storage Medium

    US20220156106A1

Cited By

  • Page storage method, virtual machine system, device, medium and product

    CN120144063A

  • Virtual machine dirty memory marking method and apparatus, device, and storage medium

    WO2026114030A1