Virtual machine management method and device, electronic equipment and storage medium

By configuring memory areas that share the same memory address for all queues of virtual machines, the problem of long downtime during hot migration in cloud computing environments is solved, and more efficient memory management and faster virtual machine startup and migration are achieved.

CN120045273APending Publication Date: 2025-05-27BEIJING BAIDU NETCOM SCI & TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411897331.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-20
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

In a cloud computing environment, the downtime of virtual machines during hot migration is long, affecting business continuity and system performance.

Method used

By obtaining and parsing the virtual machine's startup parameters, when the queue zero offset attribute is detected, all queues of the virtual machine are configured to share the same memory address, and memory layout and management are optimized.

Benefits of technology

This configuration simplifies memory management, reduces memory fragmentation, reduces the number of memory changes requests during hot migration, significantly reduces the downtime of virtual machine startup and hot migration, and improves the response speed of virtual machines and the operating efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045273A_ABST
    Figure CN120045273A_ABST
Patent Text Reader

Abstract

The invention provides a virtual machine management method and device, electronic equipment and a storage medium, and relates to the technical field of cloud computing, in particular to the technical field of virtualization. According to the specific implementation scheme, starting parameters of the virtual machine are obtained; analyzing the starting parameter to obtain an analysis result; if the analysis result contains the queue zero offset attribute, configuring a memory area sharing the same memory address for all queues of the virtual machine; and after all queues are configured, starting the virtual machine. According to the method and the device, the memory layout is optimized by sharing the page attributes of the memory, so that the memory change application times in the live migration process are reduced, and the starting time of the virtual machine and the downtime of live migration are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of cloud computing technology, specifically to the field of virtualization technology, and particularly to a virtual machine management method, apparatus, electronic device, and storage medium. Background Art

[0002] In a cloud computing environment, the virtual machine (VM) is a basic computing unit, and its live migration technology is particularly important. The live migration technology allows a virtual machine to be migrated from one physical machine (source) to another physical machine (destination) without interrupting the operation of the virtual machine. The core advantage of this technology is that it can decouple the virtual machine from the underlying hardware, making resource management more flexible and improving the utilization rate of shared resources. Through live migration, the cloud system can migrate virtual machines from overloaded physical machines to lightly loaded physical machines according to the load conditions of the physical machines, achieving load balancing and ensuring the overall performance and stability of the system.

[0003] However, the live migration process is not completely lossless, and the impact on the services within the virtual machine is usually measured by downtime. Downtime refers to the time when the virtual machine services are paused during the live migration process, which is an important indicator for evaluating the impact of the live migration technology on services. Although the live migration technology can bring many benefits, how to reduce downtime and achieve smoother and faster migration has always been the focus of research and optimization in the cloud computing field. Therefore, developing a live migration optimization method that can significantly reduce downtime is of great significance for improving the quality of cloud computing services and user satisfaction. Summary of the Invention

[0004] The present disclosure provides a virtual machine management method, apparatus, electronic device, and storage medium.

[0005] According to one aspect of the present disclosure, there is provided a virtual machine management method, the method including:

[0006] Obtaining startup parameters of a virtual machine;

[0007] Parsing the startup parameters to obtain a parsing result;

[0008] If the parsing result includes a queue zero offset attribute, configuring a memory area with the same memory address for all queues of the virtual machine;

[0009] After all queues are configured, starting the virtual machine.

[0010] According to another aspect of the present disclosure, there is provided a virtual machine management apparatus, the apparatus including:

[0011] An obtaining module, configured to obtain startup parameters of a virtual machine;

[0012] A parsing module for parsing the startup parameters to obtain a parsing result;

[0013] A configuration module for, if the parsing result contains a queue zero-offset attribute, configuring a memory area with the same memory address for all queues of the virtual machine;

[0014] A startup module for starting the virtual machine after all queues are configured.

[0015] According to a third aspect of the present disclosure, there is provided an electronic device, including:

[0016] At least one processor; and

[0017] A memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in any one of the above technical solutions.

[0019] According to a fourth aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method described in any one of the above technical solutions.

[0020] According to a fifth aspect of the present disclosure, there is provided a computer program product including a computer program, and the computer program implements the method described in any one of the above technical solutions when executed by a processor.

