A method, device, equipment and storage medium for virtual machine memory management

CN117762562BActive Publication Date: 2026-09-25INTEWELL (GUANGZHOU) SOFEWARE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311781472.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-21
Publication Date
2026-09-25
Estimated Expiration
2043-12-21

AI Technical Summary

Technical Problem

[0004]type1虚拟化技术发展了很久,且技术相对成熟,但在嵌入式领域中使用起来较为困难,其体现在两个方面,一是其代码体量较大,适配维护难度较高,二是type1虚拟机管理程序对计算机资源有一定消耗,在低成本硬件平台上type1使用资源占比较高

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117762562B_ABST
    Figure CN117762562B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a kind of virtual machine memory management method, device, equipment and storage medium, the method comprises: according to the resource configuration file of first virtual machine generated in advance, the hardware resource of first virtual machine is configured, wherein the resource configuration file of each virtual machine includes the configuration information of the hardware resource of this virtual machine in the resource description file of target machine, the page table of this virtual machine and the address space of page table;According to the address space of first virtual machine page table, page table memory is allocated for virtual machine, and page table is written therein;First virtual machine is started on the hardware resource of first virtual machine using the resource description file of first virtual machine;According to page table, the independent memory and physical device of first virtual machine are accessed.The technical scheme of the embodiment of the present application configures resources by generating the resource configuration file including page table of virtual machine offline, reduces the resource consumption of memory virtualization, and realizes the virtualization of resources on the target machine with lower configuration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of embedded operating systems, and particularly to a method, apparatus, device, and storage medium for virtual machine memory management. Background Technology

[0002] Existing Type 1 virtualization technologies, such as Xen, ACRN, and Xvisor, are mainly derived from server virtualization technologies. They include complete virtualization layers and architectures (including VBIOS, VCPU, virtual memory, virtual interrupt controllers, virtual devices, etc.), with detailed content, a clear structure, and a large amount of code.

[0003] On embedded platforms, due to hardware resource limitations or cost considerations, there are high requirements for the computing and storage resources consumed by the hypervisor.

[0004] Type 1 virtualization technology has been developing for a long time and is relatively mature, but it is difficult to use in the embedded field. This is due to two reasons: first, its code is large and difficult to adapt and maintain; second, the Type 1 virtual machine hypervisor consumes computer resources, and Type 1 uses a relatively high proportion of resources on low-cost hardware platforms. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method, apparatus, device, and storage medium for virtual machine memory management. The technical solution of the present invention performs resource virtualization and manages virtual machine memory on a target machine based on type 1 virtualization. Resources are configured by generating a resource configuration file including page tables for the virtual machine offline. During virtual machine operation, the virtual machine accesses its independent memory and physical devices through pre-generated page tables, reducing the resource consumption of memory virtualization on the target machine. Hardware resource virtualization is achieved on a target machine with lower configuration, thereby reducing the difficulty and workload of system security authentication.

[0006] In a first aspect, embodiments of the present invention provide a method for virtual machine memory management, comprising: configuring the hardware resources of a first virtual machine according to a resource configuration file of the first virtual machine, wherein the resource configuration file of each virtual machine is pre-created on an offline host, and includes at least the configuration information of the virtual machine's hardware resources in the resource description file of the target machine, the page table of the virtual machine, and the address space of the page table; allocating page table memory for the first virtual machine according to the address space of the first virtual machine's page table, and writing the page table therein, wherein the page table is used to implement the MMU mapping of the first virtual machine's memory; starting the first virtual machine on the hardware resources of the first virtual machine using the resource description file of the first virtual machine, wherein the resource configuration file of each virtual machine is pre-created on an offline host; and accessing the independent memory and / or physical devices of the first virtual machine according to the page table during the operation of the first virtual machine.

[0007] As described above, resource virtualization and virtual machine memory management are performed on the target machine based on type 1 virtualization. Resources are configured by generating resource configuration files including page tables for virtual machines offline. During virtual machine operation, the independent memory and physical devices of the virtual machine are accessed through the pre-generated page tables. This reduces the resource consumption of memory virtualization on the target machine and enables hardware resource virtualization on a target machine with lower configuration, thereby reducing the difficulty and workload of system security authentication.

[0008] In one possible implementation of the first aspect, on the offline host, the memory address space of the first virtual machine on the target machine is obtained based on the configuration information of the independent memory and physical devices of the first virtual machine; based on the memory address space and the address space of the page table, the contents of the page table are obtained by copying a blank page table in the memory of the offline host.

[0009] As described above, the contents of the page table are obtained by copying the page table on the offline host based on the memory address space and page table address space of the first virtual machine on the target machine, so as to save the internal pointer contents of the page table.

[0010] In one possible implementation of the first aspect, obtaining the content of the page table by creating a blank copy table of the page table in the memory of the offline host includes: dividing the physical memory address space into address spaces corresponding to memory pages at the MMU granularity in the target machine's physical space, and obtaining the entry values ​​of each MMU page in the page table; allocating memory space corresponding to the size of the page table in the memory of the offline host, and creating a blank copy table of the page table in the memory space, the structure of which is the same as the page table; filling the value of each entry of each MMU page into the position of the corresponding entry in the copy table, thereby obtaining the content of the page table, wherein entry A of any MMU page corresponds to entry B in the copy table, and the offset address of entry B in the offline host memory relative to the base address of the copy table is equal to the offset address of entry A in the target machine's physical memory relative to the base address of the page table.

[0011] As described above, by using a copy table on an offline host to obtain the virtual machine page table content, the pointer values ​​of various entries in the page table are saved. When configuring virtual machine resources, the page table hierarchy and structure can be preserved by directly copying it bit by bit, without having to create each sub-table individually.

[0012] In one possible implementation of the first aspect, the hardware resources of each virtual machine also include physical CPU cores; when creating each virtual machine, a logical CPU core is created for the virtual machine based on the physical CPU cores of the first virtual machine, and the image of the virtual machine is started on it.

