Virtual machine creating method, computing device and storage medium

文档序号:1963552 发布日期:2021-12-14 浏览:10次 中文

阅读说明:本技术 一种虚拟机创建方法、计算设备及存储介质 (Virtual machine creating method, computing device and storage medium ) 是由 贺毅涛 焦芬芳 郭辉 高冲 叶青龙 于 2021-11-16 设计创作,主要内容包括:本发明公开了一种虚拟机创建方法、计算设备及存储介质,该方法适于在计算设备中执行,计算设备上安装有模拟处理器和系统虚拟化模块,该方法包括:通过模拟处理器确定待创建的虚拟机使用内存的方式;若待创建的虚拟机使用内存的方式为独立使用,则将待创建的虚拟机作为关键虚拟机,并从内存映射范围文件中读取预留内存信息;通过虚拟机内存操作文件进入内核空间;在内核空间,利用系统虚拟化模块,将预留内存信息对应的连续的物理内存分配给关键虚拟机,以完成虚拟机创建。根据上述技术方案,通过独立内存配置来实现关键虚拟机的创建,将关键虚拟机和主机内存在物理层面几乎完全隔离,主机的内存瓶颈不会影响关键虚拟机的内存性能。(The invention discloses a virtual machine creating method, a computing device and a storage medium, wherein the method is suitable for being executed in the computing device, a simulation processor and a system virtualization module are installed on the computing device, and the method comprises the following steps: determining a memory using mode of a virtual machine to be created through a simulation processor; if the memory-using mode of the virtual machine to be created is independent use, taking the virtual machine to be created as a key virtual machine, and reading reserved memory information from a memory mapping range file; entering a kernel space through a virtual machine memory operation file; and in the kernel space, a system virtualization module is utilized to allocate the continuous physical memory corresponding to the reserved memory information to the key virtual machine so as to complete the creation of the virtual machine. According to the technical scheme, the key virtual machine is established through independent memory configuration, the key virtual machine and the host memory are almost completely isolated on the physical layer, and the memory performance of the key virtual machine cannot be influenced by the memory bottleneck of the host.)

1. A virtual machine creation method adapted to be executed in a computing device having a simulation processor and a system virtualization module installed thereon, the method comprising:

determining a memory using mode of a virtual machine to be created through the simulation processor;

if the memory-using mode of the virtual machine to be created is independent use, taking the virtual machine to be created as a key virtual machine, and reading reserved memory information from a memory mapping range file;

entering a kernel space through a virtual machine memory operation file;

and in the kernel space, utilizing the system virtualization module to allocate the continuous physical memory corresponding to the reserved memory information to the key virtual machine so as to complete virtual machine creation.

2. The method of claim 1, wherein a multi-os boot program is further installed on the computing device, the multi-os boot program is newly added with key memory configuration parameters, and before the step of determining, by the simulation processor, a memory usage manner of the virtual machine to be created, the method further comprises:

starting the multi-operating system starting program to start a kernel;

and when the kernel is started, based on the kernel, generating reserved memory information according to the key memory configuration parameters and mapping the reserved memory information to a file.

3. The method of claim 2, wherein the step of generating and mapping reserved memory information to a file according to the key memory configuration parameters comprises:

reserving corresponding continuous physical memory according to the key memory configuration parameters transmitted by the starting program of the multiple operating systems;

and taking the starting address and the ending address of the physical memory as reserved memory information and storing the reserved memory information to the memory mapping range file.

4. The method as claimed in claim 3, wherein before the step of reserving the corresponding continuous physical memory according to the key memory configuration parameters passed in by the multi-os boot-loader, the method further comprises:

determining whether the kernel supports independent memory configuration;

if the kernel supports independent memory configuration, compiling the independent memory configuration corresponding code so as to process the memory request operation of the key virtual machine when the key virtual machine is established.

5. The method of any of claims 1-4, wherein the step of determining, by the simulation processor, a manner in which the virtual machine to be created uses memory comprises:

acquiring a virtual machine configuration command of the simulation processor;

and if the virtual machine configuration command comprises key memory allocation parameters, determining that the memory using mode of the virtual machine to be created is independent use.

6. The method of claim 5, wherein the step of determining, by the simulation processor, the manner in which the virtual machine to be created uses memory comprises:

and if the virtual machine configuration command comprises default memory allocation parameters, determining that the memory use mode of the virtual machine to be created is common use.