[0021] The present disclosure provides a virtual machine management method, apparatus, device, and storage medium. By obtaining and parsing the startup parameters of the virtual machine, when the queue zero-offset attribute can be detected, a memory area with the same memory address is configured for all queues of the virtual machine. This configuration not only simplifies memory management, reduces memory fragmentation, but also optimizes the memory layout through shared memory page attributes, thereby reducing the number of memory change applications during the live migration process and reducing the downtime of virtual machine startup and live migration. Finally, these optimizations work together to improve the response speed of the virtual machine and the overall system operation efficiency, providing strong support for resource management and business continuity in the cloud computing environment.

[0022] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings are used to better understand the present solution and do not constitute a limitation to the present disclosure. Among them:

[0024] Figure 1 is a system block diagram of an exemplary virtual machine management method;

[0025] Figure 2 is a schematic diagram of the steps of the virtual machine management method in an embodiment of the present disclosure;

[0026] Figure 3 is a schematic flow diagram of the virtual machine management method in an embodiment of the present disclosure;

[0027] Figure 4 is a system block diagram of the virtual machine management method in an embodiment of the present application;

[0028] Figure 5 is a schematic flow diagram of the live migration using the embodiment of the present application;

[0029] Figure 6 The principle block diagram of the virtual machine management device in an embodiment of the present disclosure;

[0030] Figure 7 is a block diagram of an electronic device for implementing the virtual machine management method in an embodiment of the present disclosure. Detailed implementation manners

[0031] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted below.

[0032] Refer to Figure 1 , Figure 1 is a system block diagram of an exemplary virtual machine management method. In this block diagram, there is a VM (virtual machine), which refers to an operating system instance running in a virtualized environment. In the figure, the virtual machine includes two virtio queues (queue1 and queue2) for data transmission.

[0033] QEMU (virtual machine monitor), which is used to simulate the hardware devices of the virtual machine, including virtio queues and a notification register (notify reg). QEMU is responsible for managing the device queues of the virtual machine and transferring data and control information to the host machine.

[0034] The host kernel, which is responsible for managing hardware resources and virtualization functions. The host kernel interacts with QEMU through the KVM module.

[0035] KVM (Kernel-based Virtual Machine, virtualization extensions in the host kernel) is used to provide hardware-assisted virtualization functions. The KVM module interacts with the QEMU and vDPA devices to manage the memory and processor resources of virtual machines.

[0036] EPT (Extended Page Table) is used to map the guest physical address (GPA) of a virtual machine to the host physical address (HPA).

[0037] vDPA device (Virtio Data Path Acceleration Device, a hardware device) is used to accelerate the virtio data path.

[0038] In addition, the Control path is used to manage the configuration and status of virtual machines, such as creation, startup, stop, etc. In the figure, the control path is represented by a dashed line.

[0039] Data path is used for data transmission, such as sending and receiving network packets. In the figure, the data path is represented by a solid line.

[0040] Specifically, during the stage of starting the vhost-user (virtual host user backend) device, QEMU registers a host notifier for each queue of the device, and each time it needs to submit an application for memory change to KVM. Subsequently, the KVM module of the host creates an EPT for each host notifier. Similarly, during the stage of stopping the vhost-user device, QEMU also needs to notify KVM to change the memory area of the queue. When the guest machine sends data, the data is written to the host notifier mapped by the queue and then directly written to the vDPA device through the EPT.

[0041] With the rapid development of current cloud services, the requirements for the performance of virtual machines are getting higher and higher. Each virtual machine is configured with multiple devices, and each device is assigned multiple queues. For example, if a virtual machine has n devices and each device has m queues, then QEMU needs to submit n*m applications for memory change to KVM. The operation of submitting memory changes itself is time-consuming, and frequently submitting applications for memory change during the live migration process will increase the downtime of the virtual machine. The virtual machine is in the exited state for a long time, and there is a certain probability that the virtual machine kernel will directly crash, causing immeasurable impacts.

[0042] To solve the above technical problems, the present disclosure provides a virtual machine management method, see Figure 2 as shown.Figure 2 It is a schematic diagram of the steps of the virtual machine management method in an embodiment of the present disclosure. This method can be applied to a hypervisor, and the method includes:

[0043] Step S201, obtain the startup parameters of the virtual machine.