[0013] Therefore, by obtaining a list of virtual machine CPU cores on an offline host, the resource consumption of the target machine's logical CPU when creating virtual machines can be reduced.

[0014] In one possible implementation of the first aspect, the hardware resources of each virtual machine also include the virtual hardware resources of the virtual machine, which correspond to the corresponding hardware resources in the target machine kernel.

[0015] Therefore, by including virtual hardware resources in the resource configuration file in advance, the resource consumption of the target machine when virtualizing shared resources can be reduced.

[0016] In one possible implementation of the first aspect, on the offline host, the method further includes: abstracting the allocatable physical resources of the target machine from the resource description file of the target machine; allocating the allocatable hardware resources to each virtual machine according to the hardware resource requirements of each virtual machine, and obtaining the resource information file of each virtual machine; the resource information file of the virtual machine includes the identifiers of its independent hardware resources and virtual hardware resources in the resource description file of the target machine; and obtaining the resource configuration file and resource description file of each virtual machine according to the resource information file of each virtual machine.

[0017] Based on the above, resources are allocated according to the resource description file of the target machine. By utilizing the information in the resource description file of the target machine based on the allocated resources, accurate and comprehensive resource configuration files and resource description files can be obtained. Moreover, the process of virtualizing target machine resources is reduced, and target machine resource virtualization can be completed on target machines with low configuration.

[0018] In one possible implementation of the first aspect, creating a resource configuration file for each virtual machine includes: creating a resource configuration body for each hardware resource in the resource information file of each virtual machine, wherein the configuration structure includes information about the hardware resource in the resource description file of the target machine; and adding the page table of the virtual machine and the address space of the page table to the resource information file of each virtual machine.

[0019] As described above, the resource configuration structure includes information about each resource in the target machine's resource description file, which facilitates the configuration of virtual machine hardware resources.

[0020] In one possible implementation of the first aspect, creating a resource description file for each virtual machine includes: copying a resource description file of the target machine for each virtual machine, setting the unallocated hardware resources of the virtual machine in the copied resource description file to an invalid state, and obtaining the resource description file of the virtual machine.

[0021] Based on the above, the resource description file of each virtual machine is obtained by copying the resource description file of the target machine, making the resource description file of each virtual machine accurate and comprehensive.

[0022] In one possible implementation of the first aspect, each resource description file includes a device tree or an APC I table.

[0023] As described above, by including device trees or APC I tables in the resource description file, the memory management method of the present invention enables hardware resource virtualization of computer systems based on various chips.

[0024] Secondly, embodiments of the present invention provide a virtual machine memory management apparatus, comprising: a resource configuration module, configured to configure the hardware resources of a first virtual machine according to a resource configuration file of a first virtual machine, wherein the resource configuration file of each virtual machine is pre-created on an offline host and includes at least the configuration information of the hardware resources of the virtual machine in the resource description file of the target machine, the page table of the virtual machine, and the address space of the page table; a page table configuration module, configured to allocate page table memory for the first virtual machine according to the address space of the page table of the first virtual machine and write the page table therein, wherein the page table is used to implement the MMU mapping of the memory of the first virtual machine; a virtual machine startup module, configured to start the first virtual machine on the hardware resources of the first virtual machine using the resource description file of the first virtual machine, wherein the resource configuration file of each virtual machine is pre-created on an offline host; and a static resource access module, configured to access the independent memory and / or physical devices of the first virtual machine according to the page table when the first virtual machine is running.

[0025] As described above, resource virtualization and virtual machine memory management are performed on the target machine based on type 1 virtualization. Resources are configured by generating resource configuration files including page tables for virtual machines offline. During virtual machine operation, the independent memory and physical devices of the virtual machine are accessed through the pre-generated page tables. This reduces the resource consumption of memory virtualization on the target machine and enables hardware resource virtualization on a target machine with lower configuration, thereby reducing the difficulty and workload of system security authentication.

[0026] In one possible implementation of the second aspect, the offline host includes: a page table generation module, configured to obtain the memory address space of the first virtual machine on the target machine based on the configuration information of the independent memory and physical devices of the first virtual machine; and to obtain the content of the page table by means of a blank copy table of the page table in the memory of the offline host, based on the memory address space and the address space of the page table.

[0027] As described above, the contents of the page table are obtained by copying the page table on the offline host based on the memory address space and page table address space of the first virtual machine on the target machine, so as to save the internal pointer contents of the page table.

[0028] In one possible implementation of the second aspect, the page table generation module obtains the content of the page table by creating a blank copy table of the page table in the memory of the offline host. Specifically, this includes: dividing the physical memory address space into address spaces corresponding to memory pages at the MMU granularity in the target machine's physical space, and obtaining the entry values ​​of each MMU page in the page table; allocating memory space corresponding to the size of the page table in the memory of the offline host, and creating a blank copy table of the page table in the memory space, the structure of which is the same as the page table; filling the value of each entry of each MMU page into the position of the corresponding entry in the copy table, thereby obtaining the content of the page table. Entry A of any MMU page corresponds to entry B in the copy table, and the offset address of entry B in the offline host memory relative to the base address of the copy table is equal to the offset address of entry A in the target machine's physical memory relative to the base address of the page table.

[0029] As described above, by using a copy table on an offline host to obtain the virtual machine page table content, the pointer values ​​of various entries in the page table are saved. When configuring virtual machine resources, the page table hierarchy and structure can be preserved by directly copying it bit by bit, without having to create each sub-table individually.

[0030] In one possible implementation of the second aspect, the hardware resources of each virtual machine also include physical CPU cores; when creating each virtual machine, the virtual machine startup module creates a logical CPU core for the virtual machine based on the physical CPU cores of the first virtual machine, and starts the image of the virtual machine on it.

[0031] Therefore, by obtaining a list of virtual machine CPU cores on an offline host, the resource consumption of the target machine's logical CPU when creating virtual machines can be reduced.

[0032] In one possible implementation of the second aspect, the hardware resources of each virtual machine also include the virtual hardware resources of the virtual machine, which correspond to the corresponding hardware resources in the target machine kernel.