7. The method of claim 6, further comprising:

if the memory use mode of the virtual machine to be created is common use, taking the virtual machine to be created as a common virtual machine, and applying for a memory according to the memory use mode of the default memory allocation parameter identifier;

and distributing the applied memory to the common virtual machine to complete the creation of the virtual machine.

8. The method of any of claims 1-4, wherein the allocating, with the system virtualization module, the contiguous physical memory corresponding to the reserved memory information to the critical virtual machine comprises:

and using the continuous physical memory corresponding to the reserved memory information to create a virtual address space page table of the simulation processor and a physical address extension page table of the key virtual machine, and mapping the physical address of the key virtual machine to the virtual address of the simulation processor, wherein the physical address extension page table corresponds to the physical memory.

9. A computing device, comprising:

at least one processor; and

a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-8.

10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-8.

Technical Field

The present invention relates to the field of computer technologies, and in particular, to a virtual machine creation method, a computing device, and a storage medium.

Background

A virtual machine refers to a complete computer system with complete hardware system functionality, which is emulated by software, running in a completely isolated environment. When creating a virtual machine in a physical computer, it is generally necessary to use part of the hard disk and memory capacity of the physical computer as the hard disk and memory capacity of the virtual machine. The physical computer created with the virtual machine may be referred to as a host machine, and the virtual machine may be understood as a process on the host machine per se.

When the process of the virtual machine is started, a section of memory is allocated in the process address space, the section of memory is only a section of common memory, and has no difference with memories applied by other user processes, and the section of memory is used as a physical memory by the process of the virtual machine. The virtual machine and the host machine share the physical memory, so that the utilization rate of the memory of the whole system can be effectively improved.

In a virtualization scene, virtual machines on a host are not equivalent, some virtual machines bear key services of a service system, some virtual machines only run common services, and for the virtual machines bearing the key services, if a conventional memory allocation scheme is adopted, although the memory utilization rate is possibly guaranteed, the memory privacy of the virtual machines is poor, and the memory read-write efficiency and the security performance are affected by the environment of the whole host, so that the running state of the created virtual machine is poor.

Therefore, a new virtual machine creation method is required to optimize the above process.

Disclosure of Invention

To this end, the present invention provides a virtual machine creation scheme in an attempt to solve, or at least alleviate, the problems presented above.

According to an aspect of the present invention, there is provided a virtual machine creation method adapted to be executed in a computing device on which a simulation processor and a system virtualization module are installed, the method comprising the steps of: firstly, determining a memory using mode of a virtual machine to be created through a simulation processor; if the memory-using mode of the virtual machine to be created is independent use, taking the virtual machine to be created as a key virtual machine, and reading reserved memory information from a memory mapping range file; entering a kernel space through a virtual machine memory operation file; and in the kernel space, a system virtualization module is utilized to allocate the continuous physical memory corresponding to the reserved memory information to the key virtual machine so as to complete the creation of the virtual machine.

Optionally, in the virtual machine creation method according to the present invention, a multi-operating system boot program is further installed on the computing device, a key memory configuration parameter is newly added in the multi-operating system boot program, and before the step of determining, by the simulation processor, a manner in which the virtual machine to be created uses the memory, the method further includes: starting a multi-operating system starting program to start a kernel; when the kernel is started, based on the kernel, according to the key memory configuration parameters, generating the reserved memory information and mapping the reserved memory information to the file.

Optionally, in the virtual machine creating method according to the present invention, the step of generating the reserved memory information and mapping the reserved memory information to the file according to the key memory configuration parameter includes: reserving corresponding continuous physical memory according to key memory configuration parameters transmitted by a starting program of a multi-operating system; and the starting address and the ending address of the physical memory are used as reserved memory information and are stored in a memory mapping range file.

Optionally, in the virtual machine creating method according to the present invention, before the step of reserving the corresponding continuous physical memory according to the key memory configuration parameter transferred by the multi-os boot program, the method further includes: determining whether the kernel supports independent memory configuration; if the kernel supports the independent memory configuration, compiling the corresponding code of the independent memory configuration so as to process the memory request operation of the key virtual machine when the key virtual machine is established.

Optionally, in the virtual machine creating method according to the present invention, the step of determining, by the simulation processor, a manner in which the virtual machine to be created uses the memory includes: acquiring a virtual machine configuration command of the simulation processor; and if the virtual machine configuration command comprises the key memory allocation parameters, determining that the memory using mode of the virtual machine to be created is independent use.

