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

By determining the virtual machine's occupied space size and the mapping relationship between bits and page size, the bitmap space is reasonably determined, solving the problem of low efficiency in marking dirty data during virtual machine hot migration, and achieving efficient resource adaptation and improved user experience.

WO2026114030A1PCT designated stage Publication Date: 2026-06-04CHINA TELECOM CLOUD TECH CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
CHINA TELECOM CLOUD TECH CO LTD
Filing Date
2025-11-18
Publication Date
2026-06-04

AI Technical Summary

Technical Problem

In existing technologies, the efficiency of marking dirty objects during virtual machine hot migration is low, which affects the user experience.

Method used

By determining the size of the target virtual machine, the mapping relationship between bits and page size in the host is accurately determined, the bitmap space is reasonably determined, and the memory page changes are monitored by the virtual machine monitor to mark it as dirty.

Benefits of technology

It achieves efficient resource adaptation and precise utilization, reduces resource consumption and costs, and improves the migration efficiency and user experience of hot migration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025135835_04062026_PF_FP_ABST
    Figure CN2025135835_04062026_PF_FP_ABST
Patent Text Reader

Abstract

A virtual machine dirty memory marking method and apparatus, a device, 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. In the present application, by first determining the size of an occupied space of a target virtual machine, a mapping relationship between a bit and a page size in a host can be accurately determined on the basis of the actual situation thereof, thereby reasonably determining a bitmap space, avoiding the problem of allocating an excessively large or small bitmap space, achieving efficient adaptation and accurate utilization of resources, reducing resource consumption and costs, and facilitating improving the overall storage resource utilization efficiency of a server. In the present application, the migration efficiency of live migration can be adjusted by adjusting the mapping relationship between the bit and the page size, thereby achieving more flexible hardware dirty memory marking, and improving user experience.
Need to check novelty before this filing date? Find Prior Art

Description

A method, apparatus, device, and storage medium for marking virtual machines.

[0001] Cross-reference to related applications

[0002] This application claims priority to Chinese Patent Application No. 202411725881.3, filed on November 28, 2024, entitled "A method, apparatus, device and storage medium for marking virtual machines", the entire contents of which are incorporated herein by reference. Technical Field

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

[0004] Hot migration is essentially data migration. During virtual machine hot migration, the source host service may continue to provide memory write services, generating new unmigrated memory, which is called "dirty memory". Hardware marking as dirty refers to the process of marking "dirty memory" by hardware during hot migration, notifying the software to migrate the corresponding memory data, so as to achieve the purpose of seamless migration. In the current technology, the efficiency of hot migration when marking virtual machines as dirty is not high, which greatly affects the user experience. Summary of the Invention

[0005] In view of the above problems, some embodiments of this application are proposed to provide a virtual machine standard method, apparatus, device and storage medium that overcomes or at least partially solves the above problems.

[0006] To address the aforementioned issues, some embodiments of this application disclose a method for marking virtual machines, applied to a server. The server includes a host and a programmable logic controller (PLC), and the PLC includes multiple virtual machines.

[0007] The methods include:

[0008] Determine the size of the target virtual machine in the programmable logic controller;

[0009] Based on the size of the target virtual machine, determine the mapping relationship between bits in the host and page size;

[0010] The corresponding bitmap space is determined in the host based on the mapping relationship;

[0011] Get the source address and maximum size of the bitmap in space;

[0012] Write the source address, maximum size, and page size from the bitmap space into the virtual function corresponding to the target virtual machine, and mark the target virtual machine as dirty.

[0013] In some embodiments, marking the target virtual machine as dirty includes:

[0014] During the hot migration of memory in the target virtual machine, the state of each memory page of the virtual machine is recorded by the migration bitmap, and the memory pages of the target virtual machine are monitored by the virtual machine monitor to see if they have changed.

[0015] When the target virtual machine monitor detects a change in the target virtual machine's memory pages, the changed memory pages are marked as dirty pages in the migration bitmap.

[0016] In some embodiments, it also includes:

[0017] When it is necessary to mark a new virtual machine as dirty, check whether the bitmap data in the target virtual machine has been migrated.