[0033] Therefore, by including virtual hardware resources in the resource configuration file in advance, the resource consumption of the target machine when virtualizing shared resources can be reduced.

[0034] In one possible implementation of the second aspect, the offline host further includes: a resource partitioning module, used to abstract the allocatable physical resources of the target machine from the resource description file of the target machine; allocate the allocatable hardware resources to each virtual machine according to the hardware resource requirements of each virtual machine, and obtain the resource information file of each virtual machine, wherein the resource information file of the virtual machine includes the identifiers of its independent hardware resources and virtual hardware resources in the resource description file of the target machine; a configuration generation module, used to obtain the resource configuration file of each virtual machine according to the resource information file of each virtual machine and the resource description file of the target machine; and a description generation module, used to obtain the resource description file of each virtual machine according to the resource information file of each virtual machine and the resource description file of the target machine.

[0035] Based on the above, resources are allocated according to the resource description file of the target machine. By utilizing the information in the resource description file of the target machine based on the allocated resources, accurate and comprehensive resource configuration files and resource description files can be obtained. Moreover, the process of virtualizing target machine resources is reduced, and target machine resource virtualization can be completed on target machines with low configuration.

[0036] In one possible implementation of the second aspect, the configuration generation module is specifically used to: create a resource configuration body corresponding to each hardware resource in the resource information file of each virtual machine, wherein the configuration structure includes information of the hardware resource in the resource description file of the target machine; and add the page table of the virtual machine and the address space of the page table to the resource information file of each virtual machine.

[0037] As described above, the resource configuration structure includes information about each resource in the target machine's resource description file, which facilitates the configuration of virtual machine hardware resources.

[0038] In one possible implementation of the second aspect, the description generation module is specifically used to copy a resource description file of the target machine for each virtual machine, set the unallocated hardware resources of the virtual machine in the copied resource description file to an invalid state, and obtain the resource description file of the virtual machine.

[0039] Based on the above, the resource description file of each virtual machine is obtained by copying the resource description file of the target machine, making the resource description file of each virtual machine accurate and comprehensive.

[0040] In one possible implementation of the second aspect, each resource description file includes a device tree or an APC I table.

[0041] As described above, by including device trees or APC I tables in the resource description file, the memory management method of the present invention enables hardware resource virtualization of computer systems based on various chips.

[0042] Thirdly, embodiments of the present invention provide an operating system configured to run the method described in any embodiment of the first aspect.

[0043] Fourthly, embodiments of the present invention provide a computing device, comprising: a bus; a communication interface connected to the bus; at least one processor connected to the bus; and at least one memory connected to the bus and storing program instructions, which, when executed by the at least one processor, cause the at least one processor to perform any of the embodiments described in the first aspect of the present invention.

[0044] Fifthly, embodiments of the present invention provide a computer-readable storage medium having program instructions stored thereon, which, when executed by a computer, cause the computer to perform any of the embodiments described in the first aspect of the present invention. Attached Figure Description

[0045] Figure 1 This is a flowchart illustrating a method for virtual machine memory management according to the present invention, embodiment one;

[0046] Figure 2A This is a flowchart illustrating the configuration information acquisition method of a second embodiment of the virtual machine memory management method of the present invention;

[0047] Figure 2B This is a flowchart illustrating the memory access method of a second embodiment of the virtual machine memory management method of the present invention.

[0048] Figure 3 This is a schematic diagram illustrating the structure of a virtual machine memory management method according to a second embodiment of the present invention.

[0049] Figure 4 This is a flowchart illustrating the page table generation method of a second embodiment of the virtual machine memory management method of the present invention.

[0050] Figure 5 This is a schematic diagram illustrating the structure of the stage2 page table implemented using the page table generation method of Embodiment 2 of the present invention for virtual machine memory management.

[0051] Figure 6 This is a schematic diagram of a first embodiment of a virtual machine memory management device according to the present invention;

[0052] Figure 7A This is a schematic diagram of the configuration information acquisition device according to a second embodiment of the virtual machine memory management device of the present invention;

[0053] Figure 7B This is a schematic diagram of the memory access device according to a second embodiment of the virtual machine memory management apparatus of the present invention;

[0054] Figure 8 This is a schematic diagram of the structure of the computing device of the present invention. Detailed Implementation

[0055] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0056] In the following description, the terms “first, second, third, etc.” or module A, module B, module C, etc. are used only to distinguish similar objects or different embodiments and do not represent a specific ordering of objects. It is understood that a specific order or sequence may be interchanged where permitted so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.

[0057] In the following description, the labels of the steps, such as S110, S120, etc., do not necessarily mean that the steps will be executed in this way. The order of the steps can be interchanged or executed simultaneously if permitted.

