Interrupt handling methods and apparatus, computer-readable storage media
By leveraging the combined efforts of the virtual machine monitor and the interrupt control unit, the problem of interrupt information from pass-through physical peripherals being exclusively available was solved, enabling the sharing of interrupt information among multiple virtual machines.
Patent Information
- Application Number
- CN202310736321.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-20
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-06-20
AI Technical Summary
In existing technologies, interrupt information of pass-through physical peripherals can only be obtained by the pass-through virtual machine and cannot be obtained by other virtual machines.
The interrupt request from the virtual machine is obtained through the virtual machine monitor, a control signal is generated, and a path is established with the target physical peripheral through the interrupt control unit, and then the interrupt information is sent to the virtual machine that needs it.
This enables other virtual machines to obtain interrupt information even when the target physical peripheral is directly connected to the target virtual machine, thus improving the ability to share interrupt information among virtual machines.
Smart Images

Figure CN116775521B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of virtual machine technology, and in particular to an interrupt handling method and apparatus, and a computer-readable storage medium. Background Technology
[0002] A hypervisor, also known as a Virtual Machine Monitor (VMM), is the software, firmware, or hardware used to create and run virtual machines (VMs). A virtual machine, also called a guest operating system, is an operating system that runs within the hypervisor. The host operating system, in contrast to the guest operating system, is the system that runs on the hardware device.
[0003] In the Virtual Machine Monitor, passthrough refers to assigning a physical peripheral to a virtual machine (VM), allowing the VM to directly access the physical peripheral without going through the Virtual Machine Monitor.
[0004] In the prior art, when a physical peripheral is directly connected to a virtual machine, the physical peripheral is exclusively used by that virtual machine. That is, the interrupt information of the physical peripheral can only be obtained by that virtual machine and cannot be obtained by other virtual machines. Summary of the Invention
[0005] This invention provides an interrupt handling method and apparatus, enabling other virtual machines running in a virtual machine monitor to obtain interrupt information from pass-through physical peripherals.
[0006] In a first aspect, the present invention provides an interrupt handling apparatus, comprising: a virtual machine monitor and an interrupt control unit, wherein the virtual machine monitor runs N virtual machines; wherein: the virtual machine monitor is adapted to acquire an interrupt request sent by at least one virtual machine, generate and send a first control signal based on the interrupt request, the interrupt request being used to request interrupt information of a target physical peripheral, and to receive the interrupt information of the target physical peripheral and send the interrupt information of the target physical peripheral to the at least one virtual machine; the target physical peripheral is directly connected to a target virtual machine, and the target virtual machine is different from the at least one virtual machine; the interrupt control unit is adapted to establish a path with the target physical peripheral based on the first control signal, the path being used to transmit the interrupt information of the target physical peripheral; and to send the interrupt information of the target physical peripheral; N is a positive integer and N≥2.
[0007] Optionally, the virtual machine monitor is further adapted to send a second control signal after sending the interrupt information of the target physical peripheral to the at least one virtual machine; the interrupt control unit is further adapted to disconnect the path with the target physical peripheral based on the second control signal.
[0008] Optionally, the virtual machine monitor includes: an interrupt communication unit and an arbitration unit, wherein: the interrupt communication unit is adapted to transmit an interrupt request sent by the at least one virtual machine to the arbitration unit; and to transmit interrupt information of the target physical peripheral sent by the arbitration unit to the at least one virtual machine; the arbitration unit is adapted to generate the first control signal based on the interrupt request sent by the at least one virtual machine transmitted by the interrupt communication unit; and to receive the interrupt information of the target physical peripheral and send the interrupt information of the target physical peripheral to the interrupt communication unit.
[0009] Optionally, the arbitration unit is further adapted to generate the second control signal after sending the interrupt information of the target physical peripheral to the interrupt communication unit.
[0010] Optionally, the interrupt handling device further includes: a general interrupt controller, adapted to receive the first control signal and forward the first control signal to the interrupt control unit.
[0011] Optionally, the general interrupt controller is also adapted to receive the second control signal and forward the second control signal to the interrupt control unit.
[0012] Secondly, the present invention also provides an interrupt handling method, comprising: acquiring an interrupt request sent by at least one virtual machine; the interrupt request being used to request interrupt information of a target physical peripheral; the target physical peripheral being directly connected to a target virtual machine, and the target virtual machine being different from the at least one virtual machine; generating a first control signal based on the interrupt request and sending it; receiving the interrupt information of the target physical peripheral sent by an interrupt control unit, and sending the interrupt information of the target physical peripheral to the at least one virtual machine.
[0013] Optionally, after sending the interrupt information of the target physical peripheral to the at least one virtual machine, the method further includes: sending a second control signal, the second control signal being used to control the interrupt control unit to disconnect the path between itself and the target physical peripheral.
[0014] Optionally, the interrupt handling method further includes: establishing a passthrough between the target physical peripheral and the target virtual machine.
[0015] Thirdly, the present invention also provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored, wherein the computer program is executed by a processor to perform the steps of any of the above-described interrupt handling methods.
[0016] Compared with the prior art, the technical solution of the present invention has the following beneficial effects:
[0017] The virtual machine monitor receives interrupt requests from at least one virtual machine, generates a corresponding first control signal, and sends it. Based on the first control signal, the interrupt control unit establishes a path with the target physical peripheral, and then sends the interrupt information of the target physical peripheral to the virtual machine monitor. The virtual machine monitor then sends the received interrupt information of the target physical peripheral to the virtual machine that sent the interrupt request. Thus, when the target physical peripheral is directly connected to the target virtual machine, other virtual machines can obtain the interrupt information of the target physical peripheral. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the structure of an interrupt handling device according to an embodiment of the present invention;
[0019] Figure 2 This is a schematic diagram of another interrupt handling device in an embodiment of the present invention;
[0020] Figure 3 This is a schematic diagram of the structure of another interrupt handling device in an embodiment of the present invention;
[0021] Figure 4 This is a flowchart of an interrupt handling method in an embodiment of the present invention. Detailed Implementation
[0022] In the prior art, when a physical peripheral is directly connected to a virtual machine, the physical peripheral will be exclusively used by that virtual machine. That is, the interrupt information of the physical peripheral can only be obtained by that virtual machine and cannot be obtained by other virtual machines.
[0023] For example, virtual machine VM1 is directly connected to physical peripheral device Device1. Physical peripheral device Device1 is exclusively used by virtual machine VM1. Interrupt information of physical peripheral device Device1 can only be obtained by virtual machine VM1 and cannot be obtained by virtual machine VM2.
[0024] In this embodiment of the invention, the virtual machine monitor receives interrupt requests from at least one virtual machine, generates a corresponding first control signal, and sends it to the interrupt control unit. Based on the first control signal, the interrupt control unit establishes a path with the target physical peripheral, and then sends the interrupt information of the target physical peripheral to the virtual machine monitor. The virtual machine monitor then sends the received interrupt information of the target physical peripheral to the virtual machine that sent the interrupt request. Thus, when the target physical peripheral is directly connected to the target virtual machine, other virtual machines can obtain the interrupt information of the target physical peripheral.
[0025] To make the above-mentioned objectives, features and beneficial effects of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0026] This invention provides an interrupt handling device. (Refer to...) Figure 1 The following provides a detailed explanation of the specific structure and working principle of the interrupt handling device.
[0027] In practice, the interrupt handling device may include a virtual machine monitor and an interrupt control unit.
[0028] In this embodiment of the invention, N virtual machines (VMs) can run on the virtual machine monitor, namely VM1 to VMN. N is a positive integer and N≥2.
[0029] In practice, the N virtual machines include at least one target virtual machine, and the target virtual machine has direct communication with the target physical peripheral. For the other virtual machines among the N virtual machines besides the target virtual machine, there may or may not be other physical peripherals with direct communication.
[0030] Specifically, a passthrough between the virtual machine and the physical peripheral can be established by the virtual machine monitor.
[0031] In a specific example, virtual machines VM1, VM2, and VM3 are running on a virtual machine monitor. VM1 is the target virtual machine and is directly connected to physical peripheral Device1 (physical peripheral Device1 is the target physical peripheral corresponding to virtual machine VM1); virtual machines VM2 and VM3 do not have directly connected physical peripherals.
[0032] In this embodiment of the invention, for any virtual machine, when it needs interrupt information for a certain physical peripheral, if the virtual machine is not directly connected to the physical peripheral, the virtual machine can send an interrupt request to the virtual machine monitor. The interrupt request is used to request the interrupt information of the corresponding physical peripheral. The virtual machine monitor can receive the interrupt request sent by the virtual machine.
[0033] Specifically, at any given moment, only one virtual machine may send an interrupt request to the virtual machine monitor.
[0034] For example, virtual machine VM1 is directly connected to physical peripheral device Device1. At time t1, virtual machine VM3 needs interrupt information from physical peripheral device Device1. Virtual machine VM3 sends an interrupt request to the virtual machine monitor to request the interrupt information of physical peripheral device Device1.
[0035] At any given time, two or more virtual machines may send interrupt requests to the virtual machine monitor. Two or more virtual machines may request interrupt information from the same physical peripheral or from different physical peripherals.
[0036] For example, virtual machine VM1 has direct communication with physical peripheral device Device1. Virtual machines VM2 and VM3 both require interrupt information from physical peripheral device Device1, while virtual machine VM4 requires interrupt information from physical peripheral device Device2. At time t1, virtual machines VM2 and VM3 both send interrupt requests to the virtual machine monitor to request interrupt information from physical peripheral device Device1; and virtual machine VM4 sends an interrupt request to the virtual machine monitor to request interrupt information from physical peripheral device Device2.
[0037] It should be noted that virtual machine VM1 communicates directly with physical peripheral device Device1 without going through VM1's interrupt communication unit. Specifically, the implementation of this direct communication between VM1 and Device1 can be found in existing technologies and will not be elaborated upon here.
[0038] In some specific embodiments, for N virtual machines running in a virtual machine monitor, each virtual machine may include an interrupt communication unit. The virtual machine communicates with the virtual machine monitor through the interrupt communication unit to send interrupt requests to the virtual machine monitor. Correspondingly, the virtual machine monitor may be equipped with a corresponding interrupt communication unit to receive interrupt requests sent by the virtual machines.
[0039] In other words, the virtual machine sends an interrupt request to the virtual machine monitor through the interrupt communication unit.
[0040] In other specific embodiments, for N virtual machines running in a virtual machine monitor, at least some of the virtual machines may be equipped with an interrupt communication unit. Virtual machines without an interrupt communication unit may be unable to send interrupt requests to the virtual machine monitor, and thus unable to obtain interrupt information from the target physical peripheral.
[0041] It should be noted that the function of the aforementioned interrupt communication unit is to enable communication between the virtual machine and the virtual machine monitor, allowing the virtual machine to send interrupt requests to the virtual machine monitor. This can be implemented in software and does not involve a specific hardware structure. Furthermore, the aforementioned interrupt communication unit can also be referred to as an interrupt communication interface, an interrupt communication module, an interrupt communication group, etc., and the embodiments of the invention do not limit this to any particular type.
[0042] In practice, an interrupt request sent by a virtual machine may contain the identifier of the virtual machine and the identifier of the target physical peripheral.
[0043] For example, virtual machine VM3 sends an interrupt request to the virtual machine monitor to request interrupt information for physical peripheral Device1. The interrupt request sent by virtual machine VM3 carries the identifier "3" corresponding to the virtual machine and the identifier "1" of the physical peripheral.
[0044] In this embodiment of the invention, the virtual machine monitor receives interrupt requests sent by at least one virtual machine. The virtual machine monitor can determine which virtual machines sent interrupt requests and the physical peripheral to which each interrupt request is directed. The virtual machine monitor can generate and send a first control signal based on the received interrupt requests. The first control signal can be used to instruct the interrupt control unit to establish a path with the target physical peripheral. In other words, the first control signal can be used to inform the interrupt control unit which physical peripherals to establish a path with.
[0045] In this embodiment of the invention, the interrupt handling apparatus may further include a Generic Interrupt Controller (GIC). After generating a first control signal, the virtual machine monitor sends the first control signal to the interrupt control unit. The Generic Interrupt Controller and the interrupt control unit are configured independently of each other.
[0046] Upon receiving the first control signal, the interrupt control unit can establish a path with the target physical peripheral. The target physical peripheral sends interrupt information to the interrupt control unit. The interrupt control unit sends the received interrupt information to the general interrupt controller, which then feeds back the received interrupt information to the virtual machine monitor. The virtual machine monitor can then feed back the received interrupt information to the corresponding virtual machine.
[0047] In practical implementation, the general-purpose interrupt controller can be viewed as providing a communication path between the interrupt control unit and the virtual machine monitor. The general-purpose interrupt controller does not need to process the content of the communication between the interrupt control unit and the virtual machine monitor.
[0048] It is understood that, in some other embodiments of the present invention, the virtual machine monitor may directly send the first control signal to the interrupt control unit.
[0049] In this scenario, the interrupt control unit receives the first control signal and can establish a path with the target physical peripheral. The target physical peripheral sends interrupt information to the interrupt control unit. The interrupt control unit sends the received interrupt information to the virtual machine monitor. The virtual machine monitor can then feed back the received interrupt information to the corresponding virtual machine.
[0050] In some embodiments, the virtual machine monitor may include an arbitration unit that receives interrupt requests collected by the interrupt communication unit in the virtual machine monitor. Based on the interrupt request, the arbitration unit obtains the identifier of the virtual machine carrying the interrupt request and the identifier of the target physical peripheral. Based on the identifier of the virtual machine carrying the interrupt request and the identifier of the target physical peripheral, the arbitration unit generates a first control signal.
[0051] In some embodiments, the first control signal generated by the arbitration unit can be sent to the interrupt control unit. Upon receiving the first control signal, the interrupt control unit establishes a path with the target physical peripheral corresponding to the interrupt request to receive interrupt information sent by the target physical peripheral. The interrupt control unit sends the received interrupt information to the arbitration unit via a general interrupt controller. Upon receiving the interrupt information, the arbitration unit transmits it to the corresponding virtual machine via an interrupt communication unit.
[0052] In some embodiments, the interrupt control unit may have a switching circuit between itself and all physical peripherals. In other embodiments, the interrupt control unit may have a switching circuit between itself and some of the physical peripherals. When the interrupt control unit does not receive the first control signal, the switching path between the interrupt control unit and the physical peripherals is in an open state.
[0053] When the interrupt control unit receives the first control signal, it can establish a path with the target physical peripheral, that is, control the switching circuit between the target physical peripheral to be turned on, thereby establishing a path with the target physical peripheral.
[0054] For example, the interrupt control unit receives a first control signal, which instructs the interrupt control unit to establish a path with the target physical peripheral device Device1. Based on the received first control signal, the interrupt control unit controls the switching circuit between the interrupt control unit and the target physical peripheral device Device1 to be turned on, thereby establishing a path between the interrupt control unit and the target physical peripheral device Device1.
[0055] It should be noted that the arbitration unit in the virtual machine monitor and the interrupt control unit in the general interrupt controller can be implemented in software, which is only a functional limitation.
[0056] Specifically, the functions implemented by the arbitration unit may include receiving interrupt requests sent by virtual machines, generating control signals based on the interrupt requests and sending them to the general interrupt controller, receiving interrupt information sent by the general interrupt controller, and sending the interrupt information to the corresponding virtual machine. The functions implemented by the interrupt control unit may include receiving control signals, controlling the formation of a path between the physical peripherals corresponding to the interrupt requests based on the control signals, receiving interrupt information sent by the physical peripherals, and sending the interrupt information to the virtual machine monitor.
[0057] Therefore, the specific names of the aforementioned arbitration unit, interrupt control unit, etc., can also be other, and the difference in names will not affect the protection scope of the embodiments of the present invention.
[0058] In this embodiment of the invention, after the virtual machine monitor sends the interrupt information of the target physical peripheral to the corresponding virtual machine, it can also send a second control signal. The second control signal is used to control the interrupt control unit to disconnect the path between the interrupt control unit and the target physical peripheral.
[0059] Specifically, the arbitration unit in the virtual machine monitor can generate and send a second control signal after sending the interrupt information of the target physical peripheral to the corresponding virtual machine. The interrupt control unit receives the second control signal and disconnects the path with the target physical peripheral.
[0060] In this embodiment of the invention, when the arbitration unit receives interrupt requests from multiple virtual machines, it can form an interrupt request queue based on the interrupt requests from the multiple virtual machines. The arbitration unit can merge interrupt requests corresponding to the same target physical peripheral, and after receiving the interrupt information corresponding to the target physical peripheral, it can send the interrupt information corresponding to the target physical peripheral to the corresponding multiple virtual machines in parallel.
[0061] For example, the arbitration unit receives interrupt requests from virtual machines VM1, VM2, and VM3. VM1's interrupt request requests interrupt information for physical peripheral Device1, VM2's interrupt request requests interrupt information for physical peripheral Device1, and VM3's interrupt request requests interrupt information for physical peripheral Device2. The arbitration unit merges the interrupt requests from VM1 and VM2. Upon obtaining the interrupt information for physical peripheral Device1, the arbitration unit sends it in parallel to both VM1 and VM2. Upon obtaining the interrupt information for physical peripheral Device2, the arbitration unit sends it to VM3.
[0062] The specific workflow of the interrupt handling device provided in the above embodiments of the present invention will be described below through specific examples.
[0063] Example 1
[0064] Reference Figure 2 The present invention provides a schematic diagram of another interrupt handling device in an embodiment of the present invention.
[0065] Figure 2 The virtual machine monitor is configured to run virtual machines VM1, VM2, VM3, and VM4. There are two physical peripherals: Device1 and Device2.
[0066] The virtual machine monitor controls the establishment of a pass-through between virtual machine VM1 and physical peripheral Device1. Virtual machine VM1 is connected to the CPU interface of the general interrupt controller. In the general interrupt controller, the CPU interface is connected to the distributor. Physical peripherals Device1 and Device2 are each connected to the distributor.
[0067] Virtual machine VM3 requires interrupt information from physical peripheral Device1, and VM3 sends an interrupt request to the virtual machine monitor. The interrupt request carries the virtual machine's identifier "3" and the physical peripheral's identifier "1". Specifically, VM3 sends the interrupt request to the virtual machine monitor through the interrupt communication unit.
[0068] The interrupt communication unit of the virtual machine monitor receives an interrupt request. The arbitration unit of the virtual machine monitor obtains the interrupt request and determines that the interrupt request was sent by virtual machine VM3 to request interrupt information from physical peripheral Device1. The arbitration unit generates a first control signal based on the interrupt request. The first control signal carries the identifier "3" of the virtual machine and the identifier "1" of the physical peripheral.
[0069] The interrupt control unit receives a first control signal via a general interrupt controller and establishes a path with physical peripheral Device1 based on the identifier "1" of the physical peripheral carried in the first control signal. Physical peripheral Device1 sends interrupt message 1. The interrupt control unit receives interrupt message 1 sent by physical peripheral Device1 and forwards interrupt message 1 to the arbitration unit.
[0070] The arbitration unit receives interrupt message 1. Since the arbitration unit knows that interrupt message 1 was requested by virtual machine VM3, it sends interrupt message 1 to virtual machine VM3 via the interrupt communication unit. After sending interrupt message 1 to virtual machine VM3, the arbitration unit sends a second control signal to the interrupt control unit to disconnect the path between the interrupt control unit and physical peripheral Device1.
[0071] Example 2
[0072] Reference Figure 3 The present invention provides a schematic diagram of the structure of another interrupt handling device in an embodiment of the present invention.
[0073] Figure 3 In the configuration, virtual machines VM1, VM2, VM3, and VM4 are running on the virtual machine monitor.
[0074] The virtual machine monitor controls virtual machine VM1 to establish a passthrough with physical peripheral device Device1, and virtual machine VM2 to establish a passthrough with physical peripheral device Device2. Virtual machines VM1 and VM2 are each connected to the CPU interface of the general-purpose interrupt controller. In the general-purpose interrupt controller, the CPU interface is connected to the distributor. Physical peripheral devices Device1 and Device2 are each connected to the distributor.
[0075] Both virtual machines VM3 and VM4 require interrupt information from physical peripheral Device1. VM3 and VM4 send interrupt requests to the virtual machine monitor. The interrupt request sent by VM3 carries the virtual machine identifier "3" and the physical peripheral identifier "1". The interrupt request sent by VM4 carries the virtual machine identifier "4" and the physical peripheral identifier "1".
[0076] The interrupt communication unit of the virtual machine monitor receives the interrupt request, and the arbitration unit of the virtual machine monitor obtains the interrupt request, determining that both virtual machines VM3 and VM4 have sent interrupt requests. The arbitration unit generates a first control signal based on the interrupt request and sends the first control signal to the general interrupt controller. The first control signal carries the identifier "3" of the virtual machine and the identifier "1" of the physical peripheral, as well as the identifier "4" of the virtual machine and the identifier "1" of the physical peripheral.
[0077] The interrupt control unit receives the first control signal via the general interrupt controller, establishing a path with physical peripheral Device1. Physical peripheral Device1 sends interrupt message 1. The interrupt control unit receives interrupt message 1 from physical peripheral Device1 and forwards interrupt message 1 to the arbitration unit.
[0078] The arbitration unit receives interrupt message 1. Since the arbitration unit knows that interrupt message 1 was requested by virtual machines VM3 and VM4, it sends interrupt message 1 to VM3 and VM4 via the interrupt communication unit. After sending interrupt message 1 to VM3 and VM4, the arbitration unit sends a second control signal to the interrupt control unit to disconnect the path between the interrupt control unit and physical peripheral Device1.
[0079] Example 3
[0080] Reference Figure 3 Configure the virtual machine monitor to run virtual machines VM1, VM2, VM3, and VM4.
[0081] The virtual machine monitor controls virtual machine VM1 to establish a passthrough with physical peripheral device Device1, and virtual machine VM2 to establish a passthrough with physical peripheral device Device2. Virtual machines VM1 and VM2 are each connected to the CPU interface of the general-purpose interrupt controller. In the general-purpose interrupt controller, the CPU interface is connected to the distributor. Physical peripheral devices Device1 and Device2 are each connected to the distributor.
[0082] Virtual machine VM3 requires interrupt information from physical peripheral Device1, while virtual machine VM4 requires interrupt information from physical peripheral Device2. Both VM3 and VM4 send interrupt requests to the virtual machine monitor. The interrupt request sent by VM3 carries the virtual machine identifier "3" and the physical peripheral identifier "1". The interrupt request sent by VM4 carries the virtual machine identifier "4" and the physical peripheral identifier "2".
[0083] The interrupt communication unit of the virtual machine monitor receives the interrupt request, and the arbitration unit of the virtual machine monitor obtains the interrupt request, determining that both virtual machines VM3 and VM4 have sent interrupt requests. The arbitration unit generates a first control signal based on the interrupt request and sends the first control signal to the general interrupt controller. The first control signal carries the identifier "3" of the virtual machine and the identifier "1" of the physical peripheral, as well as the identifier "4" of the virtual machine and the identifier "2" of the physical peripheral.
[0084] The interrupt control unit receives a first control signal via a general-purpose interrupt controller, establishing a path with physical peripheral Device 1 and a path with physical peripheral Device 2. Physical peripheral Device 1 sends interrupt message 1, and physical peripheral Device 2 sends interrupt message 2. The interrupt control unit receives interrupt message 1 from physical peripheral Device 1 and forwards it to the arbitration unit; it also receives interrupt message 2 from physical peripheral Device 2 and forwards interrupt message 1 to the arbitration unit.
[0085] The arbitration unit receives interrupt messages message1 and message2. Since the arbitration unit knows that interrupt message1 was requested by virtual machine VM3 and interrupt message2 was requested by virtual machine VM4, it sends interrupt message1 to virtual machine VM3 and interrupt message2 to virtual machine VM4 via the interrupt communication unit. After sending interrupt message1 to virtual machine VM3 and interrupt message2 to virtual machine VM4, the arbitration unit sends a second control signal to the interrupt control unit to disconnect the communication path between the interrupt control unit and physical peripheral device Device1, and to disconnect the communication path between the interrupt control unit and physical peripheral device Device2.
[0086] In summary, in this embodiment of the invention, the virtual machine monitor receives interrupt requests from at least one virtual machine, generates a corresponding first control signal, and sends it to the general interrupt controller. Based on the first control signal, the general interrupt controller establishes a path with the target physical peripheral, and then sends the interrupt information of the target physical peripheral to the virtual machine monitor. The virtual machine monitor then sends the received interrupt information of the target physical peripheral to the virtual machine that sent the interrupt request. Therefore, when the target physical peripheral is directly connected to the target virtual machine, other virtual machines can obtain the interrupt information of the target physical peripheral.
[0087] Reference Figure 4 The present invention provides an interrupt handling method according to an embodiment of the invention, which is described below through specific steps.
[0088] In practice, steps 401 to 403 can be executed by the virtual machine monitor.
[0089] Step 401: Obtain at least one interrupt request sent by a virtual machine.
[0090] In practice, interrupt requests can be sent by virtual machines running in the virtual machine monitor. Interrupt requests are used to request interrupt information from the target physical peripheral.
[0091] Step 402: Generate and send the first control signal based on the interrupt request.
[0092] In practice, when the virtual machine monitor receives an interrupt request, it can generate a corresponding first control signal and send it. The interrupt control unit can receive the first control signal, establish a path with the target physical peripheral, and obtain the interrupt information sent by the target physical peripheral.
[0093] Step 403: Receive interrupt information from the target physical peripheral sent by the interrupt control unit, and send the interrupt information from the target physical peripheral to at least one virtual machine.
[0094] In practice, the virtual machine monitor receives interrupt information from the target physical peripheral and sends it to the virtual machine that sent the interrupt request. Thus, the virtual machine requiring interrupt information can obtain the interrupt information from the target physical peripheral.
[0095] In practice, after sending the interrupt information of the target physical peripheral to the corresponding virtual machine, the virtual machine monitor can also send a second control signal to the interrupt control unit. The second control signal is used to control the interrupt control unit to disconnect the path between the interrupt control unit and the target physical peripheral.
[0096] In this embodiment of the invention, the specific execution process of steps 401 to 403 can be referred to the above. Figure 1 The corresponding textual descriptions are not elaborated here.
[0097] The present invention also provides a computer-readable storage medium, which is a non-volatile storage medium or a non-transient storage medium, on which a computer program is stored, and the computer program is executed by a processor to perform the interrupt handling method provided in the above embodiments.
[0098] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include ROM, RAM, disk, or optical disk, etc.
[0099] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. An interrupt handling device, characterized in that, include: A virtual machine monitor and an interrupt control unit, wherein the virtual machine monitor runs N virtual machines; wherein: The virtual machine monitor is adapted to acquire an interrupt request sent by at least one virtual machine, generate and send a first control signal based on the interrupt request, wherein the interrupt request is used to request interrupt information of a target physical peripheral, and to receive the interrupt information of the target physical peripheral and send the interrupt information of the target physical peripheral to the at least one virtual machine; wherein the target physical peripheral is directly connected to the target virtual machine, and the target virtual machine is different from the at least one virtual machine; the virtual machine monitor is further adapted to send a second control signal after sending the interrupt information of the target physical peripheral to the at least one virtual machine; The interrupt control unit is adapted to establish a path with the target physical peripheral based on the first control signal, the path being used to transmit interrupt information of the target physical peripheral; and to send the interrupt information of the target physical peripheral; the interrupt control unit is also adapted to disconnect the path with the target physical peripheral based on the second control signal; N is a positive integer and N≥2; The virtual machine monitor includes an interrupt communication unit and an arbitration unit, wherein: the interrupt communication unit is adapted to transmit an interrupt request sent by the at least one virtual machine to the arbitration unit; and to transmit interrupt information of the target physical peripheral sent by the arbitration unit to the at least one virtual machine; the arbitration unit is adapted to generate the first control signal based on the interrupt request sent by the at least one virtual machine transmitted by the interrupt communication unit; and to receive the interrupt information of the target physical peripheral and send the interrupt information of the target physical peripheral to the interrupt communication unit.
2. The interrupt handling device as described in claim 1, characterized in that, The arbitration unit is further adapted to generate the second control signal after sending the interrupt information of the target physical peripheral to the interrupt communication unit.
3. The interrupt handling device as described in claim 1, characterized in that, Also includes: A general-purpose interrupt controller is adapted to receive the first control signal and forward the first control signal to the interrupt control unit.
4. The interrupt handling apparatus as described in claim 3, characterized in that, The general interrupt controller is also adapted to receive the second control signal and forward the second control signal to the interrupt control unit.
5. An interrupt handling method, characterized in that, An interrupt handling apparatus as described in any one of claims 1 to 4, comprising: Obtain an interrupt request sent by at least one virtual machine; the interrupt request is used to request interrupt information from a target physical peripheral; the target physical peripheral is directly connected to the target virtual machine, and the target virtual machine is different from the at least one virtual machine; A first control signal is generated and sent based on the interrupt request; Receive interrupt information from the target physical peripheral device sent by the interrupt control unit, and send the interrupt information from the target physical peripheral device to the at least one virtual machine; Send a second control signal, which is used to control the interrupt control unit to disconnect the path between itself and the target physical peripheral.
6. The interrupt handling method as described in claim 5, characterized in that, Also includes: Establish a pass-through between the target physical peripheral and the target virtual machine.
7. A computer-readable storage medium, wherein the computer-readable storage medium is a non-volatile storage medium or a non-transient storage medium, and a computer program is stored thereon, characterized in that, The computer program is executed by the processor to perform the steps of the method of claim 5 or 6.
Citation Information
Patent Citations
Management method, device, medium and system for virtual machine on computer equipment
CN111427669A
System and interrupt processing method
CN113934504A