[0044] Specifically, "obtain the startup parameters of the virtual machine" means that during the life cycle management of a virtual machine (VM), necessary information and settings are collected from the virtual machine's configuration file or user input through a virtualization management tool (such as libvirtd). These parameters define the hardware configuration and behavioral characteristics of the virtual machine. The startup parameters can include the memory size, the number of processor cores, network interface configuration, storage device mapping, and advanced settings specific to the virtualization platform, such as the attributes of virtio (virtual machine input / output interface) devices.

[0045] When obtaining the startup parameters of the virtual machine, first, a virtualization management tool can be used to check the virtual machine's configuration file. The configuration file is usually a file stored in XML format and contains all the configuration details of the virtual machine. Then, the virtualization management tool parses these configurations to identify the parameters required for the virtual machine to start, including parameters related to virtio device performance optimization, such as page_per_vq (shared memory page attribute) and vq_noffset_zero (queue zero offset attribute). These parameters allow the virtual machine to configure its virtio devices at startup to achieve memory page sharing of queues and zero-based queue offsets, thereby improving the I / O (input / output) performance and live migration efficiency of the virtual machine.

[0046] Step S202, parse the startup parameters to obtain a parsing result.

[0047] Specifically, the startup parameters are a series of instructions and options that define the hardware configuration and behavioral characteristics of the virtual machine, and may include memory allocation, the number of processors, network interface settings, storage device mapping, and advanced features specific to the virtualization platform, such as the page_per_vq and vq_noffset_zero attributes of virtio devices. After obtaining the startup parameters, the startup parameters are parsed to obtain a parsing result. When parsing the startup parameters, a virtualization management tool (such as libvirtd) can be used to interpret the startup parameters in the virtual machine (VM) configuration file in detail.

[0048] The implementation process of the embodiments of the present disclosure includes: The virtualization management tool first extracts these parameters from the configuration file of the virtual machine. Among them, the configuration file usually adopts the XML format and contains all the configuration details of the virtual machine. Then, the virtualization management tool parses these parameters to identify the key information required for the virtual machine to start. The parsing result will be used as the basis for subsequent steps to guide the hypervisor (such as QEMU) on how to configure hardware resources and optimize performance for the virtual machine. For example, if the parsing result contains the vq_noffset_zero attribute, QEMU will configure a memory area with the same memory address for all virtio queues of the virtual machine and set the offset of each queue to zero. Such a configuration can improve memory access efficiency and reduce the downtime during the live migration process.

[0049] In this way, through this parsing process, the virtualization management tool can ensure that the virtual machine starts correctly according to the preset configuration, and at the same time lays a foundation for the efficient operation and performance optimization of the virtual machine. This step is crucial for realizing the rapid deployment, flexible management and high-performance operation of the virtual machine.

[0050] Step S203, if the parsing result contains the queue zero offset attribute, configure a memory area with the same memory address for all queues of the virtual machine.

[0051] Specifically, the "queue zero offset attribute" (vq_noffset_zero) is a key configuration parameter used to optimize the memory offsets of all queues in the virtio devices of the virtual machine to start from zero uniformly. When the virtualization management tool (such as libvirtd) parses the startup parameters of the virtual machine, if it detects that this attribute is set to the enabled state, it will instruct the hypervisor to configure a shared memory area for all virtio queues in the virtual machine. This memory area is mapped into the address space of the virtual machine, allowing the queues to access directly without additional address translation.

[0052] In this way, all queues start from the starting address of the shared memory area, simplifying memory management and reducing memory fragmentation. This configuration not only optimizes the memory layout of the virtual machine but also significantly improves the performance of the virtual machine during the live migration process. In this way, this solution realizes the rapid deployment, flexible management and high-performance operation of the virtual machine, providing strong support for resource management and business continuity in the cloud computing environment.

[0053] Step S204, after all queues are configured, start the virtual machine.

