CN113918272A - Separated virtual machine and virtual machine architecture, construction method and optimization method thereof - Google Patents

Separated virtual machine and virtual machine architecture, construction method and optimization method thereof Download PDF

Info

Publication number
CN113918272A
CN113918272A CN202010660215.1A CN202010660215A CN113918272A CN 113918272 A CN113918272 A CN 113918272A CN 202010660215 A CN202010660215 A CN 202010660215A CN 113918272 A CN113918272 A CN 113918272A
Authority
CN
China
Prior art keywords
virtual machine
thread
running
core
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010660215.1A
Other languages
Chinese (zh)
Inventor
戚正伟
余博识
贾兴国
吴承刚
管海兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Jiaotong University
Original Assignee
Shanghai Jiaotong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Jiaotong University filed Critical Shanghai Jiaotong University
Priority to CN202010660215.1A priority Critical patent/CN113918272A/en
Publication of CN113918272A publication Critical patent/CN113918272A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a separated virtual machine architecture which comprises one or more virtual machine processors, wherein each virtual machine processor comprises a virtual machine running module and a virtual machine monitoring module which run on different physical processors, and the virtual machine running module is in communication connection with the virtual machine monitoring module. Meanwhile, a software simulation separated virtual machine based on the framework, a construction method and an optimization method thereof are provided, each virtual machine processor of the separated virtual machine corresponds to two threads which are respectively a virtual machine running thread and a virtual machine monitoring thread; the virtual machine running thread and the virtual machine monitoring thread are respectively run on different physical processors, are in communication connection in a shared memory or inter-core interrupt mode, and eliminate virtual machine exit in a semi-virtualization expansion mode and a hardware expansion mode, so that the virtualization performance of the software-simulated separate virtual machine is improved.

Description