[0018] If the bitmap data in the target virtual machine has not been migrated, the bitmap space of the target virtual machine will be released after the bitmap data migration in the target virtual machine is completed.

[0019] Once the bitmap space of the target virtual machine has been released, the new virtual machine is marked as dirty.

[0020] In some embodiments, determining the mapping relationship between bits in the host and storage pages based on the size of the target virtual machine includes:

[0021] When the space occupied by the target virtual machine is less than the first threshold, the mapping relationship between bits in the host and storage pages is determined to be the first mapping relationship.

[0022] In some embodiments, determining the mapping relationship between bits in the host and storage pages based on the size of the target virtual machine's occupied space further includes:

[0023] When the space occupied by the target virtual machine is greater than the first threshold, the mapping relationship between bits in the host and storage pages is determined to be the second mapping relationship.

[0024] In some embodiments, it also includes:

[0025] During the hot migration of memory in the target virtual machine, determine the number of remaining dirty pages in the target virtual machine;

[0026] The migration status of the target virtual machine is determined based on the amount of dirty pages remaining in the target virtual machine.

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

[0028] In some embodiments, determining the migration status of the target virtual machine based on the amount of remaining dirty pages in the target virtual machine includes:

[0029] Determine if the number of remaining dirty pages is less than a first threshold.

[0030] If the number of remaining dirty pages is less than the first threshold, the migration status of the target virtual machine is determined to be the first state.

[0031] If the number of remaining dirty pages is greater than the first threshold, the migration status of the target virtual machine is determined to be the second state.

[0032] This application also discloses a virtual machine scraping device applied to a server, the server including a host and a programmable logic controller, the programmable logic controller including multiple virtual machines; the device includes:

[0033] The first determining module is used to determine the size of the space occupied by the target virtual machine in the programmable logic controller;

[0034] The second determining module is used to determine the mapping relationship between bits and page size in the host based on the space occupied by the target virtual machine;

[0035] The space determination module is used to determine the corresponding bitmap space in the host according to the mapping relationship;

[0036] The acquisition module is used to obtain the source address and maximum size in the bitmap space;

[0037] The dirty labeling module 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 to label the target virtual machine as dirty.

[0038] In some embodiments, the dirty module includes:

[0039] The recording submodule is used to record the state of each memory page of the virtual machine through a migration bitmap during the hot migration of memory in the target virtual machine, and to monitor whether the memory pages of the target virtual machine have changed through the virtual machine monitor.

[0040] The gate marker is used to mark the changed memory page as a dirty page in the migration bitmap when the target virtual machine monitor detects a change in the target virtual machine's memory page.

[0041] In some embodiments, it also includes:

[0042] The detection module is used to detect whether the bitmap data in the target virtual machine has been migrated when a new virtual machine needs to be marked as dirty.

[0043] The release module is used to release the bitmap space of the target virtual machine after the bitmap data in the target virtual machine has been migrated if the migration of bitmap data in the target virtual machine has not been completed.

[0044] Once the bitmap space of the target virtual machine has been released, the new virtual machine is marked as dirty.

[0045] In some embodiments, the second determining module includes:

[0046] The first determining submodule is used to determine the mapping relationship between bits in the host and storage pages as the first mapping relationship when the space occupied by the target virtual machine is less than the first threshold.

[0047] In some embodiments, the second determining module further includes:

[0048] The second determining submodule is used to determine the mapping relationship between bits in the host and storage pages as the second mapping relationship when the space occupied by the target virtual machine is greater than the first threshold.

[0049] In some embodiments, it also includes:

[0050] The third determination module is used to determine the number of remaining dirty pages in the target virtual machine during the hot migration of memory in the target virtual machine.

[0051] The fourth determination module is used to determine the migration status of the target virtual machine based on the amount of remaining dirty pages in the target virtual machine;

[0052] The startup module is used to initiate a shutdown migration of the target virtual machine when the migration status is in the first state.

[0053] In some embodiments, the fourth determining module includes:

[0054] The judgment submodule is used to determine whether the number of remaining dirty pages is less than a first threshold.

[0055] The third determination submodule is used to determine the migration status of the target virtual machine as the first state when the number of remaining dirty pages is less than the first quantity threshold.