Optionally, in the virtual machine creating method according to the present invention, the step of determining, by the simulation processor, a manner in which the virtual machine to be created uses the memory includes: and if the virtual machine configuration command comprises default memory allocation parameters, determining that the memory using mode of the virtual machine to be created is common use.

Optionally, in the virtual machine creating method according to the present invention, further including: if the memory using mode of the virtual machine to be created is common use, taking the virtual machine to be created as a common virtual machine, and applying for a memory according to the memory using mode of the default memory allocation parameter identifier; and distributing the applied memory to the common virtual machine to complete the creation of the virtual machine.

Optionally, in the virtual machine creating method according to the present invention, the step of allocating, by using a system virtualization module, a continuous physical memory corresponding to the reserved memory information to the key virtual machine includes: and using the continuous physical memory corresponding to the reserved memory information, creating a virtual address space page table of the simulation processor and a physical address extension page table of the key virtual machine, mapping the physical address of the key virtual machine to the virtual address of the simulation processor, wherein the physical address extension page table corresponds to the physical memory.

According to yet another aspect of the present invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the virtual machine creation method as described above.

According to still another aspect of the present invention, there is provided a readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to execute the virtual machine creation method as described above.

According to the virtual machine creation scheme, if a key virtual machine is to be created, reserved memory information is read from a memory mapping range file by using an analog processor, the virtual machine memory operation file enters a kernel space, and a system virtualization module is used for allocating continuous physical memory corresponding to the reserved memory information to the key virtual machine in the kernel space, so that a host environment and a virtualization environment are completely isolated from a physical memory layer, an absolutely private high-speed memory environment is provided for the key virtual machine, the influence of host memory bottleneck on the memory performance of the key virtual machine is avoided, and the security and the read-write speed of memory sensitive services such as a memory database can be remarkably improved. In addition, when the key virtual machine is abnormal, the error site can be quickly positioned and analyzed by means of the mainstream memory analysis technology.

Drawings

To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.

FIG. 1 shows a block diagram of a computing device 100, according to an embodiment of the invention;

FIG. 2 illustrates a flow diagram of a virtual machine creation method 200 according to one embodiment of the invention; and

FIG. 3 is a diagram illustrating a host machine and virtual machine memory relationship, according to an embodiment of the invention.

Detailed Description

Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

FIG. 1 shows a block diagram of a computing device 100, according to one embodiment of the invention.

As shown in FIG. 1, in a basic configuration 102, a computing device 100 typically includes a system memory 106 and one or more processors 104. A memory bus 108 may be used for communication between the processor 104 and the system memory 106.

Depending on the desired configuration, the processor 104 may be any type of processing, including but not limited to: a microprocessor (UP), a microcontroller (UC), a digital information processor (DSP), or any combination thereof. The processor 104 may include one or more levels of cache, such as a level one cache 110 and a level two cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations the memory controller 118 may be an internal part of the processor 104.

Depending on the desired configuration, system memory 106 may be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some implementations, the application 122 can be arranged to execute instructions on an operating system with program data 124 by one or more processors 104.

Computing device 100 also includes a storage device 132, storage device 132 including removable storage 136 and non-removable storage 138.

Computing device 100 may also include a storage interface bus 134. The storage interface bus 134 enables communication from the storage devices 132 (e.g., removable storage 136 and non-removable storage 138) to the basic configuration 102 via the bus/interface controller 130. Operating system 120, applications 122, and at least a portion of program data 124 may be stored on removable storage 136 and/or non-removable storage 138, and loaded into system memory 106 via storage interface bus 134 and executed by one or more processors 104 when computing device 100 is powered on or applications 122 are to be executed.

Computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via the bus/interface controller 130. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices, such as a display or speakers, via one or more a/V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communications with one or more other computing devices 162 over a network communication link via one or more communication ports 164.

A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in a manner that encodes information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.

Computing device 100 may be implemented as a personal computer including both desktop and notebook computer configurations. Of course, computing device 100 may also be implemented as part of a small-form factor portable (or mobile) electronic device such as a cellular telephone, a digital camera, a Personal Digital Assistant (PDA), a personal media player device, a wireless web-watch device, a personal headset, an application specific device, or a hybrid device that include any of the above functions. And may even be implemented as a server, such as a file server, a database server, an application server, a WEB server, and so forth. The embodiments of the present invention are not limited thereto.