Separated virtual machine and virtual machine architecture, construction method and optimization method thereof
Technical Field
The invention relates to the technical field of system virtualization and cloud computing, in particular to a Split virtual machine (Split VM) and a virtual machine architecture, a construction method and an optimization method thereof.
Background
With the rapid development of cloud computing technology, the performance of virtualization in a cloud environment has attracted people's extensive attention. In a conventional virtualization architecture, since a virtual machine running module (Guest) and a virtual machine monitoring module (Hypervisor) run on the same physical core, and share physical resources such as registers and cache regions of the same physical core, an expensive virtual machine Exit (VM-Exit) operation is introduced.
Although some researches attempt to eliminate the operation of virtual machine Exit (VM-Exit), most of the researches reduce the number of VM-exits triggered by sensitive instructions by setting a VM-Execution control domain in a Virtual Machine Control Structure (VMCS), and cannot eliminate the VM-exits fundamentally. Furthermore, most of these studies focus on I/O operations of the virtual machine, and are not applicable to all sensitive instructions.
At present, no explanation or report of the similar technology of the invention is found, and similar data at home and abroad are not collected.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a separated virtual machine and a virtual machine architecture, a construction method and an optimization method thereof, wherein a virtual machine operation module (Guest) and a virtual machine monitoring module (Hypervisor) are separated to different physical cores, and a light-weight inter-core communication mode is added in a semi-virtualization mode or a hardware level to eliminate VM-Exit, so that the virtualization performance is improved.
The invention is realized by the following technical scheme.
According to one aspect of the present invention, a split virtual machine architecture is provided, which includes one or more virtual machine processors, wherein each of the virtual machine processors includes a virtual machine running module and a virtual machine monitoring module running on different physical processors, and the virtual machine running module and the virtual machine monitoring module are communicatively connected.
Preferably, the virtual machine running module and the virtual machine monitoring module run on a fixed physical processor respectively and have own physical resources respectively; wherein:
the virtual machine operation module is used for executing the non-sensitive instruction of the virtual machine and sending the sensitive instruction to the virtual machine monitoring module;
the virtual machine monitoring module is used for executing the sensitive instruction sent by the virtual machine operation module and feeding back the executed sensitive instruction and the detailed information thereof to the virtual machine operation module;
when the virtual machine monitoring module processes the sensitive instruction, the virtual machine running module controls the virtual machine to suspend execution, and after the virtual machine monitoring module finishes processing the sensitive instruction, the virtual machine execution is resumed according to a completion signal fed back by the virtual machine monitoring module.
Preferably, the virtual machine running module and the virtual machine monitoring module are connected in a communication mode of inter-core interrupt or shared memory.
Preferably, the virtual machine monitoring module modifies the state of the virtual machine running module under any one or more of the following conditions:
when the virtual machine running module executes a sensitive instruction which needs to modify the state of the key register of the current physical processor, the virtual machine monitoring module modifies the state of the virtual machine running module in the processing process;
-modifying a physical APIC (advanced programmable interrupt controller) state of the virtual machine execution module when the virtual machine monitoring module has finished processing the external interrupt.
According to another aspect of the invention, a software-simulated split virtual machine is provided, each virtual machine processor of the split virtual machine corresponds to two threads, namely a virtual machine running thread and a virtual machine monitoring thread; the virtual machine running thread and the virtual machine monitoring thread run on different physical processors respectively and are in communication connection in a shared memory or inter-core interrupt mode; wherein:
a physical processor for running a virtual machine running thread is called a virtual machine running core;
the physical processor running the virtual machine monitor thread becomes the virtual machine monitor core.
Preferably, the method for processing the sensitive instruction by the separate virtual machine includes:
the virtual machine running thread is used for running a virtual machine code, and when a sensitive instruction is executed, the virtual machine exits, and the state of the virtual machine is stored; the virtual machine monitoring thread is used for processing virtual machine exit generated by the virtual machine running thread, informing the virtual machine running thread to recover virtual machine execution and finishing processing of the sensitive instruction.
Preferably, the method for processing the sensitive instruction by the split virtual machine includes the following steps:
the virtual machine running thread executes the sensitive instruction and exits the virtual machine;
the virtual machine running thread saves the virtual machine state and loads the host machine state;
the virtual machine running thread informs the virtual machine monitoring thread that the virtual machine exits and enters a waiting state;
the virtual machine monitoring thread loads a virtual machine control structure VMCS corresponding to a virtual machine processor VCPU;
the virtual machine monitoring thread reads the reason and the detailed information of the virtual machine exit and processes the virtual machine exit;
the virtual machine monitoring thread informs the virtual machine running thread that the virtual machine exits from the processing and enters a waiting state;
the virtual machine running thread exits the waiting state and loads a virtual machine control structure VMCS corresponding to a virtual machine processor VCPU;
and the virtual machine running thread saves the current state and loads the virtual machine state to start executing the virtual machine code.
According to a third aspect of the present invention, there is provided a method for constructing a software-simulated split virtual machine, including:
the user sends a request for creating the virtual machine to the virtual machine management software, wherein the request at least comprises the following parameters: the type of the virtual machine to be created, the number of virtual machine processors and the size of a virtual machine memory;
the virtual machine management software analyzes the parameters, creates a virtual machine monitoring thread for each virtual machine processor, and binds the virtual machine monitoring thread to a fixed physical processor;
the virtual machine monitoring thread creates a virtual machine running thread corresponding to the virtual machine monitoring thread for each virtual machine processor, binds the virtual machine running thread to another fixed physical processor and then returns, and the virtual machine running thread enters a waiting state;
the virtual machine monitoring thread completes the initialization work of the virtual machine and informs the virtual machine running thread to start running the virtual machine codes;
and the virtual machine running thread receives the request of the virtual machine monitoring thread and starts to execute the virtual machine code, so that the construction of the software simulation separate virtual machine is completed.
According to a fourth aspect of the present invention, there is provided a method for optimizing a software-simulated split virtual machine, including any one or more of the following:
-a paravirtualization extension comprising:
directly sending the sensitive instruction to be executed by the virtual machine running thread to the virtual machine monitoring thread, wherein the virtual machine monitoring thread simulates the execution of the sensitive instruction and returns the execution result to the virtual machine running thread, and the virtual machine does not exit in the period;
-a hardware extension, the hardware extension comprising:
and adopting a lightweight inter-core communication mode, when a virtual machine operation core executes a sensitive instruction, suspending the execution of a virtual machine code, transmitting specific information of the sensitive instruction to a virtual machine monitoring core through the lightweight inter-core communication mode, informing the virtual machine operation core in the lightweight inter-core communication mode after the virtual machine monitoring core finishes processing, and immediately resuming the virtual machine execution by the virtual machine operation core.
The lightweight inter-core communication mode specifically comprises the following steps: this communication is similar to, but different from, the hardware signaling of the inter-core interrupt. After receiving the communication signal, the virtual machine monitoring core can read sensitive instructions to be processed and parameters required by processing. And after the virtual machine operation core receives the communication signal, the execution of the virtual machine is immediately recovered.
Preferably, in the para-virtualization extension mode, the method for processing the sensitive instruction by the split virtual machine includes:
when the virtual machine running thread executes the sensitive instruction, directly sending the detailed information of the sensitive instruction to the virtual machine monitoring thread and waiting for the return result of the virtual machine monitoring thread;
the virtual machine monitoring thread simulates the execution of a sensitive instruction and returns an execution result to the virtual machine running thread;
the virtual machine execution thread continues to execute guest code.
Preferably, in the hardware expansion mode, the method for processing the sensitive instruction by the split virtual machine includes:
when the separated virtual machine executes the sensitive instruction, the virtual machine operation core stops executing the virtual machine operation;
the virtual machine operation core sends detailed information of the sensitive instruction to the virtual machine monitoring core in a lightweight inter-core communication mode;
the virtual machine monitors execution of a core simulation sensitive instruction and modifies the register state of a running core of the virtual machine;
after the virtual machine monitoring core processes the sensitive instruction, feeding back completion information to the virtual machine running core in a lightweight inter-core communication mode;
and the virtual machine operation core restores the operation of the virtual machine and continues to execute the virtual machine instruction.
Compared with the prior art, the invention has the following beneficial effects:
according to the separated virtual machine and the virtual machine architecture, the construction method and the optimization method thereof, each virtual machine processor is divided into the virtual machine operation module (Guest) and the virtual machine monitoring module (Hypervisor), and the virtual machine operation module (Guest) and the virtual machine monitoring module (Hypervisor) are separated to different physical processors (physical cores) for operation, so that the interference of the virtual machine processors on the operation environment of each other due to the sharing of physical resources is avoided, the virtualization performance is improved, and the requirements of high-performance and low-delay applications in a cloud environment are met.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a diagram of a split virtual chassis architecture in accordance with a preferred embodiment of the present invention;
FIG. 2 is a flow chart illustrating the processing of VM-Exit in a software emulated split virtual machine in a preferred embodiment of the present invention;
FIG. 3 is a flowchart illustrating the operation of a separate virtual machine for software simulation in a para-virtualization extension manner according to an embodiment of the present invention;
fig. 4 is a flowchart of the operation of the split virtual machine in software simulation in the hardware expansion manner according to the preferred embodiment of the present invention.
Detailed Description
The following examples illustrate the invention in detail: the embodiment is implemented on the premise of the technical scheme of the invention, and a detailed implementation mode and a specific operation process are given. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.
An embodiment of the present invention provides a split virtual machine architecture, which, aiming at the defects existing in the prior art, is provided with the following features:
the method is characterized in that: the virtual processor of each virtual machine comprises two modules, a virtual machine running module and a virtual machine monitoring module.
And (2) feature: the virtual machine running module and the virtual machine monitoring module should run on different physical cores (i.e., physical processors) without sharing physical resources such as registers and caches.
And (3) feature: the virtual machine execution module and the virtual machine monitor module should be able to communicate in some way.
Wherein:
the virtual machine running module has the following characteristics:
the method is characterized in that: the method runs on a fixed physical core and can directly execute most of non-sensitive instructions of the virtual machine.
And (2) feature: when the sensitive instruction is executed, the sensitive instruction can be sent to the virtual machine monitoring module in a certain mode, then the execution of the virtual machine is suspended, and the virtual machine monitoring module is waited for processing.
And (3) feature: and the signal from the virtual machine monitoring module can be received to restore the execution of the virtual machine.
And (4) feature: the system has own physical resources, and cannot generate any interference on the running environment of the virtual machine monitoring module.
The virtual machine monitoring module has the following characteristics:
the method is characterized in that: the method runs on a fixed physical core and can directly execute sensitive instructions.
And (2) feature: the method can receive signals from the virtual machine operation module and process sensitive instructions sent by the virtual machine operation module.
And (3) feature: the virtual machine execution module can be notified in some way that sensitive instruction processing is complete.
And (4) feature: the method has own physical resources and can modify the state of the virtual machine operation module if necessary.
The communication mechanism between the virtual machine monitoring module and the virtual machine running module has the following characteristics:
the method is characterized in that: the virtual machine running module can inform the virtual machine monitoring module in a certain mode that a certain sensitive instruction and the detailed information of the sensitive instruction are executed.
And (2) feature: the virtual machine monitor module can somehow inform the virtual machine execution module that sensitive instruction processing is complete and modify the state of the virtual machine execution module if necessary.
Based on the above features, the separated virtual machine architecture provided in this embodiment adopts the following technical solutions:
the split virtual machine architecture comprises: the virtual machine monitoring system comprises one or more virtual machine processors, wherein each virtual machine processor comprises a virtual machine running module and a virtual machine monitoring module which run on different physical processors, and the virtual machine running module is in communication connection with the virtual machine monitoring module.
As a preferred embodiment, the virtual machine running module and the virtual machine monitoring module run on fixed physical processors respectively and have their own physical resources respectively; wherein:
the virtual machine operation module is used for executing the non-sensitive instruction of the virtual machine and sending the sensitive instruction to the virtual machine monitoring module;
the virtual machine monitoring module is used for executing the sensitive instruction sent by the virtual machine operation module and feeding back the executed sensitive instruction and the detailed information thereof to the virtual machine operation module;
when the virtual machine monitoring module processes the sensitive instruction, the virtual machine running module controls the virtual machine to suspend execution, and after the virtual machine monitoring module finishes processing the sensitive instruction, the virtual machine execution is resumed according to a completion signal fed back by the virtual machine monitoring module in a mode.
As a preferred embodiment, the virtual machine running module and the virtual machine monitoring module communicate with each other by way of inter-core interrupt or shared memory.
As a preferred embodiment, the virtual machine monitoring module feeds back the executed sensitive instruction and the detailed information thereof to the virtual machine running module through inter-core interrupt or shared memory.
As a preferred embodiment, the virtual machine monitoring module resumes the execution of the virtual machine according to a completion signal fed back by the virtual machine monitoring module in a manner of inter-core interrupt or shared memory.
As a preferred embodiment, the virtual machine monitoring module modifies the state of the virtual machine running module under any one or more of the following conditions:
when the virtual machine running module executes some sensitive instructions which need to modify the state of the key register of the physical processor where the virtual machine running module is currently located, the virtual machine monitoring module needs to modify the state of the virtual machine running module in the processing process;
when the virtual machine monitoring module finishes processing the external interrupt, the physical APIC (advanced programmable interrupt controller) state of the virtual machine running module needs to be modified.
Based on the above separate virtualization architecture, another embodiment of the present invention provides a software-simulated separate virtual machine and provides a method for constructing the software-simulated separate virtual machine and a method for optimizing performance of the software-simulated separate virtual machine, so as to improve performance of the separate virtual machine.
The software-simulated separate virtual machine provided by this embodiment adopts the following technical scheme:
each virtual machine processor of the software-simulated split virtual machine corresponds to two threads, namely a virtual machine running thread (Guest thread) and a virtual machine monitoring thread (Hypervisor thread). Guest threads and Hypervisor threads run on different physical processors and communicate by way of shared memory or inter-core interrupts. Wherein: the physical processors on which Guest threads and Hypervisor threads reside are referred to as Guest cores and Hypervisor cores, respectively.
As a preferred embodiment, the method for processing the sensitive instruction by the split virtual machine includes:
guest threads are responsible for running virtual machine codes, VM-Exit occurs when sensitive instructions are executed, and virtual machine states are saved. And the Hypervisor thread processes the VM-Exit generated by the Guest thread, informs the Guest thread to recover the virtual machine execution, and completes the processing of the sensitive instruction.
In a preferred embodiment, when a Guest thread executes a sensitive instruction, a method for processing the sensitive instruction by a split virtual machine includes the following steps:
step 1: guest threads execute sensitive instructions, and VM-Exit occurs.
Step 2: guest threads save virtual machine state and load host machine state.
And step 3: the Guest thread informs the Hypervisor thread that a VM-Exit has occurred and enters a wait state.
And 4, step 4: the Hypervisor thread loads the VMCS corresponding to the virtual processor.
And 5: and the Hypervisor thread reads the reason and the detailed information of the VM-Exit and processes the VM-Exit.
Step 6: the Hypervisor thread notifies the Guest thread that VM-Exit processing is complete and enters a wait state.
And 7: and the Guest thread exits the waiting state and loads the VMCS corresponding to the virtual processor.
And 8: the Guest thread saves the loaded virtual machine state to begin executing virtual machine code.
The method for constructing the software-simulated separate virtual machine provided by the embodiment adopts the following technical scheme:
step 1: the user sends a request for creating the virtual machine to the virtual machine management software, wherein the request comprises parameters such as the type of the virtual machine to be created, the number of processors, the size of a memory and the like.
Step 2: the virtual machine management software analyzes the parameters, creates a Hypervisor thread for each virtual processor, and binds the Hypervisor thread to a fixed physical core.
And step 3: the Hypervisor thread creates a corresponding Guest thread for each virtual processor, binds it to a fixed physical core and returns, and the Guest thread enters a wait state.
And 4, step 4: the Hypervisor thread completes the initialization work of the virtual machine and informs the Guest thread to start running the code of the virtual machine.
And 5: and the Guest thread receives the request of the Hypervisor thread to start executing the code of the virtual machine, and the construction of the software simulated separate virtual machine is completed.
The performance optimization method for the software-simulated separate virtual machine provided by the embodiment adopts the following technical scheme:
in order to eliminate VM-Exit caused by sensitive instructions in a software-simulated separate virtual machine, a paravirtualization expansion mode and a hardware expansion mode are provided; wherein:
the paravirtualization expansion mode has the following characteristics:
the method is characterized in that: the Guest thread is allowed not to generate a service in which the VM-Exit requests the Hypervisor thread.
And (2) feature: allowing the Hypervisor thread to return the processing results to the Guest thread in some way does not trigger the VM-Exit.
Based on the characteristics, the technical scheme of the semi-virtualization expansion mode is as follows:
and directly sending the sensitive instruction to be executed by the virtual machine running thread to the virtual machine monitoring thread, wherein the virtual machine monitoring thread simulates the execution of the sensitive instruction and returns the execution result to the virtual machine running thread, and the virtual machine does not exit in the period.
After the semi-virtualization expansion mode is added, the separated virtual machine sensitive instruction processing method comprises the following steps:
step 1: the Guest thread executes the sensitive instruction.
Step 2: the Guest thread directly sends the details of the sensitive instruction to the Hypervisor thread and waits for the Hypervisor thread to return.
And step 3: the Hypervisor thread simulates the execution effect of the sensitive instruction and returns the result to the Guest thread.
And 4, step 4: the Guest thread continues to execute Guest code.
The hardware expansion mode eliminates VM-Exit in a hardware layer, and has the following characteristics:
the method is characterized in that: a lightweight inter-core communication approach. When the Guest core executes the sensitive instruction, the execution of the virtual machine code is suspended, the specific information of the sensitive instruction is transmitted to the Hypervisor core in this way, the Guest core is informed in this way after the processing of the Hypervisor core is completed, and the Guest core immediately resumes the virtual machine execution.
And (2) feature: the Hypervisor core can access or modify the state of the Guest core. Such as Guest executing the mov tocr3 instruction, the Hypervisor core writes directly to Guest's cr3 register.
Based on the characteristics, the hardware expansion mode adopts the following technical scheme:
adopting a lightweight inter-core communication mode, when a virtual machine operation core executes a sensitive instruction, suspending the execution of a virtual machine code, transmitting specific information of the sensitive instruction to a virtual machine monitoring core through the lightweight inter-core communication mode, informing the virtual machine operation core in the lightweight inter-core communication mode after the virtual machine monitoring core completes processing, and immediately resuming the virtual machine execution by the virtual machine operation core;
the lightweight inter-core communication mode is specifically as follows: is a hardware signal similar to, but different from, an inter-core interrupt. After receiving the communication signal, the virtual machine monitoring core can read sensitive instructions to be processed and parameters required by processing. And after the virtual machine operation core receives the communication signal, the execution of the virtual machine is immediately recovered.
After a hardware expansion mode is added, the processing method of the separated virtual machine sensitive instruction comprises the following steps:
step 1: and the separate virtual machine executes the sensitive instruction, and the Guest core stops executing the virtual machine to run.
Step 2: and the Guest core sends the detailed information of the sensitive instruction to the Hypervisor core in a lightweight inter-core communication mode.
And step 3: the Hypervisor core simulates the execution of sensitive instructions and modifies the register state of the Guest core.
And 4, step 4: after the Hypervisor core processes the sensitive instruction, informing the Guest core that the sensitive instruction processing is completed through a lightweight inter-core communication mode.
And 5: and the Guest core recovers the running of the virtual machine and executes the instructions of the virtual machine.
In order to explain the purpose and technical scheme of the invention more accurately, the following describes the software simulation based on the multi-core system with a separate virtual machine, paravirtualization expansion and hardware expansion in combination with the accompanying drawings and embodiments. It should be noted that the specific embodiments described herein are merely illustrative of the invention and the usefulness of the invention is not limited thereto.
As shown in FIG. 1, the QEMU receives a user request to create a split virtual machine, creates a Hypervisor thread for each virtual processor, and enters a KVM via an IOCTL system call, which creates a kernel thread, i.e., a Guest thread, for each virtual processor. When everything is ready, the Guest thread starts executing Guest code by entering non-root mode through VM-Entry until executing sensitive instructions triggers VM-Exit. At this point the Guest thread enters root mode and notifies the Hypervisor thread to process the VM-Exit. The specific processing flow of the VM-Exit is shown in FIG. 2.
And the Guest thread reads the shared memory area to know that the VM-Exit processing is completed, and the execution of the virtual machine is recovered. After adding the paravirtualization expansion, the Guest thread directly transfers the sensitive instruction information to be processed to the Hypervisor thread in the non-root mode without triggering the VM-Exit, and the whole flow is as shown in fig. 3.
After the hardware expansion is added, when the Guest core executes the sensitive instruction, the inter-core communication is triggered to send the sensitive instruction to the Hypervisor core, the Hypervisor core processes the sensitive instruction, and the register state of the Guest core is set, and the whole process is as shown in fig. 4.
The present invention provides a split virtual machine and a virtual machine architecture, a construction method and an optimization method thereof, and provides a split virtual machine architecture, under which each virtual machine processor includes two modules: a virtual machine running module (Guest) and a virtual machine monitoring module (Hypervisor), which run on different physical cores (physical processors). Under the traditional virtualization architecture, Guest and Hypervisor run on the same physical core, and share physical resources such as registers and cache regions. The above embodiment of the present invention implements a software-emulated split virtual machine based on the above architecture, and it creatively proposes to create two threads for each virtual machine processor, and communicate in a manner of inter-core interrupt or shared memory, where the architecture of the split virtual machine is as shown in fig. 1. In addition, the above embodiment of the present invention also creatively provides two expanding optimization ways: a paravirtualization expansion mode and a hardware expansion mode. The virtual machine exit in the software-simulated separate virtual machine is eliminated through the two expansion modes, and the virtualization performance of the separate virtual machine is improved. The separated virtual machine architecture under the para-virtualization expansion and the hardware expansion is shown in the attached figures 3 and 4.
It should be noted that, the steps in the method provided by the present invention can be implemented by using corresponding modules, devices, units, and the like in the system, and those skilled in the art can implement the step flow of the method by referring to the technical scheme of the system, that is, the embodiment in the system can be understood as a preferred example of the implementation method, and details are not described herein.
Those skilled in the art will appreciate that, in addition to implementing the system and its various devices provided by the present invention in purely computer readable program code means, the method steps can be fully programmed to implement the same functions by implementing the system and its various devices in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Therefore, the system and various devices thereof provided by the present invention can be regarded as a hardware component, and the devices included in the system and various devices thereof for realizing various functions can also be regarded as structures in the hardware component; means for performing the functions may also be regarded as structures within both software modules and hardware components for performing the methods.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes and modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention.