[0054] Specifically, the queue refers to the queue in the virtual machine for processing I / O operations, which plays a crucial role in transferring data between the virtual machine and the host machine. After configuring a shared memory area for all virtio queues in the virtual machine in the aforementioned manner, QEMU will send a request to start the virtual machine to the virtualization kernel module (such as KVM) of the host machine. KVM is then responsible for starting the virtual machine, which includes loading the operating system of the virtual machine, initializing virtual hardware devices, and starting the startup process of the virtual machine. During the startup process of the virtual machine, KVM uses extended page table (EPT) mapping to manage the memory access of the virtual machine, ensuring that the guest physical address (GPA) of the virtual machine can be correctly mapped to the host physical address (HPA). This mapping is crucial for achieving high-performance operation of the virtual machine, as it reduces the overhead of address translation and improves the memory access speed. In this way, this solution ensures that the virtual machine can operate with optimized performance when starting up, while providing an efficient and flexible operating environment for the virtual machine, which is crucial for the operation of cloud computing and data centers.

[0055] The present disclosure provides a virtual machine management method, apparatus, device, and storage medium. The present disclosure obtains and parses the startup parameters of the virtual machine, and when the queue zero-offset attribute can be detected, configures a memory area with the same shared memory address for all queues of the virtual machine. This configuration not only simplifies memory management, reduces memory fragmentation, but also optimizes the memory layout through the shared memory page attribute, thereby reducing the number of memory change requests during the live migration process and reducing the downtime of virtual machine startup and live migration. Ultimately, these optimizations work together to improve the response speed of the virtual machine and the operating efficiency of the overall system, providing strong support for resource management and business continuity in the cloud computing environment.

[0056] In some alternative embodiments, before obtaining the startup parameters of the virtual machine, the method further includes:

[0057] Obtain the configuration file of the virtual machine;

[0058] Add the queue zero-offset attribute to the configuration file through the virtualization management tool and set the queue zero-offset attribute to the enabled state.

[0059] Specifically, obtaining the configuration file of the virtual machine involves extracting a file that defines the characteristics and resource allocation of the virtual machine (VM) from the storage medium. The file is usually in XML format and contains the hardware configuration, network interface, storage device and other key parameters of the virtual machine. Next, the queue zero offset attribute is added to the configuration file through the virtualization management tool and the queue zero offset attribute is set to the on state. This step refers to editing the configuration file of the virtual machine using a virtualization management tool such as libvirtd to include a specific virtio device attribute, namely the queue zero offset attribute (vq_noffset_zero). This attribute allows all virtio queues to start from the same base address in memory, thereby optimizing the memory access mode and I / O performance of the virtual machine.

[0060] The implementation process of the disclosed embodiment includes: first, accessing the configuration file of the virtual machine through the virtualization management tool, and then adding or modifying the vq_noffset_zero attribute and setting its value to 'on' to enable this feature. Subsequently, the virtual machine hypervisor (such as QEMU) will parse this updated configuration file and configure the corresponding memory layout for the virtio device according to the setting of the vq_noffset_zero attribute. This includes allocating a shared memory area for all queues and ensuring that the memory offset of each queue starts from zero. In this way, it is possible to utilize the optimized memory layout to improve its operating efficiency, especially when processing a large number of I / O operations. In addition, this configuration also helps to reduce the downtime of the virtual machine during hot migration, because the configuration of the shared memory area reduces the number of memory change applications, thereby improving the availability and overall performance of the virtual machine.

[0061] In this way, by obtaining the virtual machine's configuration file and using the virtualization management tool to add the queue zero offset attribute (vq_noffset_zero) to it, and setting it to the on state, it is beneficial for all subsequent virtio queues to start from the same base address in memory, thereby reducing memory fragmentation and improving memory access efficiency. This configuration not only improves the I / O performance of the virtual machine, but also helps to reduce downtime during hot migration.

[0062] In some optional embodiments, before obtaining the startup parameters of the virtual machine, the method further includes:

[0063] Use the virtualization management tool to add the shared memory page attribute to the configuration file and enable the shared memory page attribute to indicate that all queues of the virtual machine share the same memory area.

[0064] Specifically, "adding a shared memory page attribute to the configuration file through a virtualization management tool and setting the shared memory page attribute to the enabled state" involves using a virtualization management tool such as libvirtd to modify the configuration file of a virtual machine, which is an XML document defining the characteristics and resource allocation of the virtual machine. The shared memory page attribute (usually the page_per_vq attribute) is a specific configuration item that indicates that all virtio queues in the virtual machine should share a continuous memory page to achieve efficient memory utilization and optimized data transmission.