[0056] The fourth submodule is used to determine the migration status of the target virtual machine as the second state if the number of remaining dirty pages is greater than the first threshold.

[0057] This application also discloses an electronic device, including: 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, it implements the steps of the virtual machine standard method as described above.

[0058] This application also discloses a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the virtual machine's marking method as described above.

[0059] Some embodiments of this application include the following advantages:

[0060] This application can accurately determine the mapping relationship between bits and page size in the host by first determining the space occupied by the target virtual machine, and then reasonably determine the bitmap space, avoiding the problem of bitmap space allocation being too large or too small. This achieves efficient resource adaptation and accurate utilization, reduces resource consumption and costs, and helps improve the overall storage resource utilization efficiency of the server. This application can also adjust the migration efficiency of hot migration by adjusting the mapping relationship between bits and page size, thereby achieving more flexible hardware labeling and improving user experience. Attached Figure Description

[0061] Figure 1 is a flowchart of the steps of a method for marking a virtual machine as dirty according to some embodiments of this application;

[0062] Figure 2 is a schematic diagram of a mapping relationship provided by some embodiments of this application;

[0063] Figure 3 is a structural block diagram of a server provided in some embodiments of this application;

[0064] Figure 4 is a flowchart illustrating a method for marking a virtual machine as dirty according to some embodiments of this application;

[0065] Figure 5 is a structural block diagram of a virtual machine's cleaning device provided in some embodiments of this application. Detailed Implementation

[0066] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0067] One of the core concepts of some embodiments of this application is that by first determining the space occupied by the target virtual machine, the mapping relationship between bits and page size in the host can be accurately determined based on its actual situation, thereby reasonably determining the bitmap space. This avoids the problem of bitmap space allocation being too large or too small, achieving efficient resource adaptation and accurate utilization, reducing resource consumption and costs, and helping to improve the overall storage resource utilization efficiency of the server. This application can adjust the migration efficiency of hot migration by adjusting the mapping relationship between bits and page size, thereby achieving more flexible hardware labeling and improving user experience.

[0068] Referring to Figure 1, a flowchart of the steps of a virtual machine labeling method provided in some embodiments of this application is shown. The method is applied to a server, which includes a host and a programmable logic controller (PLC). The PLC includes multiple virtual machines. The method may include the following steps:

[0069] Step 101: Determine the space occupied by the target virtual machine in the programmable logic controller.

[0070] In some embodiments of this application, the programmable logic controller (PLC) typically has a corresponding mechanism or management module to record the resource usage of each virtual machine. This can be achieved by viewing the virtual machine's configuration file, which may explicitly specify the allocated disk space, memory space, etc.; or by using the resource monitoring and management functions built into the PLC to statistically analyze the total amount of various resources used by each virtual machine in real time, and by obtaining the space usage data of the target virtual machine through specific interfaces or commands.

[0071] Step 102: Determine the mapping relationship between bits and page size in the host based on the space occupied by the target virtual machine.

[0072] In some embodiments of this application, the host operating system or related virtualization management software often pre-sets some rules to construct such a mapping. For example, if the target virtual machine occupies a space of S bytes 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, such as 4KB (kilobyte). Then, the number of pages N can be obtained by calculating S ÷ P. Then, according to the host's memory management strategy, such as each page can be represented by a certain number of bits to represent its specific state, the total number of bits needed to correspond to these pages is determined, thereby establishing a clear mapping relationship between bits and page size, so that the corresponding memory page can be quickly located through bits in the future.

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

[0074] In some embodiments of this application, the bitmap space is a memory region used to represent the set of bits storing the state of each page. Determining this space clarifies the specific memory location range for subsequent operations, facilitating accurate management and updating of virtual machine-related page state information.

[0075] Based on the mapping relationship determined in the previous step, the operating system or virtualization management system will allocate a contiguous region in the host memory as a bitmap space according to its own memory allocation mechanism. The starting address and size range of this region are determined according to a pre-set memory management algorithm combined with the mapping relationship. For example, it will select a suitable contiguous memory block from the free memory pool, mark it as a bitmap space, and record its corresponding memory starting address and other key information for subsequent steps to access and operate.