Claims (10)

1. A separated virtual machine architecture comprises one or more virtual machine processors, and is characterized in that each virtual machine processor comprises a virtual machine running module and a virtual machine monitoring module which run on different physical processors, and the virtual machine running module and the virtual machine monitoring module are in communication connection.
2. The split virtual machine architecture of claim 1, wherein the virtual machine running module and the virtual machine monitoring module respectively run on fixed physical processors and respectively own physical resources; wherein:
the virtual machine operation module is used for executing the non-sensitive instruction of the virtual machine and sending the sensitive instruction to the virtual machine monitoring module;
the virtual machine monitoring module is used for executing the sensitive instruction sent by the virtual machine operation module and feeding back the executed sensitive instruction and the detailed information thereof to the virtual machine operation module;
when the virtual machine monitoring module processes the sensitive instruction, the virtual machine running module controls the virtual machine to suspend execution, and after the virtual machine monitoring module finishes processing the sensitive instruction, the virtual machine execution is resumed according to a completion signal fed back by the virtual machine monitoring module.
3. The split virtual machine architecture of claim 1, further comprising any one or more of:
-the virtual machine monitoring module modifying the state of the virtual machine running module in any one or any number of situations:
when the virtual machine operation module executes a sensitive instruction which needs to modify the state of the key register of the physical processor where the virtual machine operation module is located, the virtual machine monitoring module modifies the state of the virtual machine operation module in the processing process;
when the virtual machine monitoring module finishes processing external interrupt, modifying the physical APIC state of the virtual machine running module;
the virtual machine running module and the virtual machine monitoring module are connected in a communication mode of inter-core interrupt or shared memory.
4. A software-simulated split virtual machine is characterized in that each virtual machine processor of the split virtual machine corresponds to two threads which are respectively a virtual machine running thread and a virtual machine monitoring thread; the virtual machine running thread and the virtual machine monitoring thread run on different physical processors respectively and are in communication connection in a shared memory or inter-core interrupt mode; wherein:
a physical processor for running a virtual machine running thread is called a virtual machine running core;
the physical processor running the virtual machine monitor thread becomes the virtual machine monitor core.
5. The software-emulated split virtual machine of claim 4, wherein the split virtual machine processes sensitive instructions by:
the virtual machine running thread is used for running a virtual machine code, and when a sensitive instruction is executed, the virtual machine exits, and the state of the virtual machine is stored; the virtual machine monitoring thread is used for processing virtual machine exit generated by the virtual machine running thread, informing the virtual machine running thread to recover virtual machine execution and finishing processing of the sensitive instruction.
6. The separated virtual machine of software simulation according to claim 5, wherein the method for processing the sensitive instruction by the separated virtual machine comprises the following steps:
the virtual machine running thread executes the sensitive instruction and exits the virtual machine;
the virtual machine running thread saves the virtual machine state and loads the host machine state;
the virtual machine running thread informs the virtual machine monitoring thread that the virtual machine exits and enters a waiting state;
the virtual machine monitoring thread loads a virtual machine control structure VMCS corresponding to a virtual machine processor VCPU;
the virtual machine monitoring thread reads the reason and the detailed information of the virtual machine exit and processes the virtual machine exit;
the virtual machine monitoring thread informs the virtual machine running thread that the virtual machine exits from the processing and enters a waiting state;
the virtual machine running thread exits the waiting state and loads a virtual machine control structure VMCS corresponding to a virtual machine processor VCPU;
and the virtual machine running thread saves the current state and loads the virtual machine state to start executing the virtual machine code.
7. A method for constructing a software-simulated split virtual machine according to any one of claims 4 to 6, comprising:
the user sends a request for creating the virtual machine to the virtual machine management software, wherein the request at least comprises the following parameters: the type of the virtual machine to be created, the number of virtual machine processors and the size of a virtual machine memory;
the virtual machine management software analyzes the parameters, creates a virtual machine monitoring thread for each virtual machine processor, and binds the virtual machine monitoring thread to a fixed physical processor;
the virtual machine monitoring thread creates a virtual machine running thread corresponding to the virtual machine monitoring thread for each virtual machine processor, binds the virtual machine running thread to another fixed physical processor and then returns, and the virtual machine running thread enters a waiting state;
the virtual machine monitoring thread completes the initialization work of the virtual machine and informs the virtual machine running thread to start running the virtual machine codes;
and the virtual machine running thread receives the request of the virtual machine monitoring thread and starts to execute the virtual machine code, so that the construction of the software simulation separate virtual machine is completed.
8. The method for optimizing the software simulation separate virtual machine according to claim 4, wherein the method includes any one or more of the following modes:
-a paravirtualization extension comprising:
directly sending the sensitive instruction to be executed by the virtual machine running thread to the virtual machine monitoring thread, wherein the virtual machine monitoring thread simulates the execution of the sensitive instruction and returns the execution result to the virtual machine running thread, and the virtual machine does not exit in the period;
-a hardware extension, the hardware extension comprising:
and adopting a lightweight inter-core communication mode, when a virtual machine operation core executes a sensitive instruction, suspending the execution of a virtual machine code, transmitting specific information of the sensitive instruction to a virtual machine monitoring core through the lightweight inter-core communication mode, informing the virtual machine operation core in the lightweight inter-core communication mode after the virtual machine monitoring core finishes processing, and immediately resuming the virtual machine execution by the virtual machine operation core.
9. The method for optimizing the detached virtual machine for software simulation according to claim 8, wherein in the para-virtualization extension mode, the method for processing the sensitive instruction by the detached virtual machine includes:
when the virtual machine running thread executes the sensitive instruction, directly sending the detailed information of the sensitive instruction to the virtual machine monitoring thread and waiting for the return result of the virtual machine monitoring thread;
the virtual machine monitoring thread simulates the execution of a sensitive instruction and returns an execution result to the virtual machine running thread;
the virtual machine execution thread continues to execute guest code.
10. The method for optimizing the detached virtual machine for software simulation according to claim 8, wherein in the hardware expanding manner, the method for processing the sensitive instruction by the detached virtual machine includes:
when the separated virtual machine executes the sensitive instruction, the virtual machine operation core stops executing the virtual machine operation;
the virtual machine operation core sends detailed information of the sensitive instruction to the virtual machine monitoring core in a lightweight inter-core communication mode;
the virtual machine monitors execution of a core simulation sensitive instruction and modifies the register state of a running core of the virtual machine;
after the virtual machine monitoring core processes the sensitive instruction, feeding back completion information to the virtual machine running core in a lightweight inter-core communication mode;
and the virtual machine operation core restores the operation of the virtual machine and continues to execute the virtual machine instruction.
CN202010660215.1A 2020-07-10 2020-07-10 Separated virtual machine and virtual machine architecture, construction method and optimization method thereof Pending CN113918272A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010660215.1A CN113918272A (en) 2020-07-10 2020-07-10 Separated virtual machine and virtual machine architecture, construction method and optimization method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010660215.1A CN113918272A (en) 2020-07-10 2020-07-10 Separated virtual machine and virtual machine architecture, construction method and optimization method thereof