In an embodiment in accordance with the invention, the computing device 100 is configured to perform a virtual machine creation method 200 in accordance with the invention. Among other things, the application 122 disposed on the operating system contains therein a plurality of program instructions for executing the virtual machine creation method 200 of the present invention, which may instruct the processor 104 to execute the virtual machine creation method 200 of the present invention, such that the computing device 100 creates a virtual machine by executing the virtual machine creation method 200 of the present invention.

The computing device 100 is used as a physical host of the virtual machine to be installed, that is, a host, and applications for creating the virtual machine, such as a multi-os boot program, a simulation processor, and a system virtualization module, are installed in advance on the computing device 100, and these applications are included in the above-mentioned application 122. According to an embodiment of the present invention, the operating system 120 is a Linux system, and is based on the Linux system, the multiple operating system boot program employs GRUB (GRand Unifieldbootloader), the simulation processor employs qEMU (Quick EMUlator, a set of simulation processors that distribute source codes with a common public license agreement license), and the system virtualization module employs KVM (Kernel-based Virtual Machine).

In this embodiment, parameters or code adjustments and modifications to the multiple operating system boot program (GRUB), the emulation processor (QEMU), the kernel of the operating system 120, and the system virtualization module (KVM) are required before the virtual machine is created. Specifically, for the GRUB, a key memory configuration parameter named vmplicamem is added, and the configuration format is vmplicamem = size, where the size is any integer value between 2 × 1024M and 256 × 1024M, where M represents megabyte. By increasing the key memory configuration parameters, at the initial stage of starting the operating system 120, before the kernel is not started, the key memory configuration parameters are transmitted to the kernel, and when the kernel is started and the memory is initialized, a memory space with the size is planned, and the memory space is reserved by the kernel so as to be subsequently allocated to the key virtual machine.

For QEMU, a key memory allocation parameter is added and distinguished from a default memory allocation parameter, the key memory allocation parameter is used to control the memory allocation behavior of a key virtual machine, so that the key virtual machine uses the previously reserved physical memory, and the default memory allocation parameter is used to allocate the physical memory to a common virtual machine.

In order to adapt to a key memory configuration parameter vmpincelmem transmitted by GRUB, the kernel code also needs to be modified adaptively, and a vmpincelmem parameter processing function is newly added, so that when the kernel is started and initialized, if the vmpincelmem parameter is identified, the kernel automatically arranges a continuous segment of physical memory, and the size of the physical memory is obtained from the vmpincelmem parameter.

In addition, the way that the KVM implements the virtual machine memory at present is to utilize mmap (a method for mapping a memory file) system call to declare a section of continuous space in the virtual address space of the QEMU main thread for virtual machine physical memory mapping. Because key memory allocation parameters are newly added in the QEMU, the original mmap of the KVM implements the logic of a virtual address space Page Table without creating QEMU and a physical address Extended Page Table (EPT) of a key virtual machine, the logic for creating the two Page tables is all processed in Page-missing interrupt, the default processing mode in the Page-missing interrupt is to randomly allocate physical pages, and then the Page Table is created.

In the code of the KVM, mmap system calls are implemented, supplementing logic that creates a virtual address space page table of QEMU and a physical address extension page table of the key virtual machine using the reserved physical memory. After the page table is created, when the physical address of the host machine is searched through the physical address of the key virtual machine, the previously reserved physical memory can be found, and the random memory allocation caused by page fault interruption can be avoided.

FIG. 2 illustrates a flow diagram of a virtual machine creation method 200 according to one embodiment of the invention. The virtual machine creation method 200 may be performed in a computing device (e.g., the computing device 100 described above). The computing device 100 has installed thereon a simulation processor and a system virtualization module.

As shown in fig. 2, the method 200 begins at step S210. In step S210, the way in which the virtual machine to be created uses the memory is determined by the simulation processor. According to an embodiment of the present invention, the computing device 100 further has a multi-os boot program installed thereon, the multi-os boot program is newly added with key memory configuration parameters, before determining, by the simulation processor, a memory usage manner of the virtual machine to be created, the method 200 further includes starting the multi-os boot program to start the kernel, and when the kernel is started, generating the reserved memory information and mapping the reserved memory information to the file according to the key memory configuration parameters based on the kernel.