[0076] Step 104: Obtain the source address and maximum size in the bitmap space.

[0077] In some embodiments of this application, the source address is the starting position identifier for accessing the bitmap space, and the maximum size defines the range boundary of this bitmap space. The range of the bitmap space to be operated can be accurately determined based on the source address and the maximum size, ensuring that no errors such as out-of-bounds will occur when writing relevant information to the virtual functions corresponding to the target virtual machine, while accurately locating the location of the valid data.

[0078] 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.

[0079] In some embodiments of this application, these key bitmap space information can be passed to the virtual functions corresponding to the target virtual machine, so that the virtual machine itself and the related virtualization management mechanism can know which memory regions' status information is located in the bitmap space and how to find it, thereby completing the dirty marking operation. Dirty marking means marking that certain page data related to the virtual machine has been modified, so that it can be processed in a targeted manner during subsequent data migration.

[0080] Specifically, when the memory pages of the target virtual machine are changed, the virtualization function can migrate the information of the changed memory pages to the corresponding bitmap space of the host based on the source address, maximum size, and page size in the bitmap space.

[0081] This application discloses a method for marking virtual machines as dirty. By first determining the space occupied by the target virtual machine, the mapping relationship between bits and page size in the host can be accurately determined based on its actual situation. This allows for the reasonable determination of bitmap space, avoiding the problem of bitmap space allocation being too large or too small. This achieves efficient resource adaptation and accurate utilization, reduces resource consumption and costs, and helps improve the overall storage resource utilization efficiency of the server. Furthermore, this application can adjust the migration efficiency of hot migration by adjusting the mapping relationship between bits and page size, thereby achieving more flexible hardware marking as dirty and improving user experience.

[0082] In some embodiments of this application, marking the target virtual machine as dirty includes: during the hot migration of memory in the target virtual machine, recording the state of each memory page of the virtual machine through a migration bitmap, and monitoring whether the memory pages of the target virtual machine have changed through a virtual machine monitor; when the target virtual machine monitor detects that the memory pages of the target virtual machine have changed, marking the changed memory pages as dirty pages in the migration bitmap.

[0083] In some embodiments of this application, memory hot migration refers to a technique 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 change the physical resources on which the virtual machine resides without interrupting the operation of the virtual machine. In this process, it is crucial to accurately grasp the state of each memory page of the virtual machine, and the migration bitmap plays such a recording role.

[0084] The Virtual Machine Monitor (VMM) is responsible for monitoring the memory pages of the target virtual machine. It can delve into the memory access layer of the virtual machine and capture various read and write operations on memory pages. Whether it is data modification initiated by applications inside the virtual machine or memory changes caused by related processes at the system level, it is all within its monitoring scope. It can intercept the virtual machine's read and write instructions to memory, and by analyzing the memory addresses involved in these instructions, it can determine which specific memory page it corresponds to, and then determine whether the memory page has changed. At the same time, it also interacts and collaborates 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.

[0085] When the virtual machine monitor detects a change in the memory pages of the target virtual machine, it triggers a dirty page marking operation. This change may be caused by various reasons such as the application running in the virtual machine updating data or the operating system adjusting memory data. As long as the data content in the memory page is found to be inconsistent with the initial state at the time of hot migration, the triggering condition for dirty page marking is met.

[0086] Once the virtual machine monitor determines that a memory page has changed, it looks up the corresponding migration bitmap and sets the bit corresponding to that memory page to indicate the state of a dirty page (e.g., set to 1). In this way, during subsequent hot memory migration operations, the migration tool or related management system will see the memory pages marked as dirty pages in the migration bitmap and know that the data on these pages needs to be handled with priority, such as prioritizing re-copying or using special synchronization methods, to ensure that the target virtual machine can continue to run accurately on the new host after migration, and that the data can be completely and correctly preserved and used.

[0087] In some embodiments of this application, the method further includes: when it is necessary to mark a new virtual machine as 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 migration is completed; and marking the new virtual machine as dirty when the bitmap space of the target virtual machine is released.