[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.

[0059] This invention provides a method, apparatus, device, and storage medium for virtual machine memory management. The method includes: configuring the hardware resources of a first virtual machine according to a resource configuration file of the first virtual machine, wherein the resource configuration file of each virtual machine is pre-created on an offline host and includes at least the configuration information of the virtual machine's hardware resources in the resource description file of the target machine, the page table of the virtual machine, and the address space of the page table; allocating page table memory for the first virtual machine according to the address space of the first virtual machine's page table, and writing the page table therein, wherein the page table is used to implement the MMU mapping of the first virtual machine's memory; starting the first virtual machine on the hardware resources of the first virtual machine using the resource description file of the first virtual machine, wherein the resource configuration file of each virtual machine is pre-created on an offline host; and accessing the independent memory and / or physical devices of the first virtual machine according to the page table during the operation of the first virtual machine.

[0060] The technical solution of this invention is used to perform resource virtualization and manage the memory of virtual machines on a target machine based on type 1 virtualization. By generating a resource configuration file including page tables for the virtual machine offline, resources are configured. During virtual machine operation, the independent memory and physical devices of the virtual machine are accessed through the pre-generated page tables, which reduces the resource consumption of memory virtualization on the target machine. Hardware resource virtualization is achieved on a target machine with lower configuration, thereby reducing the difficulty and workload of system security authentication.

[0061] The embodiments of the present invention will now be described in conjunction with the accompanying drawings. First, in conjunction with... Figure 1 This document introduces an example of a virtual machine memory management method.

[0062] An embodiment of a virtual machine memory management method is provided for managing the memory of a virtual machine on a target machine based on type 1 virtualization. The target machine is a computer system running an embedded operating system.

[0063] Figure 1 The flowchart of a method for virtual machine memory management according to embodiment one is shown, including steps S110 to S150.

[0064] For ease of description, we will take the first virtual machine on the target machine as an example. The first virtual machine is any virtual machine to be created. In a real scenario, multiple virtual machines can be managed at the same time.

[0065] S110: Load the resource configuration file and resource description file of the first virtual machine on the target machine.

[0066] Each virtual machine's resource configuration file includes at least the configuration information of its hardware resources in the target machine's resource description file, the virtual machine's page table, and the address space of the page table. Each virtual machine's page table is used to implement the MMU mapping between the virtual addresses and physical addresses of its independent memory and physical devices; this page table is a static mapping table. The address space of each virtual machine's page table is the space on the target machine's physical memory where the virtual machine's page table is stored.

[0067] Both the target machine's and the virtual machine's resource description files include either a device tree or an APCI table. Both types of resource description files contain detailed hardware resource descriptions of the relevant system, resulting in a large amount of information. For example, in an ARM chip computing system, the resource description file is its device tree, with each hardware resource identified by a node identifier. In an x86 chip computing system, the resource description file is its APCI table, which supports UEFI (Unified Extensible Firmware Interface) directly reading the ACPI table from the BIOS.

[0068] In this process, the resource configuration file and resource description file for each virtual machine are created in advance on the offline host, which is a computing system independent of the target machine.

[0069] In some embodiments, on the offline host, the memory address space of the first virtual machine on the target machine is obtained based on the configuration information of the independent memory and physical device of the first virtual machine. The independent memory of the virtual machine is obtained through allocation, and the physical device of the virtual machine is its independent device, the physical memory occupied by it is obtained from the resource description file of the target machine. Based on the memory address space of the first virtual machine and the address space of the first virtual machine page table, the contents of the first virtual machine page table are obtained by copying the first virtual machine page table in the memory of the offline host.

[0070] In some embodiments, the memory address space of the first virtual machine on the target machine is divided into address spaces corresponding to memory pages of each MMU granularity in the physical space of the target machine. The table entry values ​​of each MMU page in the first virtual machine's page table are obtained, with each entry value being a pointer pointing to the base address of that MMU page. Memory space corresponding to the size of the page table is allocated in the memory of the offline host, and a blank copy table of the page table is created in this memory space. The structure of the copy table is the same as that of the page table. Each table entry value obtained from each MMU page is filled into the corresponding entry position in the copy table to obtain the content of the first virtual machine's page table. Wherein, if any MMU page's table entry A corresponds to table entry B in the copy table, the offset address of table entry B in the offline host memory relative to the base address of the copy table is equal to the offset address of table entry A in the target machine's physical memory relative to the base address of the page table. When the page table is a multi-level table, the pointers within the copy table, i.e., the indices pointing to each sub-table, are the same as the corresponding pointers in the first virtual machine's page table. Therefore, the copy table is completely identical to the first virtual machine's page table in both structure and content.

[0071] In some embodiments, the page table of Stage 2 of the first virtual machine page table, based on the already implemented mapping relationship between the first virtual machine virtual address and the first virtual machine physical address, implements the mapping between the first virtual machine physical address and the target machine physical address.

[0072] In some embodiments, the hardware resources of the first virtual machine also include its independent CPU core for launching the first virtual machine.

[0073] In some embodiments, the hardware resources of each virtual machine also include the virtual hardware resources of the virtual machine, which correspond to the corresponding hardware resources in the target machine kernel.

[0074] In some embodiments, the allocatable physical resources of the target machine are abstracted from the resource description file of the target machine; the allocatable hardware resources are allocated to each virtual machine according to the hardware resource requirements of each virtual machine, and the resource information file of each virtual machine is obtained; the resource information file of the virtual machine includes the identifiers of its independent hardware resources and virtual hardware resources in the resource description file of the target machine; the resource configuration file and resource description file of each virtual machine are obtained according to the resource information file of each virtual machine.

[0075] In some embodiments, creating a resource configuration file for each virtual machine includes: creating a resource configuration body for each hardware resource in the resource information file of each virtual machine, wherein the configuration structure includes information about the hardware resource in the resource description file of the target machine; and adding the page table and the address space of the page table to the resource information file of each virtual machine.

[0076] In some embodiments, creating a resource description file for each virtual machine includes: copying a resource description file of the target machine for each virtual machine, setting the unallocated hardware resources of the virtual machine in the copied resource description file to an invalid state, and obtaining the resource description file of the virtual machine.

[0077] As described above, by pre-generating resource configuration files on the offline host, the workload and code for target machine virtualization are reduced by eliminating the need to process information for target machine memory virtualization through the kernel on the target machine.

[0078] S120: Configure the hardware resources of the first virtual machine according to the resource configuration file of the first virtual machine.

[0079] Specifically, memory is allocated to the first virtual machine based on the independent memory range in the resource configuration file of the first virtual machine, physical device memory is allocated to the first virtual machine based on the memory occupied information of the physical devices therein, and logical CPUs are created for the first virtual machine based on the CPU cores therein. The CPU cores include its independent CPU cores and shared CPUs.

[0080] In some embodiments, the hardware resources of each virtual machine also include the virtual hardware resources of the virtual machine, and virtual hardware resources are allocated to the virtual hardware resources.

[0081] S130: Allocate page table memory for the first virtual machine according to the address space of the first virtual machine page table, and write the page table of the first virtual machine into it.

[0082] Specifically, when writing the page table of the first virtual machine into the page table memory, the page table is filled bit by bit into the page table memory, instead of storing each sub-table one by one, so that the pointers of each entry in the page table do not need to be modified and can point directly to the correct address.

[0083] S140: Start the first virtual machine using the resource description file of the first virtual machine on the hardware resources of the first virtual machine. The resource configuration file of each virtual machine is created in advance on the offline host.

[0084] Specifically, the image of the first virtual machine is started on the independent CPU core of the first virtual machine to create the virtual machine. The resource description file of the first virtual machine includes the hardware resources of the first virtual machine and the description information of each hardware resource. The operating system and drivers of the first virtual machine know the devices of the first virtual machine through the resource description file.

[0085] S150: When the first virtual machine is running, access the independent memory and / or physical devices of the first virtual machine according to its page table.

[0086] When the first virtual machine obtains the MMU mapping relationship of its independent memory and / or physical device according to its page table, it accesses the target machine using the virtual address of the virtual machine. The MMU mapping relationship of the first virtual machine is then used to convert the address into a physical address on the target machine, thereby enabling access.

[0087] In some embodiments, when the page table of the first virtual machine is the page table of stage2, the translation between the virtual address and the physical address of the first virtual machine is first implemented inside the virtual machine, and then the translation between the physical address of the first virtual machine and the physical address on the target machine is implemented using the page table of the first virtual machine.

[0088] In summary, the first embodiment of a virtual machine memory management method performs resource virtualization and manages the virtual machine's memory on a target machine based on type 1 virtualization. By generating a resource configuration file including page tables for the virtual machine offline, resources are configured. During virtual machine operation, the virtual machine accesses its independent memory and physical devices through the pre-generated page tables, reducing the resource consumption of memory virtualization on the target machine. This enables hardware resource virtualization on a target machine with lower configuration, thereby reducing the difficulty and workload of system security authentication.

[0089] The following is combined with Figures 2A to 5 Example 2 of a virtual machine memory management method is introduced.

[0090] Embodiment 2 of a virtual machine resource management method is a specific implementation of Embodiment 1 of a virtual machine memory management method, and has all its advantages.

[0091] A second embodiment of a virtual machine memory management method includes: a configuration information acquisition method and a memory access method.

[0092] Figure 2A The flowchart of a method for obtaining configuration information according to a second embodiment of a virtual machine memory management method is shown, including steps S2110 to S2150.

[0093] For ease of explanation, we will take managing virtual machines VM1 and VM2 on the target machine as an example.

[0094] S2110: Use the IDE resource partitioning tool on the offline host to partition the hardware resources of the target machine into the hardware resources of each virtual machine, and obtain the hardware information files VM1_hwi_nfo and VM2_hwi_nfo of the virtual machines.

[0095] Each virtual machine's hardware resources include its own CPU core, independent memory, and physical devices.

[0096] This process involves abstracting the allocatable physical resources of the target machine from its resource description file; allocating hardware resources to each virtual machine from the allocatable hardware resources based on their hardware resource requirements; and obtaining the resource information files for the target machine kernel and each virtual machine. The virtual machine's resource information file includes the identifiers of its individual hardware resources and virtual hardware resources in the target machine's resource description file. The target machine's resource description file is either a device tree or an APC I table.

[0097] Among them, VM1_hwi_nfo is the resource information file of virtual machine VM1, and VM2_hwi_nfo is the resource information file of virtual machine VM2.

[0098] S2120: Use the IDE resource configuration tool on an offline host to generate virtual machine resource configuration files VM1_cfgdata and VM2_cfgdata.

[0099] Each virtual machine's independent hardware resources include an independent CPU core, independent memory, and physical devices. The virtual hardware resources of each virtual machine correspond to the corresponding hardware resources in the target machine kernel.

[0100] Each virtual machine's resource configuration file includes a configuration structure for each resource. The configuration structure for each virtual machine's independent CPU cores, independent memory, physical devices, and virtual hardware resources includes information about the corresponding resources in the target machine's resource description file. It also includes an interrupt configuration structure, which includes the interrupt numbers for physical devices and virtual hardware resources.

[0101] Here, VM1_cfgdata is the resource configuration file for virtual machine VM1, and VM2_cfgdata is the resource configuration file for virtual machine VM2.

[0102] S2130: On the offline host, the IDE resource configuration tool is also used to generate the virtual machine's page tables and add them to the resource configuration files VM1_cfgdata and VM2_cfgdata.

[0103] Each virtual machine's resource configuration file also includes the virtual machine's page table address space and page table contents. In this embodiment, the page table is the stage2 page table.

[0104] For the method of generating the page table content for each virtual machine, please refer to the page table generation method in Embodiment 2 of a virtual machine memory management method.

[0105] S2140: Copy the resource description file of the target machine for each virtual machine, set the hardware resources not included in the resource information file of the virtual machine in the copied resource description file to an invalid state, and obtain the resource description file of the virtual machine.

[0106] Among these methods, generating a resource description file for each virtual machine based on the resource description file of the target machine is the fastest and most accurate.

[0107] Specifically, the resource configuration files of the target machine kernel, the resource configuration files of each virtual machine, and the resource description files are obtained by using resource partitioning and offline file generation methods and are preloaded into the target machine.

[0108] S2150: Loads the type 1 hypervisor, the resource configuration files VM1_cfgdata and VM2_cfgdata for each virtual machine, and the resource description file for each virtual machine into the target machine.

[0109] Figure 2B The flowchart of a memory access method according to Embodiment 2 of a virtual machine memory management method is shown, including steps S2210 to S2250.

[0110] S2210: Start the type 1 hypervisor on the target machine.

[0111] After the type1 virtual machine management program starts, steps S2220 to S2240 are executed.

[0112] S2220: The type 1 hypervisor configures the virtual machine resources according to the virtual machine resource configuration files VM1_cfgdata and VM2_cfgdata.

[0113] This step includes:

[0114] 1) Create logical CPUs for virtual machines VM1 and VM2 respectively based on the CPU cores (including independent CPU cores and shared CPU cores) in the CPU configuration structure of virtual machines VM1 and VM2.