[0065] The implementation process of the embodiments of the present disclosure includes: using a virtualization management tool to open the configuration file of the virtual machine, adding or modifying the page_per_vq attribute, and setting its value to 'on' to enable the shared memory page function. This setting tells the hypervisor (such as QEMU) to allocate a shared memory area for all virtio queues when the virtual machine starts. When QEMU starts the virtual machine, according to this configuration, it will establish an extended page table (EPT) mapping for the shared memory area through the virtualization kernel module (such as KVM) of the host machine, ensuring that the guest physical address (GPA) of the virtual machine can be mapped to the host physical address (HPA). In this way, all virtio queues can access this shared memory area, thereby reducing the memory allocation overhead and improving the memory access efficiency.

[0066] In this way, by adding and enabling the shared memory page attribute in the configuration file of the virtual machine, it is indicated that all virtio queues of the virtual machine share the same memory area. Since the shared memory page reduces the memory allocation overhead and fragmentation, the communication between queues becomes more direct and fast, thereby improving the memory usage efficiency and I / O performance of the virtual machine.

[0067] In some alternative embodiments, if the parsing result contains the queue zero offset attribute, configuring a memory area with the same memory address for all queues of the virtual machine includes:

[0068] If the parsing result contains the queue zero offset attribute, set the queue offsets of all queues of the virtual machine to 0.

[0069] Specifically, the "queue zero offset attribute" (vq_noffset_zero) is a specific configuration parameter used to optimize the memory offsets of all queues in the virtio devices of a virtual machine to start uniformly from zero. When a virtualization management tool (such as libvirtd) parses the startup parameters of a virtual machine and identifies this attribute, it instructs the hypervisor (such as QEMU) during the initialization process to configure the memory for all virtio queues in the virtual machine, setting the offset of each queue to 0. That is, QEMU will allocate memory for each virtio queue according to the parameters passed by libvirtd and ensure that the starting address offset of each queue is zero. In this way, all queues start from the starting address of the shared memory area, simplifying memory management and reducing memory fragmentation.

[0070] In this way, if the queue zero offset attribute is detected in the parsing result, the queue offsets of all virtio queues of the virtual machine are uniformly set to 0. This measure ensures that all queues can start from the starting address of the shared memory area, thereby reducing memory fragmentation and improving the consistency of memory access. This optimization not only improves the memory management efficiency of the virtual machine but also significantly reduces the downtime caused by memory change requests, especially during the live migration process. In this way, the virtual machine can achieve faster startup and migration, improving the flexibility of resources and the operating efficiency of the system in the cloud computing environment, providing strong support for business continuity and high-performance computing.

[0071] In some alternative embodiments, after parsing the startup parameters to obtain a parsing result, the method further includes:

[0072] If the parsing result includes the shared memory page attribute, allocate pointers to memory regions with the same memory address for all queues of the virtual machine.

[0073] Specifically, the "shared memory page attribute" (page_per_vq) is a key configuration parameter used to optimize the memory management of virtio devices in a virtual machine. When a virtualization management tool (such as libvirtd) parses the startup parameters of a virtual machine and detects that the shared memory page attribute is included and set to the enabled state, it will instruct the hypervisor (such as QEMU) to allocate memory for all virtio queues in the virtual machine. That is, QEMU will allocate pointers to memory regions with the same memory address for all virtio queues according to the shared memory page attribute in the configuration file. This means that all queues will share a continuous memory page, thereby reducing the memory allocation overhead and improving the memory access efficiency. This configuration allows data to be transferred more quickly between the virtual machine and the host because the shared memory area reduces the need for data copying and context switching.

[0074] In this way, when the virtualization management tool parses the shared memory page attributes, it instructs the hypervisor (such as QEMU) to allocate pointers to memory regions with the same memory address for all virtio queues, enabling these queues to share a continuous memory page. This shared memory layout reduces the memory allocation overhead, improves the efficiency of memory access, and reduces the downtime caused by memory change requests, especially during the live migration of virtual machines.

[0075] In some alternative embodiments, the method further includes:

[0076] For the memory region with the same memory address, create a corresponding extended page table for the memory region to map the guest physical address of the virtual machine to the host physical address.

[0077] Specifically, "Extended Page Tables" (EPT) are used by the hypervisor to create and manage a set of page tables for the virtual machine. These page tables map the guest physical addresses (GPAs) of the virtual machine to the host physical addresses (HPAs). This mapping process is crucial for the memory management and performance of the virtual machine.

