Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those skilled in the art obtain, all belongs to the scope of protection of the invention.
Refer to accompanying drawing 1, be the method flow schematic diagram that interruption is provided in the virtualization system that provides of the embodiment of the present invention, mainly comprise step S101, step S102 and step S103:
S101, there is provided interface, to make described Guest OS call described interface, interrupt identification bit register corresponding with described Guest OS in shared drive is arranged interrupt identification to virtualizing operating systems Guest OS, described shared drive is that real-time embedded virtual component Hypervisor and at least one Guest OS shares and physical memory for recording interrupt identification.
In embodiments of the present invention, Guest OS is a kind of virtualizing operating systems, this type operating system and general operation system difference are, not single physical CPU only runs such virtualizing operating systems or such virtualizing operating systems only operates on single physical CPU, namely not directly run on hardware layer (Hardware), but the real-time embedded virtual component Hypervisor run on hardware layer, as shown in Figure 2, that on single physical CPU, operation multiple Guest OS and single Guest OS runs on the scene schematic diagram on multiple physical cpu.Such as, Guest OS
0with Guest OS
1physical cpu is run on by Hypervisor
0(Core
0) on, and Guest OS
nphysical cpu is run on by Hypervisor
1(Core
1), physical cpu
2(Core
2) and physical cpu
n(Core
n) on.
Being closed by the communication modes of interrupt notification (Hyper Call) from prior art interrupts different, and in embodiments of the present invention, real-time embedded virtual component Hypervisor provides one deck intermediate address, and this intermediate address manages with shadow page table; Set up Guest OS by Guest OS and set up the mapping of intermediate address to physical memory addresses to the mapping of intermediate address and Hypervisor, here Guest OS is called ground floor address maps to the mapping of intermediate address, intermediate address to the mapping of physical memory addresses is called second layer address maps.The effect of ground floor address maps be real-time embedded virtual component Hypervisor can on the real-time embedded virtual component Hypervisor of perception all Guest OS to the demand of physical memory and unified management, the effect of second layer address maps is that real-time embedded virtual component Hypervisor according to the demand of Guest OS to physical memory, can divide physical memory resource with having planning property.
After establishing ground floor address maps and second layer address maps, real-time embedded virtual component Hypervisor and at least one Guest OS can be set up and share and physical memory for recording interrupt identification.In the following description, for convenience of description, real-time embedded virtual component Hypervisor and at least one Guest OS is shared and the physical memory being used for recording interrupt identification referred to as " shared drive ", obviously, shared drive is a part for physical memory.As shown in Figure 3, be the schematic diagram that shared drive is provided at physical memory in the method that provides of the embodiment of the present invention.Shared drive can be accessed jointly by Hypervisor and at least one Guest OS, and, the memory headroom that Guest OS different in described shared drive and described Hypervisor shares is isolated mutually, and the memory headroom that namely in shared drive, any one Guest OS and Hypervisor shares and the memory headroom that another Guest OS and Hypervisor shares are isolation mutually.Such as, in fig. 3, Guest OS
0to share with Hypervisor and for " the VM in the physical memory that records interrupt identification and shared drive
0interrupt identification bit space ", Guest OS
1to share with Hypervisor and for " the VM in the physical memory that records interrupt identification and shared drive
1interrupt identification bit space " and Guest OS
2to share with Hypervisor and for " the VM in the physical memory that records interrupt identification and shared drive
2interrupt identification bit space " be isolation mutually.
As one embodiment of the invention, there is provided interface interrupt identification bit register corresponding with described Guest OS in shared drive is arranged interrupt identification to make described Guest OS call described interface can be to virtualizing operating systems Guest OS: real-time embedded virtual component Hypervisor provides interface to call described interface to make described Guest OS to Guest OS, according to the intermediate address information that described interface provides, by ground floor address maps access intermediate address, described shared drive is accessed by second layer address maps according to described intermediate address, the interrupt identification bit register corresponding with described Guest OS is arranged interrupt identification, such as, use logical zero to represent and close and interrupt, use logical one to represent and open interruption.It should be noted that, because real-time embedded virtual component Hypervisor establishes ground floor address maps and second layer address maps, therefore, Guest OS is when arranging interrupt identification, although be the interface accessing intermediate address provided by aforementioned ground floor address maps and real-time embedded virtual component Hypervisor, then, finally shared drive is had access to by second layer address maps, but in system operation, for Guest OS, from directly to access shared drive not different, namely Guest OS thinks directly to access shared drive, the interrupt identification bit register corresponding with this Guest OS is arranged interrupt identification.
S102, checks described interrupt identification bit register.
As one embodiment of the invention, when checking described interrupt identification bit register, can be that the vectorial abnormality processing function of specifying of execute exception is to check described interrupt identification bit register.Particularly, the physical discontinuity that hardware produces, such as, first common physical interruption or rapid physical interruption etc. are routed to physics core by GIC, physics core runs Hypervisor program, then the exception vector table of Hypervisor is entered into, and the abnormality processing function that the exception vector jumping to Hypervisor is specified, in the interrupt processing process of Hypervisor, check the content of interrupt identification bit register.
In the embodiment of above-mentioned inspection interrupt identification bit register, it can be the clock provided according to real-time embedded virtual component Hypervisor, periodically interrupt identification bit register described in poll, namely described interrupt identification bit register is initiatively checked, also can be under the triggering of the physical discontinuity of hardware generation, check described interrupt identification bit register, i.e. the described interrupt identification bit register of passive inspection.
S103, interrupts if described interrupt identification bit register shows that described Guest OS needs are closed, then forbid sending virtual interrupt to described Guest OS.
Such as, interrupt if use logical zero to represent and close, use logical one to represent and open interruption, then the content being checked through interrupt identification bit register is logical zero, then forbid the physical discontinuity produced to described Guest OS transmission hardware.
The method of closing interruption from the virtualization system that the invention described above embodiment provides is known, because real-time embedded virtual component Hypervisor provides interface to virtualizing operating systems Guest OS, Hypervisor can share with at least one Guest OS and be used for recording the interrupt identification bit register corresponding with described Guest OS in the physical memory of interrupt identification and shared drive and arrange interrupt identification by described Guest OS.With prior art by compared with the method that provides the communication modes of interrupt notification to close to interrupt, the method that the embodiment of the present invention provides does not rely on Hypervisor and Guest OS and jointly compiles, and Hypervisor does not need to share code segment with Guest OS; Be separated because virtualization layer is videoed with Guest OS, undertaken the access of shared drive by virtual address, therefore, interrupt hourly velocity in close/open fast, running efficiency of system is high.
Referring to accompanying drawing 4, is the apparatus structure schematic diagram of closing interruption in the virtualization system that provides of the embodiment of the present invention.For convenience of explanation, illustrate only the part relevant to the embodiment of the present invention.The device of closing interruption in the virtualization system of accompanying drawing 4 example comprises interface provides module 401, zone bit checking module 402 and interrupt holdoff sending module 403, wherein:
Interface provides module 401, to make described Guest OS call described interface, interrupt identification bit register corresponding with described Guest OS in shared drive is arranged interrupt identification for providing interface to virtualizing operating systems Guest OS, described shared drive is that real-time embedded virtual component Hypervisor and at least one Guest OS shares and physical memory for recording interrupt identification, wherein, the memory headroom that different in described shared drive Guest OS and described Hypervisor shares is isolated mutually.
Zone bit checking module 402, with the described interrupt identification bit register of inspection.
Interrupt holdoff sending module 403, if check that described interrupt identification bit register shows that described Guest OS needs are closed and interrupts for described zone bit checking module 402, then forbids sending virtual interrupt to described Guest OS.
It should be noted that, close in the embodiment of the device of interruption in above virtualization system, the division of each functional module only illustrates, can be as required in practical application, the facility of the such as configuration requirement of corresponding hardware or the realization of software is considered, and above-mentioned functions distribution is completed by different functional modules, the inner structure by described cable modem eedle threader is divided into different functional modules, to complete all or part of function described above.And, in practical application, corresponding functional module in the present embodiment can be by corresponding hardware implementing, also can perform corresponding software by corresponding hardware to complete, such as, aforesaid interface provides module, can be have to perform aforementionedly to provide interface with make described Guest OS call hardware that interrupt identification bit register corresponding with described Guest OS in shared drive to be arranged interrupt identification by described interface to virtualizing operating systems Guest OS, such as interface provider, also can be general processor or other hardware devices that can perform corresponding computer program thus complete aforementioned function, for another example aforesaid zone bit checking module, can be that there is the hardware performing the described interrupt flag bit register functions of aforementioned inspection, such as zone bit detector also can be general processor or other hardware devices (each embodiment that this instructions provides all can apply foregoing description principle) that can perform corresponding computer program thus complete aforementioned function.
The interface of accompanying drawing 4 example provides module 401 can comprise interface interchange unit 501 and interrupt identification setting unit 502, closes the device of interruption in the virtualization system that another embodiment of the present invention provides as shown in Figure 5, wherein:
Interface interchange unit 501, calls described interface for providing interface to virtualizing operating systems Guest OS to make described Guest OS;
Interrupt identification setting unit 502, for the intermediate address information provided according to described interface, by ground floor address maps access intermediate address, according to described intermediate address and by second layer address maps, the interrupt identification bit register corresponding with described Guest OS is arranged interrupt identification, described ground floor address maps is the mapping of described Guest OS to intermediate address, described second layer address maps is the mapping of described intermediate address to physical memory addresses, and described physical memory comprises described shared drive.
The device of closing interruption in the virtualization system of accompanying drawing 4 or accompanying drawing 5 example can also comprise mapping and set up module 601 and shared drive sets up module 602, the device of interruption is closed in the virtualization system that another embodiment of the present invention provides as shown in accompanying drawing 6a or accompanying drawing 6b, wherein:
Module 601 is set up in mapping, for setting up Guest OS to the mapping of intermediate address and described intermediate address to the mapping of physical memory addresses.
Shared drive sets up module 602, and for setting up described shared drive, the memory headroom that Guest OS different in described shared drive and described Hypervisor shares is isolated mutually.
The clock that the zone bit checking module 402 of accompanying drawing 4 example can provide according to real-time embedded virtual component Hypervisor, periodically interrupt identification bit register described in poll, under the triggering of the physical discontinuity that also can produce at hardware, check described interrupt identification bit register.Zone bit checking module 402 can comprise the first performance element 701, closes the device of interruption in the virtualization system that another embodiment of the present invention provides as shown in Figure 7,
Performance element 701, for the vectorial abnormality processing function of specifying of execute exception to check described interrupt identification bit register.Particularly, the physical discontinuity that hardware produces, such as, first common physical interruption or rapid physical interruption etc. are routed to physics core by GIC, physics core runs Hypervisor program, then the exception vector table of Hypervisor is entered into, and the abnormality processing function that the exception vector jumping to Hypervisor is specified, the abnormality processing function that in performance element 701 execute exception vector table, exception vector is specified in the interrupt processing process of Hypervisor is to check the content of interrupt identification bit register.
It should be noted that, the content such as information interaction, implementation between each module/unit of said apparatus, due to the inventive method embodiment based on same design, its technique effect brought is identical with the inventive method embodiment, particular content see describing in the inventive method embodiment, can repeat no more herein.
The all or part of step that one of ordinary skill in the art will appreciate that in the various methods of above-described embodiment is that the hardware that can carry out instruction relevant by program has come, such as following various method one or more or all:
There is provided interface, to make described Guest OS call described interface, interrupt identification bit register corresponding with described Guest OS in shared drive is arranged interrupt identification to virtualizing operating systems Guest OS, described shared drive is that real-time embedded virtual component Hypervisor and at least one Guest OS shares and physical memory for recording interrupt identification;
Check described interrupt identification bit register;
Interrupt if described interrupt identification bit register shows that described Guest OS needs are closed, then forbid sending virtual interrupt to described Guest OS.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is that the hardware that can carry out instruction relevant by program has come, this program can be stored in a computer-readable recording medium, storage medium can comprise: ROM (read-only memory) (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), disk or CD etc.
The method and apparatus of closing interruption in the virtualization system provided the embodiment of the present invention is above described in detail, apply specific case herein to set forth principle of the present invention and embodiment, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.