[0115] 2) Based on the independent memory address spaces in the memory configuration structure of virtual machines VM1 and VM2, allocate independent memory in the physical memory of the target machine for virtual machines VM1 and VM2 respectively.

[0116] 3) Based on the physical device address space in the physical device configuration structure of virtual machines VM1 and VM2, allocate physical device memory for virtual machines VM1 and VM2 respectively in the target machine.

[0117] 4) Based on the configuration structure of virtual hardware resources of virtual machines VM1 and VM2, simulate virtual hardware resources in virtual memory for virtual machines VM1 and VM2 respectively.

[0118] 5) Configure interrupt numbers for virtual machines VM1 and VM2 respectively according to the configuration structure in VM1 and VM2.

[0119] In this way, when configuring the resources of virtual machines VM1 and VM2, there is no need to perform the virtualization process of virtual hardware resources. The configuration is completed directly according to the resource configuration file, which reduces the consumption of hardware resources on the target machine.

[0120] S2230: Based on the respective stage2 page table address spaces of virtual machines VM1 and VM2, allocate page table memory for virtual machines VM1 and VM2 in the target machine, and write the respective stage2 page table contents into their respective page table memory.

[0121] Specifically, the stage2 page table content is filled into the corresponding page table according to the bits, without the need to rebuild the table entry pointers.