[0078] In this solution, when the virtual machine's configuration file contains shared memory page attributes and all virtio queues are configured to share a memory region with the same memory address, the hypervisor (such as KVM) creates a corresponding extended page table for this shared memory region. This process involves initializing the EPT page table structure, allocating EPT page table entries for the shared memory region, and associating these page table entries with the memory pages of the virtual machine. Through EPT mapping, the virtual machine can efficiently access the host physical memory without additional address translation. Specifically, the hypervisor (such as QEMU) collaborates with the virtualization kernel module of the host (such as KVM) to ensure the correctness and consistency of EPT mapping. When the virtual machine accesses the shared memory region, EPT mapping enables the GPA of the virtual machine to be directly converted to HPA, thereby reducing the address translation overhead and improving the memory access speed. This mapping also helps to maintain the continuity of memory access during the live migration of the virtual machine because the EPT mapping of the shared memory region remains unchanged before and after migration.

[0079] In this way, by creating corresponding extended page tables (EPTs) for memory regions with the same memory address shared by virtual machines, an efficient mapping from guest physical address (GPA) of the virtual machine to host physical address (HPA) is achieved. Through this mapping mechanism, the virtual machine can directly access physical memory without performing address translation through the host kernel, thereby reducing the latency of memory access and the overhead of context switching. This mapping mechanism significantly improves the memory access performance of the virtual machine. In addition, the optimization of EPT mapping ensures the continuity and consistency of memory access during migration, reduces the additional overhead caused by address translation, and thus reduces the downtime during live migration. These beneficial effects together improve the response speed of the virtual machine and the operating efficiency of the overall system, providing strong support for resource management and business continuity in the cloud computing environment.

[0080] To facilitate the overall understanding of the technical solution of this application, refer to Figure 3 , Figure 3 which is a schematic flowchart of the virtual machine management method in the embodiments of the present disclosure. Specifically, this flowchart includes:

[0081] Step S301: Obtain the startup parameters of the virtual machine.

[0082] Step S302: Parse the startup parameters to obtain the parsing result.

[0083] Step S303: Determine whether the parsing result contains the queue zero-offset attribute.

[0084] Step S304: If yes, add a feature flag with a queue offset of zero to all queues.

[0085] Step S305: Determine whether the parsing result contains the shared memory page attribute.

[0086] Step S306: If yes, add a feature flag of one page per queue to all queues.

[0087] Step S307: Configure a memory region with the same memory address for all queues of the virtual machine.

[0088] Step S308: If the parsing result does not contain the queue zero-offset attribute or the shared memory page attribute, allocate a section of memory for each queue respectively.

[0089] By executing steps S301 to S308, this solution realizes the comprehensive parsing of virtual machine startup parameters and intelligent configuration based on the parsing results. When the parsing result contains the queue zero offset attribute, step S304 adds a feature flag with a queue offset of zero to all queues, which helps simplify memory management and reduce memory fragmentation. At the same time, if the parsing result contains the shared memory page attribute, step S306 ensures that all queues share a memory area with the same memory address, which further optimizes memory usage and improves memory access efficiency. The implementation of steps S307 and S308 ensures that regardless of whether specific optimization attributes are enabled, the queues of the virtual machine can obtain appropriate memory configuration, thus while ensuring the flexibility of the system, it also significantly improves the performance of the virtual machine and the efficiency of live migration, reduces downtime, and enhances the utilization rate of resources and business continuity in the cloud computing environment.

[0090] See Figure 4 , Figure 4 is the system block diagram of the virtual machine management method of the embodiment of the present application. If the above method is adopted, during the process of QEMU starting a virtual machine, QEMU only allocates one shared 4K host notifier for all queues of a single device for communication with the vhost user device. Since there is only one piece of shared memory occupied by the host notifier, QEMU only needs to submit an application for memory area change to KVM once and create an EPT. When the virtual machine accesses the host notifier memory area, it can directly communicate with the vDPA device through the EPT page table without the virtual machine exiting.

[0091] See Figure 5 , Figure 5 is the schematic flow chart of live migration adopting the embodiment of the present application. This flow chart shows the interaction steps between components at the source end and the target end during the live migration of the virtual machine, and how to optimize the downtime through the technical solution. The following is a detailed analysis in combination with the technical solution of the present application:

[0092] 1. The target - end QEMU creates a virtual machine: In the preparation stage of live migration, the QEMU at the target end first creates a virtual machine instance, but at this time, the vCPU (virtual central processing unit) of the virtual machine does not run.

[0093] 2. Dirty page copy: The source - end QEMU starts to copy the dirty pages (modified pages) in the virtual machine memory to the target end. This step is carried out in the background to maintain data consistency during the migration process.

[0094] 3. Monitor the dirty page generation rate: The source QEMU monitors the dirty page generation rate. When the rate drops below a certain threshold, it indicates that the memory modification activities of the virtual machine have decreased, making it suitable for the next operation.

[0095] 4. Stop the vCPU rotation: After the dirty page generation rate decreases, the source QEMU stops the rotation of all vCPUs to ensure that no new dirty pages are generated, preparing for migration.

[0096] 5. Copy the dirty pages and device status: The source QEMU continues to copy the remaining dirty pages and the virtual machine's device status information to the target side to ensure that the target virtual machine can accurately reflect the status of the source side.

[0097] 6. Memory region information interaction: The target QEMU interacts with the vDPA user-space process for memory region information to prepare for receiving data.

[0098] 7. Create an EPT mapping: On the target side, QEMU creates an EPT mapping for the vDPA device. This is to ensure that the virtual machine can correctly access memory after the live migration is completed.

[0099] 8. Start the vCPU: After ensuring that all data and status information have been migrated to the target side, the target QEMU starts the vCPU to enable the virtual machine to continue running on the new physical machine.

[0100] 9. Destroy the source virtual machine: After confirming that the virtual machine has been successfully migrated and is running stably on the target side, the source QEMU destroys the virtual machine instance to release resources.

[0101] In steps 2 and 5, by configuring the shared memory page property (page_per_vq) and queue zero offset property (vq_noffset_zero) for the vhost user device described in this application, QEMU can configure memory regions with the same memory address for all queues. This reduces the need to configure memory separately for each queue during live migration, thereby reducing the number of memory change requests and optimizing the downtime.

[0102] In step 7, since all queues share the same memory page, when the target QEMU creates an EPT mapping, it only needs to create a mapping for the shared memory region once, rather than creating a mapping for each queue separately, which further reduces the downtime.

[0103] Through these optimizations, the technical solution of this application significantly improves the efficiency of virtual machine live migration, reduces the downtime, and enhances the flexibility of resources and the business continuity in the cloud computing environment.

[0104] The following introduces the device embodiments of the present application, which can be used to execute the virtual machine management method in the above embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the embodiments of the virtual machine management method above of the present application.

[0105] The present disclosure also provides a virtual machine management device 600, as Figure 6 shown, including:

[0106] An obtaining module 601, configured to obtain startup parameters of a virtual machine;

[0107] An analyzing module 602, configured to analyze the startup parameters to obtain an analysis result;

[0108] A configuring module 603, configured to, if the analysis result includes a queue zero offset attribute, configure a memory area with the same memory address for all queues of the virtual machine;

[0109] A starting module 604, configured to start the virtual machine after all queue configurations are completed.

[0110] In some optional embodiments, before obtaining the startup parameters of the virtual machine, the obtaining module 601 is further configured to obtain a configuration file of the virtual machine;

[0111] Add a queue zero offset attribute to the configuration file through a virtualization management tool, and set the queue zero offset attribute to an enabled state.

[0112] In some optional embodiments, before obtaining the startup parameters of the virtual machine, the obtaining module 601 is further configured to add a shared memory page attribute to the configuration file through a virtualization management tool, and set the shared memory page attribute to an enabled state to indicate that all queues of the virtual machine share the same memory area.

[0113] In some optional embodiments, if the analysis result includes a queue zero offset attribute, the configuring module 603 configures a memory area with the same memory address for all queues of the virtual machine, including:

[0114] If the analysis result includes a queue zero offset attribute, set the queue offsets of all queues of the virtual machine to 0.

[0115] In some optional embodiments, after analyzing the startup parameters to obtain an analysis result, the configuring module 603 is further configured to, if the analysis result includes a shared memory page attribute, allocate pointers to memory areas with the same memory address for all queues of the virtual machine.