In this embodiment, the reserved memory information may be generated and mapped to the file according to the key memory configuration parameters in the following manner. Firstly, according to key memory configuration parameters transmitted by a multi-operating system starting program, reserving a corresponding continuous physical memory, and then, taking a starting address and an ending address of the physical memory as reserved memory information and storing the reserved memory information to a memory mapping range file. However, considering that the kernel does not necessarily support independent memory configuration, before reserving corresponding continuous physical memory according to the key memory configuration parameters transferred by the multi-os boot program, it is further required to determine whether the kernel supports independent memory configuration, and if the kernel supports independent memory configuration, compile a corresponding code of the independent memory configuration so as to process a memory request operation of the key virtual machine when the key virtual machine is created.

For example, when the multiple operating system boot program, the simulation processor, and the system virtualization module are GRUB, QEMU, and KVM, respectively, the GRUB is first booted to boot the kernel. After the GRUB is started, a newly added key memory configuration parameter vmpincalmem in the GRUB is transmitted to the kernel, and the control right is given to the kernel. And when the kernel is started, parameter identification is carried out, and the vmpysicalmem parameters transmitted by the starting program of the multi-operating system are obtained.

The kernel analyzes the value of the vmsystemem parameter from a static void __ initsetup _ command _ line function, wherein the function is a vmsystemem parameter processing function newly added in the code of the kernel. And then, detecting a compiling switch, checking whether the memory supports the independent memory configuration, and if the kernel supports the independent memory configuration, identifying all the memory sizes by the kernel when the memory is initialized. When the memory is arranged, as the vmpincelmem parameter is identified, a continuous physical memory with the size of the vmpincelmem parameter is automatically emptied, the physical memory is not used for other purposes and is only reserved for a key virtual machine, and the start address and the end address of the physical memory are recorded as reserved memory information.

The physical presence kernel reserved above is described by the following structure:

static struct resource mem_resource = {

.name = "pysicalmem are",

.start = 0,

.end = 0,

.flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM};

}

in the kernel starting stage, when the vmpincelmem parameter is identified, a memory mapping range file is automatically created so as to store the recorded reserved memory information. For example, the memory mapping range file is a/proc/qemup file of a proc file system (a pseudo file system), and the file record format of the file is as follows:

START_ADDR-END_ADDR :DESCRIPTION

where, START _ ADDR represents a memory START address, END _ ADDR represents a memory END address, and describe represents a memory function DESCRIPTION.

According to one embodiment of the invention, the manner in which the virtual machine to be created uses memory can be determined by the simulation processor in the following manner. The method comprises the steps of firstly obtaining a virtual machine configuration command of an analog processor, if the virtual machine configuration command comprises key memory allocation parameters, determining that the memory using mode of the virtual machine to be created is independent use, and if the virtual machine configuration command comprises default memory allocation parameters, determining that the memory using mode of the virtual machine to be created is common use.

In this embodiment, the key memory allocation parameter of the QEMU is-mph, the common memory allocation parameter is m, if the virtual machine configuration command of the QEMU includes-mph, the virtual machine to be created is determined to be the key virtual machine, the memory usage mode is independent usage, that is, completely isolated from the physical memory of the host, if the virtual machine configuration command of the QEMU includes-m, the virtual machine to be created is determined to be the common virtual machine, and the memory usage mode is common usage, that is, the memory usage mode shares the physical memory with the host.

For example, when the virtual machine configuration command is "qemu. -. M1024." it indicates that the way of using the memory by the virtual machine to be created is normal use, and the configured size of the memory of the virtual machine is 1024M, and when the virtual machine configuration command is "-mph", it indicates that the way of using the memory by the virtual machine to be created is independent use, and the configured size of the memory of the virtual machine is the value of the vmpysicalmem parameter.

Subsequently, step S220 is performed, and if the memory usage mode of the virtual machine to be created is independent usage, the virtual machine to be created is used as a key virtual machine, and the reserved memory information is read from the memory mapping range file. According to an embodiment of the invention, the memory usage mode of the virtual machine to be created is independent usage, the virtual machine to be created is used as a key virtual machine, the reserved memory information is read from the/proc/qemump file, and the start address and the end address of the reserved physical memory are obtained through a read function (read function).