[0122] S2240: Start virtual machines VM1 and VM2 using their respective independent CPU cores and resource description files.

[0123] This method involves launching the virtual machine image on a dedicated CPU core of the virtual machine, thus avoiding impact on other virtual machines.

[0124] S2250: Virtual machines VM1 and VM2 access their respective independent memory and physical devices based on their stage2 page tables during runtime.

[0125] The physical devices are also mapped onto the target's memory bus, and their access methods are the same as those for independent memory.

[0126] Figure 3 The diagram illustrates a structure for implementing memory management through a second embodiment of a virtual machine memory management method.

[0127] In this process, the virtual machine configuration information is obtained on the offline host using IDE resource planning and configuration tools. On the target machine, the target machine's memory is virtualized according to the configuration information, and MMU mapping is established.

[0128] Figure 4The flowchart of a page table generation method according to a second embodiment of a virtual machine memory management method is shown, including steps S2310 to S2330.

[0129] For ease of explanation, we will use virtual machine VM1 as an example.

[0130] S2310: Allocate memory space corresponding to the stage2 page table address space of virtual machine VM1 in the memory of the offline host, and create a copy table of stage2 page table of virtual machine VM1 in this memory space.

[0131] The structure of this copy table is the same as the stage2 page table of virtual machine VM1, but the MMU page table entries are empty.

[0132] In some embodiments, the page table of virtual machine VM1 is a multi-level page table. The pointers of the entries in the upper-level page table of the copied table to the pointers in the lower-level page table are the same as the corresponding pointers in the page table of virtual machine VM1, so that their levels are completely identical and the positions of each sub-table are the same.

[0133] S2320: By dividing the memory address space of virtual machine VM1 into the address space corresponding to the memory pages of each MMU granularity in the physical space of the target machine, the table entry value of each MMU page in the stage2 page table of virtual machine VM1 is obtained.

[0134] The memory address space of virtual machine VM1 includes the address space of VM1's independent memory and the address space of physical device memory. The address space of independent memory corresponds to the independent memory region, and the address space of physical device memory corresponds to the device memory region in the configuration information of the physical device. The page table address space corresponds to the page table area.

[0135] In the stage 2 page table of virtual machine VM1, each MMU page entry is a pointer pointing to a page at the MMU granularity in the target machine's physical space. When the stage 2 page table of virtual machine VM1 is a multi-level page table, the MMU page table is the lowest level table.

[0136] S2330: Fill the values ​​of each MMU page table entry in the stage2 page table of virtual machine VM1 into the corresponding entries in the copy table to obtain the contents of the stage2 page table of virtual machine VM1.

[0137] In this context, entry A of any MMU page in the stage2 page table of virtual machine VM1 corresponds to entry B in the copy table. The offset address of entry B in the offline host memory relative to the base address of the copy table is equal to the offset address of entry A in the target machine's physical memory relative to the base address of the stage2 page table of virtual machine VM1.

[0138] Figure 5The diagram illustrates the structure of the stage2 page table implemented using a page table generation method according to Embodiment 2 of a virtual machine memory management method.

[0139] Specifically, by creating a replication table in the memory of the offline host and filling in the contents of each entry of the replication table, the stage2 page table of virtual machine VM1 is obtained, so as to keep the pointers in the table entries unchanged.

[0140] The following is based on Figure 6 This invention introduces a device embodiment for virtual machine memory management according to the present invention.

[0141] An apparatus for virtual machine memory management, embodiment one, and a method for running virtual machine memory management, embodiment one, the method described in embodiment one, have all its advantages.

[0142] Figure 6 The structure of a device for virtual machine memory management according to a first embodiment is shown, including: a configuration loading module 610, a resource configuration module 620, a page table configuration module 630, a virtual machine startup module 640, and a static resource access module 650.

[0143] For ease of description, we will take the first virtual machine as an example.

[0144] The configuration loading module 610 is used to load the resource configuration file and resource description file of the first virtual machine on the target machine. For its working principle and advantages, please refer to step S110 of Embodiment 1 of a virtual machine memory management method.

[0145] The resource configuration module 620 is used to configure the hardware resources of the first virtual machine according to the resource configuration file of the first virtual machine. For its working principle and advantages, please refer to step S120 of Embodiment 1 of a virtual machine memory management method.

[0146] The page table configuration module 630 is used to allocate page table memory for the first virtual machine according to the address space of the first virtual machine's page table, and write the page table of the first virtual machine into it. For its working principle and advantages, please refer to step S130 of Embodiment 1 of a virtual machine memory management method.

[0147] The virtual machine startup module 640 is used to start the first virtual machine using the resource description file of the first virtual machine on the hardware resources of the first virtual machine. For its working principle and advantages, please refer to step S140 of Embodiment 1 of a virtual machine memory management method.

[0148] The static resource access module 650 is used to access the independent memory and / or physical devices of the first virtual machine according to its page table when the first virtual machine is running. For its working principle and advantages, please refer to step S150 of Embodiment 1 of a virtual machine memory management method.

[0149] The following is based on Figure 7Aand Figure 7B This invention introduces a second embodiment of a virtual machine memory management device.

[0150] A second embodiment of a virtual machine memory management apparatus and a second embodiment of a virtual machine memory management method, the method described in the second embodiment of the apparatus, have all its advantages.

[0151] Figure 7A The structure of a configuration information acquisition device according to a second embodiment of a virtual machine memory management device is shown, including: a resource partitioning module 7110, a configuration generation module 7120, a page table generation module 7130, a description generation module 7140, and a file loading module 7150.

[0152] For ease of description, we will use virtual machines VM1 and VM2 as examples.

[0153] The resource partitioning module 7110 is used to partition the hardware resources of the target machine into the hardware resources of each virtual machine using an IDE resource partitioning tool on an offline host, and obtain the virtual machine hardware information files VM1_hwi_nfo and VM2_hwi_nfo. For its working principle and advantages, please refer to step S2110 of the configuration information acquisition method in Embodiment 2 of a virtual machine memory management method.

[0154] The configuration generation module 7120 is used to generate virtual machine resource configuration files VM1_cfgdata and VM2_cfgdata on an offline host using an IDE resource configuration tool. For its working principle and advantages, please refer to step S2120 of the configuration information acquisition method in Embodiment 2 of a virtual machine memory management method.

[0155] Page table generation module 7130 is used to generate virtual machine page tables on the offline host using the IDE resource configuration tool and add them to the resource configuration files VM1_cfgdata and VM2_cfgdata. For its working principle and advantages, please refer to step S2130 of the configuration information acquisition method in Embodiment 2 of a virtual machine memory management method.

[0156] The description generation module 7140 is used to copy a resource description file of the target machine for each virtual machine, and set the hardware resources not included in the virtual machine's resource information file in the copied resource description file to an invalid state, thereby obtaining the virtual machine's resource description file. For its working principle and advantages, please refer to step S2140 of the configuration information acquisition method in Embodiment 2 of a virtual machine memory management method.

[0157] The file loading module 7150 loads the type 1 hypervisor, the resource configuration files VM1_cfgdata and VM2_cfgdata for each virtual machine, and the resource description file for each virtual machine into the target machine. For its working principle and advantages, please refer to step S2150 of the configuration information acquisition method in Embodiment 2 of a virtual machine memory management method.

[0158] Figure 7B The structure of a memory access device according to a second embodiment of a virtual machine memory management apparatus is shown, including: a kernel startup module 7210, a resource configuration module 7220, a page table configuration module 7230, a virtual machine startup module 7240, and a static resource access module 7250.

[0159] For ease of description, we will use virtual machines VM1 and VM2 as examples.

[0160] The kernel boot module 7210 is used to start the type 1 virtual machine hypervisor on the target machine. For its working principle and advantages, please refer to step S2210 of the memory access method in Embodiment 2 of a virtual machine memory management method.

[0161] The resource configuration module 7220 is used by the type 1 virtual machine hypervisor to configure the virtual machine resources according to the virtual machine resource configuration files VM1_cfgdata and VM2_cfgdata. For its working principle and advantages, please refer to step S2220 of the memory access method in Embodiment 2 of a virtual machine memory management method.

[0162] The page table configuration module 7230 is used to allocate page table memory for virtual machines VM1 and VM2 respectively in the target machine according to their respective stage2 page table address spaces, and write their respective stage2 page table contents into their respective page table memory. For its working principle and advantages, please refer to step S2230 of the memory access method in Embodiment 2 of a virtual machine memory management method.

[0163] The virtual machine startup module 7240 is used to start virtual machines VM1 and VM2 respectively using their independent CPU cores and resource description files. For its working principle and advantages, please refer to step S2240 of the memory access method in Embodiment 2 of a virtual machine memory management method.

[0164] The static resource access module 7250 is used by virtual machines VM1 and VM2 to access their respective independent memory and physical devices according to their stage2 page tables during runtime. For its working principle and advantages, please refer to step S2250 of the memory access method in Embodiment 2 of a virtual machine memory management method.

[0165] This invention also provides an operating system configured to run the method described in Embodiment 1 or Embodiment 2 of a virtual machine resource management method, which is configured to include the apparatus described in Embodiment 1 or Embodiment 2 of a virtual machine resource management method.

[0166] This invention also provides a computing device, which is described below. Figure 8 Detailed introduction.

[0167] The computing device 800 includes a processor 810, a memory 820, a communication interface 830, and a bus 840.

[0168] It should be understood that the communication interface 830 in the computing device 800 shown in the figure can be used to communicate with other devices.

[0169] The processor 810 can be connected to the memory 820. The memory 820 can be used to store the program code and data. Therefore, the memory 820 can be a storage unit inside the processor 810, an external storage unit independent of the processor 810, or a component that includes both the storage unit inside the processor 810 and the external storage unit independent of the processor 810.

[0170] Optionally, the computing device 800 may also include a bus 840. The memory 820 and communication interface 830 can be connected to the processor 810 via the bus 840. The bus 840 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 840 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one line is used in this figure, but this does not mean that there is only one bus or one type of bus.

[0171] It should be understood that in this embodiment of the invention, the processor 810 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 810 may employ one or more integrated circuits to execute relevant programs to implement the technical solutions provided in this embodiment of the invention.

[0172] The memory 820 may include read-only memory and random access memory, and provides instructions and data to the processor 810. A portion of the processor 810 may also include non-volatile random access memory. For example, the processor 810 may also store device type information.

[0173] When the computing device 800 is running, the processor 810 executes computer execution instructions stored in the memory 820 to perform the operation steps of each method embodiment.