[0116] In some alternative embodiments, the apparatus further includes a creation module, configured to create a corresponding extended page table for a memory area of the same memory address, so as to map the guest physical address of the virtual machine to the physical address of the host machine.

[0117] In the technical solution of the present disclosure, the acquisition, storage, and application of the user's personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good customs.

[0118] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.

[0119] Figure 7 FIG. shows a schematic block diagram of an exemplary electronic device 700 that can be used to implement the embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as, for example, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as, for example, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely exemplary and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0120] As Figure 7 shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0121] A plurality of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0122] The computing unit 701 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 701 executes the various methods and processes described above, such as the virtual machine management method. For example, in some embodiments, the virtual machine management method can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the small program distribution described above can be executed. Alternatively, in other embodiments, the computing unit 701 can be configured to execute the virtual machine management method in any other suitable way (e.g., by means of firmware).

[0123] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a dedicated or general-purpose programmable processor, and can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0124] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to the processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program codes can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0125] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0126] To provide for interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic, speech, or tactile input).

[0127] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0128] A computer system can include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server incorporating a blockchain.

[0129] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitations are imposed herein.

[0130] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub - combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.

Claims

1. A virtual machine management method, the method comprising: Get the startup parameters of the virtual machine; Parsing the startup parameters to obtain parsing results; If the parsing result includes a queue zero offset attribute, configuring a memory area that shares the same memory address for all queues of the virtual machine; After all queues are configured, the virtual machine is started.

2. The method according to claim 1, wherein: Before obtaining the startup parameters of the virtual machine, the method further includes: Obtaining a configuration file of the virtual machine; A queue zero offset attribute is added to the configuration file through a virtualization management tool, and the queue zero offset attribute is set to an on state.

3. The method according to claim 2, wherein: Before obtaining the startup parameters of the virtual machine, the method further includes: A shared memory page attribute is added to the configuration file through the virtualization management tool, and the shared memory page attribute is turned on to indicate that all queues of the virtual machine share the same memory area.

4. The method according to claim 1, wherein: If the parsing result includes a queue zero offset attribute, configuring a memory area that shares the same memory address for all queues of the virtual machine includes: If the parsing result includes the queue zero offset attribute, the queue offsets of all queues of the virtual machine are set to 0.

5. The method according to claim 1, wherein: After parsing the startup parameters to obtain the parsing results, the method further includes: If the parsing result includes a shared memory page attribute, pointers pointing to a memory area at the same memory address are allocated to all queues of the virtual machine.

6. The method according to any one of claims 1 to 5, wherein: The method further comprises: For a memory region with the same memory address, a corresponding extended page table is created for the memory region to map the client physical address of the virtual machine to the physical address of the host machine.

7. A virtual machine management device, comprising: An acquisition module is used to obtain startup parameters of a virtual machine; A parsing module, used to parse the startup parameters to obtain parsing results; A configuration module, configured to configure a memory area sharing the same memory address for all queues of the virtual machine if the parsing result includes a queue zero offset attribute; The startup module is used to start the virtual machine after all queues are configured.

8. The device according to claim 7, wherein: Before obtaining the startup parameters of the virtual machine, the acquisition module is also used to obtain the configuration file of the virtual machine; A queue zero offset attribute is added to the configuration file through a virtualization management tool, and the queue zero offset attribute is set to an on state.

9. The device according to claim 8, wherein: Before obtaining the startup parameters of the virtual machine, the acquisition module is further used to add a shared memory page attribute to the configuration file through the virtualization management tool, and set the shared memory page attribute to an open state to indicate that all queues of the virtual machine share the same memory area.

10. The device according to claim 7, wherein: If the parsing result includes the queue zero offset attribute, the configuration module configures a memory area sharing the same memory address for all queues of the virtual machine, including: If the parsing result includes the queue zero offset attribute, the queue offsets of all queues of the virtual machine are set to 0.

11. The device according to claim 7, wherein: After parsing the startup parameters to obtain the parsing result, the configuration module is further used to allocate pointers to the memory area pointing to the same memory address for all queues of the virtual machine if the parsing result includes a shared memory page attribute.

12. The device according to any one of claims 7 to 11, wherein: The device also includes a creation module, which is used to create a corresponding extended page table for the memory area with the same memory address, so as to map the client physical address of the virtual machine to the physical address of the host machine.

13. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

14. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.

15. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.