In step S230, the kernel space is entered through the vm memory operation file. According to an embodiment of the invention, the virtual machine memory operation file is actually an identification file specific to the key virtual machine, such as a/dev/qemup file, and the/dev/qemup file only appears on the host machine and is specially used as an interface for interaction between the user mode program QEMU and the kernel. When the memory is initialized, a device file such as a/dev/qemumap file is created, the device file conforms to the file format of the Linux device, and the device function is identified through the primary device number and the secondary device number.

As another means different from KVM for interaction between the process and the kernel of QEMU, the use of the/dev/qemumap file can better control the memory management of the key virtual machine, and assist the KVM to complete the memory management of the key virtual machine. Therefore, the/dev/qemup file can be regarded as a link from the user state to the kernel state, and the user can trap into the kernel space by opening the/dev/qemup file, so as to facilitate the processing in the subsequent step S240.

Finally, step S240 is executed, and in the kernel space, the system virtualization module is utilized to allocate the continuous physical memory corresponding to the reserved memory information to the key virtual machine, so as to complete virtual machine creation. Specifically, a virtual address space page table of the simulation processor and a physical address extension page table of the key virtual machine are created by using continuous physical memories corresponding to the reserved memory information, the physical address of the key virtual machine is mapped to the virtual address of the simulation processor, and the physical address extension page table corresponds to the physical memories, so that the reserved physical memories are allocated to the key virtual machine.

According to an embodiment of the present invention, the KVM uses/proc/qemup file reserves a continuous physical memory corresponding to the memory information, creates a virtual address space page table of QEMU and a physical address extension page table of the key virtual machine, and maps the physical address of the key virtual machine to the virtual address of QEMU. And the key virtual machine applies for the memory, namely the process of the virtual machine QEMU and the process of establishing corresponding mapping of the kernel mode extended page table.

According to another embodiment of the present invention, the method 200 further includes, if the memory usage mode of the virtual machine to be created is normal, using the virtual machine to be created as a normal virtual machine, applying for a memory according to the memory usage mode identified by the default memory allocation parameter, and allocating the applied memory to the normal virtual machine to complete virtual machine creation.

In this embodiment, the virtual machine configuration command of the QEMU is "QEMU. -. M1024.", and it is known that the virtual machine configuration command includes a default memory allocation parameter-M, it is determined that the memory usage mode of the virtual machine to be created is normal, the virtual machine to be created is used as a normal virtual machine, the memory size identified by the default memory allocation parameter-M is read to be 1024M, then the memory of 1024M is applied to be allocated to the normal virtual machine, and the association of the virtual machine process address space to the physical memory of the normal virtual machine is completed.

It should be noted that, in the present invention, the process of creating other modules of the virtual machine through QEMU and KVM is similar to or the same as the creation of a conventional virtual machine, and for saving space, the description is omitted here.

FIG. 3 is a diagram illustrating a host machine and virtual machine memory relationship, according to an embodiment of the invention. As shown in fig. 3, in the host physical memory, a part of the memory is a physical memory that can be used by the host, the host is shared by the normal virtual machine, and a part of the memory is a physical memory reserved for the key virtual machine, and the reserved physical memory is continuous and only allows the key virtual machine to use. The virtual machine address space comprises a virtual machine process address space and a virtual machine physical memory address space, and the physical memory reserved for the key virtual machine is mapped to the virtual machine physical memory address space in the virtual machine address space through memory mapping and then is associated with the physical address of the key virtual machine, so that the physical memory reserved in the host machine can be found through the physical address of the key virtual machine.

According to the virtual machine creation scheme provided by the embodiment of the invention, if a key virtual machine is to be created, reserved memory information is read from a memory mapping range file by using the analog processor, the reserved memory information enters the kernel space through the virtual machine memory operation file, and in the kernel space, a system virtualization module is used for allocating continuous physical memory corresponding to the reserved memory information to the key virtual machine, so that a host environment and a virtualization environment are completely isolated from a physical memory level, an absolutely private high-speed memory environment is provided for the key virtual machine, the influence of host memory bottleneck on the memory performance of the key virtual machine is avoided, and the security and the read-write speed of memory sensitive services such as a memory database can be obviously improved. In addition, when the key virtual machine is abnormal, the error site can be quickly positioned and analyzed by means of the mainstream memory analysis technology.

The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.

In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to execute the virtual machine creation method of the present invention according to instructions in the program code stored in the memory.

By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.

In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.

In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.

Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim.

Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.

Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments.

Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.

As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.

While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:输入设备虚拟化的方法、装置、电子设备和存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!