[0088] In some embodiments of this application, a corresponding flag or status recording mechanism is typically set in the virtualization system to track the migration progress of bitmap data. For example, a "migration complete" flag field can be set in the relevant management structure of bitmap data, with an initial value of false (indicating incomplete). During the migration process, as each part of bitmap data is successfully migrated to the designated 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 complete. Alternatively, 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 complete; if the amounts are not equal, it indicates that the migration is still in progress.

[0089] It can continuously monitor the migration status of the target virtual machine bitmap data. 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 reclamation 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.

[0090] Once it is confirmed that the bitmap space of the target virtual machine has been successfully released, the new virtual machine can be marked as dirty. This process is similar to the conventional dirty marking operation described earlier. For example, the mapping relationship between bits and page size in the host is determined based on the size of the space occupied by the new virtual machine, and then the bitmap space is determined. Information such as its source address and maximum size is obtained, and this key information is 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. When there are changes, the changed memory pages are marked as dirty pages in the corresponding migration bitmap. Through these steps, the new virtual machine is accurately marked as dirty, so that it can be integrated into the reasonable memory management and data processing system of the entire virtualization environment.

[0091] In some embodiments of this application, determining the mapping relationship between bits in the host and storage pages based on the size of the space occupied by the target virtual machine includes: when the size of the space occupied by the target virtual machine is less than a first threshold, determining the mapping relationship between bits in the host and storage pages as a first mapping relationship.

[0092] In some embodiments of this application, a first mapping relationship can be determined based on 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 a first threshold, the mapping relationship between bits in the host and storage pages can be determined as the first mapping relationship. For example, the page size mapped by 1 bit (Binary Digit) is 4KByte. The first threshold can be set according to the user's needs.

[0093] Figure 2 shows a schematic diagram of a mapping relationship provided by some embodiments of this application, where each bit in the figure maps to a page size of 4KByte.

[0094] In some embodiments of this application, determining the mapping relationship between bits in the host and storage pages based on the size of the space occupied by the target virtual machine further includes: when the size of the space occupied by the target virtual machine is greater than a first threshold, determining the mapping relationship between bits in the host and storage pages as a second mapping relationship.

[0095] In some embodiments of this application, when the space occupied by the target virtual machine is greater than the first threshold, the mapping relationship between bits in the host and storage pages can be determined as the second mapping relationship. In one example, when the space occupied by the target virtual machine is large, the second mapping relationship can be determined as 1 bit mapping a page size of 8KByte, thereby satisfying virtual machines with different space occupancy.

[0096] In some embodiments of this application, it is also included that when there is sufficient network bandwidth but limited memory resources, a bitmap space of the corresponding size (named bitmap-3) can be allocated based on the size of the memory space occupied by the source virtual machine, with each bit mapping a larger page size (e.g., 8KByte) as the mapping relationship, to record the dirty pages in the virtual machine iterative migration stage.

[0097] When situations arise where the source virtual machine has high memory activity and requires improved hot migration efficiency, a bitmap space of the corresponding size (named bitmap-2) can be allocated based on the size of the memory space occupied by the source virtual machine, with each bit mapping to a smaller page size (e.g., 2KByte) as the mapping relationship. This space is used to record dirty pages during the virtual machine's iterative migration phase, thereby dynamically adjusting the dirty page labeling granularity of the hot migration hardware. This achieves the effects of reducing resource consumption and costs, improving hot migration efficiency, and enhancing the user experience.

[0098] In some embodiments of this application, the method further includes: determining the number of remaining dirty pages in the target virtual machine during the hot migration of memory; determining the migration status of the target virtual machine based on the number of remaining dirty pages; and initiating a shutdown migration of the target virtual machine when the migration status is the first status.

[0099] In some embodiments of this application, stop 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 status is in the first state, it means that the number of remaining dirty pages is small. The advantage of choosing stop migration at this time is that it can avoid the new dirty page data that may be generated during the continued operation of the virtual machine, reduce the workload of repeatedly checking and synchronizing dirty page data, and can more efficiently and accurately complete the migration of the remaining dirty page data in one go, 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.

[0100] Once the target virtual machine is determined to be in the first state, a stop command is first sent to the virtual machine management system or related control modules. Upon receiving the command, the virtual machine management system, in collaboration with the virtual machine operating system and the hardware virtualization layer, suspends all running processes and threads within the virtual machine, putting the virtual machine into a paused state. Then, using the existing data transmission channels, the data in the remaining dirty pages of memory is copied and migrated to the corresponding memory area at the target location as quickly as possible. After the migration of all remaining dirty page data is completed, the target virtual machine undergoes relevant startup configuration checks at the target location. Once everything is confirmed to be correct, the virtual machine is restarted, allowing it to continue running normally in the new location, thus completing the entire memory hot migration process. The migration state can be determined based on the amount of remaining dirty pages of memory, and appropriate strategies such as stop migration can be adopted in the appropriate migration state, which helps to improve the efficiency and success rate of memory hot migration and ensure the continuity and stability of the services carried by the virtual machine.

[0101] In some embodiments of this application, determining the migration state of the target virtual machine based on the number of remaining dirty pages in the target virtual machine includes: when the number of remaining dirty pages is less than a first threshold, the migration state of the target virtual machine is determined to be a first state; if the number of remaining dirty pages is greater than the first threshold, the migration state of the target virtual machine is determined to be a second state.

[0102] In some embodiments of this application, 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 statuses mean that different operations need to be taken subsequently, so as to ensure the smooth progress of the hot migration process and the rational use of resources.

[0103] You can set the target virtual machine to be in the first state when the number of remaining dirty pages is below a certain threshold (for example, setting the number of remaining dirty pages to be less than 10% of the total number of memory pages). This means that most of the memory data has been migrated or synchronized, and only a relatively small amount of dirty page data needs to be processed. At this time, you may consider taking some more efficient operations that may have a short-term impact on the operation of the virtual machine to quickly complete the migration.

[0104] When the number of remaining dirty pages exceeds a certain threshold (for example, setting the number of remaining dirty pages to be less than 10% of the total number of memory pages), the migration status of the target virtual machine can be determined to be the second state. At this time, shutdown migration is not allowed. This application can determine the migration status based on the number of remaining dirty pages and take corresponding strategies such as shutdown migration 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 services carried by the virtual machine.

[0105] Figure 3 shows a structural block diagram of a server provided in some embodiments of this application. The server may include a central controller (CPU), host memory (Double Data Rate SDRAM), and an FPGA (Field Programmable Gate Array).

[0106] The CPU can configure bitmap information of the FPGA to the corresponding registers through the PCIe (Peripheral Component Interconnect Express) interface. The FPGA's virtio (semi-virtualized I / O standard) virtual function can perform memory calculations and add a dmudged dma wr channel to update the bitmap based on the configuration value of the hardware smudge register. The management software in the CPU can monitor the virtual machine's migration of memory data and configure the FPGA to stop hardware smudges to the corresponding registers after the migration is completed. The FPGA then stops the hardware smudges of this virtual function.

[0107] Figure 4 illustrates a flowchart of a method for marking a virtual machine as dirty according to some embodiments of this application. First, the corresponding bitmap space is generated in the host. Then, the source address, maximum size, and page size are obtained. The source address, maximum size, and page size are then written into the virtual machine's virtual function. Then, marking as dirty is started. During the hot migration process, it is determined whether there are any historical bitmaps that have not been cleared. If there are any historical bitmaps that have not been cleared, the historical bitmaps are 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. It is monitored whether the bandwidth resources are greater than the preset bandwidth. If the bandwidth resources are greater than the preset bandwidth, a larger page size is requested for each bit in the host. If the bandwidth resources are less than the preset bandwidth, a shutdown migration is performed.

[0108] This application discloses a method for marking virtual machines as dirty. By first determining the space occupied by the target virtual machine, the mapping relationship between bits and page size in the host can be accurately determined based on its actual situation. This allows for the reasonable determination of bitmap space, avoiding the problem of bitmap space allocation being too large or too small. This achieves efficient resource adaptation and accurate utilization, reduces resource consumption and costs, and helps improve the overall storage resource utilization efficiency of the server. Furthermore, this application can adjust the migration efficiency of hot migration by adjusting the mapping relationship between bits and page size, thereby achieving more flexible hardware marking as dirty and improving user experience.

[0109] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that some embodiments of this application are not limited to the described order of actions, because according to some embodiments of this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that some embodiments described in the specification are all embodiments of this application, and the actions involved are not necessarily required by some embodiments of this application.

[0110] Referring to Figure 5, a virtual machine device according to some embodiments of this application is shown, applied to a server. The server includes a host and a programmable logic controller (PLC), and the PLC includes multiple virtual machines. The device includes:

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

[0112] The second determining module 202 is used to determine the mapping relationship between bits and page size in the host based on the space occupied by the target virtual machine;

[0113] The space determination module 203 is used to determine the corresponding bitmap space in the host according to the mapping relationship;

[0114] Module 204 is used to obtain the source address and maximum size in the bitmap space;

[0115] The dirty labeling 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 to label the target virtual machine as dirty.

[0116] This application discloses a dirty labeling device for virtual machines. By first determining the space occupied by the target virtual machine, it can accurately determine the mapping relationship between bits and page size in the host based on its actual situation, and then reasonably determine the bitmap space. This avoids the problem of bitmap space allocation being too large or too small, realizes efficient resource adaptation and accurate utilization, reduces resource consumption and cost, and helps to improve the overall storage resource utilization efficiency of the server. This application can adjust the migration efficiency of hot migration by adjusting the mapping relationship between bits and page size, thereby realizing more flexible hardware dirty labeling and improving user experience.

[0117] In some embodiments of this application, the dirty page marking module includes: a recording submodule, used to record the state of each memory page of the virtual machine through a migration bitmap during the hot migration of memory in the target virtual machine, and to monitor whether the memory pages of the target virtual machine have changed through the virtual machine monitor; and a marking gate, 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 pages of the target virtual machine have changed.

[0118] In some embodiments of this application, a detection module is also included, used to detect whether the bitmap data in the target virtual machine has been migrated when it is necessary to mark a new virtual machine as dirty;

[0119] The release module is used to release the bitmap space of the target virtual machine after the bitmap data in the target virtual machine has been migrated if the migration of bitmap data in the target virtual machine has not been completed.

[0120] Once the bitmap space of the target virtual machine has been released, the new virtual machine is marked as dirty.

[0121] In some embodiments of this application, the second determining module includes:

[0122] The first determining submodule is used to determine the mapping relationship between bits in the host and storage pages as the first mapping relationship when the space occupied by the target virtual machine is less than the first threshold.

[0123] In some embodiments of this application, the second determining module further includes:

[0124] The second determining submodule is used to determine the mapping relationship between bits in the host and storage pages as the second mapping relationship when the space occupied by the target virtual machine is greater than the first threshold.

[0125] Some embodiments of this application also include:

[0126] The third determination module is used to determine the number of remaining dirty pages in the target virtual machine during the hot migration of memory in the target virtual machine.

[0127] The fourth determination module is used to determine the migration status of the target virtual machine based on the amount of remaining dirty pages in the target virtual machine;

[0128] The startup module is used to initiate a shutdown migration of the target virtual machine when the migration status is in the first state.

[0129] In some embodiments of this application, the fourth determining module includes:

[0130] The judgment submodule is used to determine whether the number of remaining dirty pages is less than a first threshold.

[0131] The third determination submodule is used to determine the migration status of the target virtual machine as the first state when the number of remaining dirty pages is less than the first quantity threshold.

[0132] The fourth submodule is used to determine the migration status of the target virtual machine as the second state if the number of remaining dirty pages is greater than the first threshold.

[0133] This application discloses a dirty labeling device for virtual machines. By first determining the space occupied by the target virtual machine, it can accurately determine the mapping relationship between bits and page size in the host based on its actual situation, and then reasonably determine the bitmap space. This avoids the problem of bitmap space allocation being too large or too small, realizes efficient resource adaptation and accurate utilization, reduces resource consumption and cost, and helps to improve the overall storage resource utilization efficiency of the server. This application can adjust the migration efficiency of hot migration by adjusting the mapping relationship between bits and page size, thereby realizing more flexible hardware dirty labeling and improving user experience.

[0134] As the apparatus embodiment is basically similar to the method embodiment, it is described in a relatively simple manner. For relevant details, please refer to the description of the method embodiment.

[0135] Some embodiments of this application also provide an electronic device, including:

[0136] 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, it implements the various processes of the above-described virtual machine standard method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0137] Some embodiments of this application also provide a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements various processes of some embodiments of the virtual machine's marking method and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0138] Some embodiments in this specification are described in a progressive manner, and some embodiments focus on the differences from other embodiments. For the same or similar parts between some embodiments, please refer to each other.

[0139] Those skilled in the art will understand that embodiments of some of the embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, some embodiments of this application may take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, some embodiments of this application may take the form of computer program products 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 code.

[0140] Some embodiments of this application are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to some embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in one or more blocks of the flowchart illustrations and / or one or more blocks of the block diagrams.

[0141] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in one or more flowcharts and / or one or more block diagrams.

[0142] These computer program instructions may also be loaded onto a computer or other programmable data processing terminal equipment to cause a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, such that the instructions, which execute on the computer or other programmable terminal equipment, provide steps for implementing the functions specified in one or more flowcharts and / or one or more block diagrams.

[0143] Although some embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make further changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including all changes and modifications that fall within the scope of some embodiments as well as some embodiments of this application.

[0144] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes the element.

[0145] The above provides a detailed description of a virtual machine labeling method, apparatus, device, and storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for marking a virtual machine as dirty, characterized in that, The application is to a server, the server including a host and a programmable logic controller, the programmable logic controller including multiple virtual machines; The method includes: Determine the size of the space occupied by the target virtual machine in the programmable logic controller; Based on the space occupied by the target virtual machine, determine the mapping relationship between bits and page size in the host; The corresponding bitmap space is determined in the host according to the mapping relationship; Obtain the source address and maximum size in the bitmap space; The source address, maximum size, and page size in the bitmap space are written into the virtual function corresponding to the target virtual machine, and the target virtual machine is marked as dirty.

2. The method according to claim 1, characterized in that, The process of marking the target virtual machine as dirty includes: During the hot migration of memory in the target virtual machine, the state of each memory page of the virtual machine is recorded by a migration bitmap, and the memory pages of the target virtual machine are monitored by a virtual machine monitor to see if they have changed. When the target virtual machine monitor detects a change in the memory pages of the target virtual machine, the changed memory pages are marked as dirty pages in the migration bitmap.

3. The method according to claim 1, characterized in that, Also includes: When it is necessary to mark a new virtual machine as dirty, check 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, the bitmap space of the target virtual machine shall be released 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 as dirty.

4. The method according to claim 1, characterized in that, The step of determining the mapping relationship between bits in the host and storage pages based on the space occupied by the target virtual machine includes: When 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 is determined to be the first mapping relationship.

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

6. The method according to claim 1, characterized in that, Also includes: During the hot migration of memory in the target virtual machine, the number of remaining dirty pages in the target virtual machine is determined; The migration status of the target virtual machine is determined based on the amount of remaining dirty pages in the target virtual machine; When the migration status is in the first state, a shutdown migration of the target virtual machine is initiated.

7. The method according to claim 6, characterized in that, Determining the migration status of the target virtual machine based on the amount of remaining dirty pages in the target virtual machine includes: Determine whether the number of remaining dirty pages is less than a first threshold. When the number of remaining dirty pages is less than the first threshold, the migration status of the target virtual machine is determined to be the first state. If the number of remaining dirty pages is greater than the first threshold, then the migration status of the target virtual machine is determined to be the second state.

8. A device for marking a virtual machine, characterized in that, Applied to a server, the server including a host and a programmable logic controller, the programmable logic controller including multiple virtual machines; the device includes: The first determining module is used to determine the size of the space occupied by the target virtual machine in the programmable logic controller; The second determining module is used to determine the mapping relationship between bits and page size in the host based on the space occupied by the target virtual machine; A space determination module is used to determine the corresponding bitmap space in the host according to the mapping relationship; The acquisition module is used to acquire the source address and maximum size in the bitmap space; The dirty labeling module 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 to label the target virtual machine as dirty.

9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor being configured to perform the steps of the virtual machine labeling method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the virtual machine's marking method as described in any one of claims 1-7.