[0174] It should be understood that the computing device 800 according to the embodiments of the present invention can correspond to the corresponding subject in executing the methods according to the various embodiments of the present invention, and the above and other operations and / or functions of each module in the computing device 800 are respectively for implementing the corresponding processes of the methods in the embodiments of the present method. For the sake of brevity, they will not be described in detail here.

[0175] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0176] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0177] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0178] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this method embodiment according to actual needs.

[0179] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0180] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the decoding method described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0181] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is used to perform the operation steps of the various method embodiments.

[0182] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0183] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.

[0184] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.

[0185] Computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0186] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, all of which fall within the scope of protection of the present invention.

Claims

1. A method for virtual machine memory management, characterized in that, include: On the offline host, the memory address space of the first virtual machine on the target machine is obtained based on the configuration information of the independent memory and physical devices of the first virtual machine; The memory address space is divided into address spaces corresponding to memory pages at the MMU granularity in the physical space of the target machine, and the table entry values ​​of each MMU page in the page table of the first virtual machine are obtained. Allocate memory space corresponding to the page table size in the offline host's memory, and create a blank copy table of the page table in this memory space. The structure of the copy table is the same as that of the page table. Fill the value of each entry of each MMU page into the position of the corresponding entry in the copy table to obtain the content of the page table. Among them, entry A of any MMU page corresponds to entry B in the copy table. The offset address of entry B in the offline host memory relative to the base address of the copy table is equal to the offset address of entry A in the target machine's physical memory relative to the base address of the page table. Configure the hardware resources of the first virtual machine according to the resource configuration file of the first virtual machine, wherein the resource configuration file of each virtual machine includes at least the configuration information of the hardware resources of the virtual machine in the resource description file of the target machine, the page table of the virtual machine, and the address space of the page table. Page table memory is allocated for the first virtual machine according to the address space of the first virtual machine page table, and the page table is written into it; wherein, when writing the page table into the page table memory of the first virtual machine, the contents of the page table are filled into the page table memory bit by bit, without having to fill it according to each sub-table of the page table; The first virtual machine is started using its resource description file on the hardware resources of the first virtual machine. The resource description file for each virtual machine is created in advance on the offline host. When the first virtual machine is running, its independent memory and / or physical devices are accessed according to the page table.

2. The method according to claim 1, characterized in that, The hardware resources of each virtual machine also include physical CPU cores; When creating each virtual machine, a logical CPU core is created for that virtual machine based on the physical CPU cores of the first virtual machine, and the image of that virtual machine is launched on it.

3. The method according to claim 1, characterized in that, The hardware resources of each virtual machine also include the virtual hardware resources of that virtual machine, which correspond to the corresponding hardware resources in the target machine kernel.

4. The method according to claim 3, characterized in that, The offline host also includes: Abstract the allocatable physical resources of the target machine from the target machine's resource description file; Based on the hardware resource requirements of each virtual machine, allocate the available hardware resources to each virtual machine and obtain the resource information file of each virtual machine; the resource information file of the virtual machine includes the identifiers of its independent hardware resources and virtual hardware resources in the resource description file of the target machine. The resource configuration file and resource description file for each virtual machine are obtained from the resource information file of each virtual machine.

5. The method according to claim 4, characterized in that, Create a resource configuration file for each virtual machine, including: Create a configuration structure for each hardware resource in the resource information file of each virtual machine. This configuration structure includes the information of the hardware resource in the resource description file of the target machine. Add the page table and address space of each virtual machine to the resource information file of each virtual machine.

6. The method according to claim 4, characterized in that, Create a resource description file for each virtual machine, including: Copy the resource description file of the target machine to each virtual machine, and set the unallocated hardware resources of the virtual machine in the copied resource description file to an invalid state to obtain the resource description file of the virtual machine.

7. The method according to claim 1, characterized in that, Each resource description file includes a device tree or APCI table.

8. A device for virtual machine memory management, characterized in that, include: The page table generation module is used to generate a page table for a first virtual machine on an offline host. The module includes: obtaining the memory address space of the first virtual machine on the target machine based on the configuration information of the first virtual machine's independent memory and physical devices; dividing the memory address space into address spaces corresponding to memory pages at the MMU granularity in the target machine's physical space, and obtaining the entry values ​​of each MMU page in the page table; allocating memory space corresponding to the page table size in the offline host's memory, and creating a blank copy table of the page table in this memory space, the structure of which is the same as the page table; filling the value of each entry of each MMU page into the corresponding entry position in the copy table, obtaining the content of the page table, wherein entry A of any MMU page corresponds to entry B in the copy table, and the offset address of entry B in the offline host's memory relative to the base address of the copy table is equal to the offset address of entry A in the target machine's physical memory relative to the base address of the page table; The resource configuration module is used to configure the hardware resources of the first virtual machine according to the resource configuration file of the first virtual machine. The resource configuration file of each virtual machine includes at least the configuration information of the hardware resources of the virtual machine in the resource description file of the target machine, the page table of the virtual machine, and the address space of the page table. The page table configuration module is used to allocate page table memory for the first virtual machine according to the address space of the first virtual machine page table, and write the page table into it; wherein, when writing the page table into the page table memory of the first virtual machine, the contents of the page table are filled into the page table memory bit by bit, without having to fill it according to each sub-table of the page table; The virtual machine startup module is used to start the first virtual machine using the resource description file of the first virtual machine on the hardware resources of the first virtual machine. The resource description file of each virtual machine is created in advance on the offline host. A static resource access module is used to access the independent memory and / or physical devices of the first virtual machine according to the page table when the first virtual machine is running.

9. A computing device, characterized in that, include: bus; A communication interface, which is connected to the bus; At least one processor is connected to the bus; And at least one memory connected to the bus and storing program instructions that, when executed by the at least one processor, cause the at least one processor to perform the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, It stores program instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 7.

Citation Information

Patent Citations

  • Offline provisioning of virtual machines

    CN104160376A