Publications (1)

Publication Number Publication Date
CN113918272A true CN113918272A (en) 2022-01-11

Family

ID=79232000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010660215.1A Pending CN113918272A (en) 2020-07-10 2020-07-10 Separated virtual machine and virtual machine architecture, construction method and optimization method thereof

Country Status (1)

Country Link
CN (1) CN113918272A (en)

Similar Documents

Publication Publication Date Title
KR100951734B1 (en) Mechanism to emulate user-level multithreading on an os-sequestered sequencer
US5511217A (en) Computer system of virtual machines sharing a vector processor
US20090007112A1 (en) Method for controlling a virtual machine and a virtual machine system
US20170329623A1 (en) Support for application transparent, high available gpu computing with vm checkpointing
US9164784B2 (en) Signalizing an external event using a dedicated virtual central processing unit
US20160048676A1 (en) Apparatus and method thereof for efficient execution of a guest in a virtualized environment
US9715403B2 (en) Optimized extended context management for virtual machines
US9959134B2 (en) Request processing using VM functions
CN111459623B (en) Method, device and computer for restoring running of application program
CN103473135B (en) The processing method of spin lock LHP phenomenon under virtualized environment
US11099884B2 (en) Dynamic control of halt polling based on receiving a monitoring instruction executed by a guest
WO2017052972A1 (en) Technologies for multi-level virtualization
EP3979072B1 (en) Firmware boot task distribution to enable low latency boot performance
US9606825B2 (en) Memory monitor emulation for virtual machines
US10977191B2 (en) TLB shootdowns for low overhead
US20210055948A1 (en) Fast thread execution transition
US11243800B2 (en) Efficient virtual machine memory monitoring with hyper-threading
JPS63279328A (en) Control system for guest execution of virtual computer system
CN113918272A (en) Separated virtual machine and virtual machine architecture, construction method and optimization method thereof
EP3502906B1 (en) Tlb shootdown for low overhead
US10152341B2 (en) Hyper-threading based host-guest communication
US20230418509A1 (en) Switching memory consistency models in accordance with execution privilege level
US11726811B2 (en) Parallel context switching for interrupt handling
US20170147377A1 (en) Lazy timer programming for virtual machines
Villa et al. Scalable transparent checkpoint-restart of global address space applications on virtual machines over Infiniband

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination