CN111158863A - Processing method and device of interrupt controller and electronic equipment - Google Patents
Processing method and device of interrupt controller and electronic equipment Download PDFInfo
- Publication number
- CN111158863A CN111158863A CN201911417508.0A CN201911417508A CN111158863A CN 111158863 A CN111158863 A CN 111158863A CN 201911417508 A CN201911417508 A CN 201911417508A CN 111158863 A CN111158863 A CN 111158863A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- interrupt
- interrupt controller
- virtual
- processor
- 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.)
- Granted
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 25
- 230000005856 abnormality Effects 0.000 claims abstract description 20
- 238000000034 method Methods 0.000 claims description 36
- 238000012545 processing Methods 0.000 claims description 31
- 238000012544 monitoring process Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 description 17
- 238000010586 diagram Methods 0.000 description 12
- 230000002093 peripheral effect Effects 0.000 description 11
- 238000005516 engineering process Methods 0.000 description 6
- 230000004044 response Effects 0.000 description 4
- 238000004088 simulation Methods 0.000 description 4
- 230000000977 initiatory effect Effects 0.000 description 3
- 230000006399 behavior Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/14—Handling requests for interconnection or transfer
- G06F13/20—Handling requests for interconnection or transfer for access to input/output bus
- G06F13/24—Handling requests for interconnection or transfer for access to input/output bus using interrupt
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45579—I/O management, e.g. providing access to device drivers or storage
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
According to the processing method and device of the interrupt controller and the electronic device, the virtual processor is monitored to be interrupted through the virtual machine, and the interrupt processing program in the virtual machine is started, so that the interrupt processing program initiates a reading request for a state register of the interrupt controller to the interrupt controller; when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, and the running state of the virtual processor is the interrupt state, the page fault processing program of the kernel virtual machine starts and fills the preset memory address in the virtual machine into the page table of the virtual machine, so that the attribute of the page table is read only, and therefore the virtual machine can quickly read the information of the state register of the interrupt controller of the virtual machine by using the preset memory address and the attribute of the page table, and the problem that the information of the state register can be read only after the virtual machine exits to the VMM in the prior art is solved.
Description
Technical Field
The present disclosure relates to computer technologies, and in particular, to a method and an apparatus for processing an interrupt controller, and an electronic device.
Background
With the continuous development of the virtual machine technology, the virtual machine technology can be widely applied to scenes such as data centers and cloud computing services. Each Virtual Machine instance managed by a Kernel-Based Virtual Machine (KVM) is treated as a process by the operating system. Input and Output (IO) virtualization refers to virtualization related to devices, and is substantially that Virtual devices constructed by Virtual machines through Virtual Machine Monitors (VMM) multiplex limited peripheral resources of a physical host to simulate the effect of real peripheral access. While IO interrupt virtualization is part of IO virtualization, the virtual machine manages multiple IO peripheral interrupts using an interrupt controller that will use the virtual machine.
FIG. 1 is a diagram illustrating a virtual machine interrupt processing flow in the prior art; as shown in FIG. 1, the thick lines in the flowchart indicate actions that cause processor exceptions or state switches, where the solid lines represent accesses to the interrupt controller's registers. QEMU is VMM (virtual machine monitor) on a host machine, simulates CPU through dynamic binary conversion, and provides a series of hardware models, so that guest os considers that the guest os directly deals with the hardware, and really deals with the hardware simulated by QEMU, and the QEMU translates the instructions to the real hardware for operation. By this mode, guest os can interact with the hard disk, network card, CPU, CD-ROM, audio device and USB device on the host. Because the KVM is a hardware-assisted virtualization technology and is mainly responsible for relatively complicated CPU and memory virtualization, and the Qemu is responsible for I/O virtualization, the two cooperate to exert their own advantages, and complement each other.
As can be seen from FIG. 1, a register access to the interrupt controller by the virtual processor requires a flow through the virtual processor- > KVM- > QEMU (VMM) - > KVM- > virtual processor, wherein each step requires saving a number of state information and thread information for resuming virtual processing to the interrupt controller.
In the prior art, in order to improve the processing efficiency, the behavior of the interrupt controller can be directly simulated in the KVM. FIG. 2 is a schematic diagram illustrating another prior art virtual machine interrupt handling flow; in particular, during the process that the virtual processor in the interrupt response stage accesses the register of the interrupt controller, the KVM can directly return data to the virtual processor without QEMU (open source virtual machine), and the simulation process is simplified to virtual processor- > KVM- > virtual processor.
However, in the response process of the IO virtual interrupt, the virtual processor reads the register to acquire the state of the interrupt controller, and the processing flow is still not simplified enough, that is, although the state of the interrupt controller reaches the KVM before the interrupt is generated, the KVM still needs to be passed when the interrupt state is read. That is, the conventional system still has a problem of state switching.
Disclosure of Invention
In order to solve the technical problem, the present disclosure provides a processing method and apparatus for an interrupt controller, and an electronic device.
In a first aspect, the present disclosure provides a processing method for an interrupt controller of a virtual machine, including:
the method comprises the following steps that a virtual machine monitors the interruption of a virtual processor, and an interruption processing program in the virtual machine is started, so that the interruption processing program initiates a reading request of a state register of the interruption controller;
when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine;
when the running state is an interrupt state, starting a missing page processing program of an interrupt controller and filling a preset memory address in a virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read-only;
returning to the step that the interrupt processing program initiates a read request for the status register of the interrupt controller, and outputting a read result.
In an optional example, when the attribute of the page table of the virtual machine is read-only and the virtual machine performs a write operation to the status register of the interrupt controller, the method further includes:
the kernel virtual machine calls a pre-stored interrupt controller logic code to update the running state of the virtual processor to be a non-interrupt state according to the preset memory address;
and the virtual machine executes write operation on the state register of the interrupt controller.
In an optional example, before the virtual machine monitors that the virtual processor is interrupted and starts an interrupt handler in the virtual machine, the method further includes:
the virtual machine receives an interrupt request sent by a physical host;
and the interrupt controller executes the hardware logic code prestored in the kernel virtual machine so as to update the running state of the virtual processor to be an interrupt state by the preset memory address.
In an alternative example, the monitoring by the virtual machine of a virtual processor interrupt includes:
and the interrupt controller sends the generated interrupt request to the virtual processor so that the virtual machine monitors the interrupt of the virtual processor.
In an alternative example, the method further comprises:
setting a preset memory address in a virtual machine, wherein the preset memory address is used for recording the running state of a virtual processor;
the preset memory address is the same as the address of the state register of the interrupt controller in the virtual machine.
In a second aspect, the present disclosure provides a processing apparatus of an interrupt controller of a virtual machine, including:
the virtual machine is used for starting an interrupt handling program in the virtual machine when monitoring the interrupt of the virtual processor, so that the interrupt handling program initiates a read request for a state register of the interrupt handling program to an interrupt controller;
the kernel virtual machine is used for judging the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine when capturing that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller;
when the running state is an interrupt state, starting a page fault processing program of an interrupt controller in a kernel virtual machine and filling a preset memory address in the virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read only;
the virtual machine is also used for restarting the interrupt processing program to initiate a read request for the state register of the interrupt controller, and outputting the read result.
In an alternative example, the apparatus further comprises:
the kernel virtual machine is also used for calling a pre-stored hardware logic code to update the running state of the virtual processor to be a non-interrupt state according to the preset memory address when the attribute of the page table of the virtual machine is read-only and the virtual machine performs write operation on the state register of the interrupt controller;
the virtual machine is used for executing write operation on the status register of the interrupt controller.
In an optional example, the virtual machine is further configured to receive an interrupt request sent by the physical host before monitoring that the virtual processor is interrupted and starting an interrupt handler in the virtual machine, and the interrupt controller executes the interrupt controller logic code prestored in the kernel virtual machine, so as to update the running state of the virtual processor to an interrupt state by using the preset memory address.
In an optional example, the interrupt controller is further configured to send the generated interrupt request to the virtual processor, so that the virtual machine monitors the virtual processor for an interrupt.
In an optional example, a preset memory address is set in the virtual machine, and the preset memory address is used for recording the running state of the virtual processor;
the preset memory address is the same as the address of the state register of the interrupt controller in the virtual machine.
In a third aspect, a processing apparatus of an interrupt controller of a virtual machine includes:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
the method comprises the following steps that a virtual machine monitors the interruption of a virtual processor, and an interruption processing program in the virtual machine is started, so that the interruption processing program initiates a reading request of a state register of the interruption controller;
when the interrupt controller processes the read request and the page fault exception occurs, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine;
when the running state is an interrupt state, starting a page fault processing program of an interrupt controller in a kernel virtual machine and filling a preset memory address in the virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read only;
returning to the step that the interrupt processing program initiates a read request for the status register of the interrupt controller, and outputting a read result.
In a fourth aspect, the present disclosure provides an electronic device, in which a processing apparatus of an interrupt controller of a virtual machine according to any one of the preceding claims is installed.
In a fifth aspect, the present disclosure provides a storage medium containing computer-executable instructions for performing the method of any one of the preceding claims when executed by a computer processor.
According to the processing method and device of the interrupt controller and the electronic device, the virtual processor is monitored to be interrupted through the virtual machine, and the interrupt processing program in the virtual machine is started, so that the interrupt processing program initiates a reading request of a state register of the interrupt controller to the interrupt controller; when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine; when the running state is an interrupt state, starting a page fault processing program of an interrupt controller in a kernel virtual machine and filling a preset memory address in the virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read only; returning to the step that the interrupt processing program initiates a read request for the status register of the interrupt controller, and outputting a read result. Therefore, the virtual machine can quickly read the information of the state register of the interrupt controller of the virtual machine by using the preset memory address and the attribute of the page table, and the problem that the information of the state register can be read only after the virtual machine exits to the VMM in the prior art is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate examples consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a diagram illustrating a virtual machine interrupt processing flow in the prior art;
FIG. 2 is a schematic diagram illustrating another prior art virtual machine interrupt handling flow;
fig. 3 is a flowchart illustrating a processing method of an interrupt controller of a virtual machine according to an example of the present disclosure;
fig. 4 is a flowchart illustrating a processing method of an interrupt controller of another virtual machine according to an example of the present disclosure;
fig. 5 shows a flowchart of a processing method of an interrupt controller of a virtual machine provided by an example of the present disclosure;
fig. 6 is a schematic structural diagram of a processing device of an interrupt controller of a virtual machine according to an example of the present disclosure;
fig. 7 is a schematic hardware structure diagram of a processing apparatus of an interrupt controller of a virtual machine according to an example of the present disclosure;
fig. 8 is a schematic structural diagram of an electronic device according to a fourth example of the present disclosure.
Explicit examples of the present disclosure have been shown by the above figures and will be described in more detail later. These drawings and written description are not intended to limit the scope of the disclosed concepts in any manner, but rather to illustrate the concepts of the disclosure to those skilled in the art by reference to specific examples.
Specific examples
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The examples described in the following exemplary examples are not intended to represent all examples consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
With the continuous development of the virtual machine technology, the virtual machine technology can be widely applied to scenes such as data centers and cloud computing services. A Kernel-Based Virtual Machine (KVM) is an open source Virtual Machine Monitor (VMM) Based on an open source operating system. KVM is based on a kernel, where each virtual machine instance it manages is treated by the operating system as a process. Input and Output (IO) virtualization refers to virtualization related to devices, and is substantially that virtual devices constructed by a virtual machine through a VMM multiplex peripheral resources of a limited physical host to simulate an effect of real peripheral access. While IO interrupt virtualization is part of IO virtualization, the virtual machine manages multiple IO peripheral interrupts using an interrupt controller that will use the virtual machine.
FIG. 1 is a diagram illustrating a virtual machine interrupt processing flow in the prior art; as shown in FIG. 1, the thick lines in the flowchart indicate actions that cause processor exceptions or state switches, where the solid lines represent accesses to the interrupt controller's registers. As can be seen from fig. 1, one register access to the interrupt controller by the virtual processor requires a flow through the virtual processor- > KVM- > QEMU (open source virtual machine) - > KVM- > virtual processor, wherein each step requires saving several pieces of state information and thread information for resuming virtual processing to the interrupt controller.
In the prior art, in order to improve the processing efficiency, the behavior of the interrupt controller can be directly simulated in the KVM. FIG. 2 is a schematic diagram illustrating another prior art virtual machine interrupt handling flow; in particular, during the process that the virtual processor in the interrupt response stage accesses the register of the interrupt controller, the KVM can directly return data to the virtual processor without QEMU (open source virtual machine), and the simulation process is simplified to virtual processor- > KVM- > virtual processor.
However, in the response process of the IO virtual interrupt, the virtual processor reads the register to acquire the state of the interrupt controller, and the processing flow is still not simplified enough, that is, although the state of the interrupt controller reaches the KVM before the interrupt is generated, the KVM still needs to be passed when the interrupt state is read. That is, the conventional system still has a problem of state switching.
The following describes the technical solutions of the present disclosure and how to solve the above technical problems with specific examples. Several of these specific examples may be combined with each other below, and some of the same or similar concepts or processes may not be repeated in some examples. Examples of the present disclosure will now be described with reference to the accompanying drawings.
To solve the technical problem existing in the prior art that the virtual machine needs to exit to the VMM and then can read the information of the status register, fig. 3 is a flowchart illustrating a processing method of an interrupt controller of the virtual machine according to an example of the present disclosure.
As shown in fig. 3, the method includes:
102, when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine;
103, when the running state is an interrupt state, starting a missing page processing program of the kernel virtual machine and filling a preset memory address in the virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read-only;
and 104, executing the interrupt processing program to initiate a read request for the state register of the interrupt controller, and outputting a read result.
The execution subject of the processing method of the interrupt controller of the virtual machine provided by the present disclosure is the processing device of the interrupt controller of the virtual machine, and the processing method of the interrupt controller based on the virtual machine can be applied to the simulation of the IO interrupt operation by the virtual machine.
In addition, the processing device of the interrupt controller of the virtual machine can be written by C/C + +, Java, Shell or Python; the electronic device may be, for example, a desktop computer, a tablet computer, a smart phone, etc.; the operating system may be a windows system, an ios system, a Linux system, or other systems that can be run based on the electronic device, and the electronic device and the operating system are not limited in any way by the present disclosure.
In the processing method of the interrupt controller of the virtual machine provided by the present disclosure, first, the virtual machine monitors the interrupt of the virtual processor, and starts an interrupt handler in the virtual machine, so that the interrupt handler initiates a read request for a status register of the interrupt controller.
Wherein the virtual processor interrupt is realized by forwarding the generated interrupt request to the virtual processor by the interrupt controller so that the virtual machine monitors the virtual processor interrupt. The source of the interrupt request may be specifically a virtual peripheral, that is, under the condition that the virtual peripheral needs to use interrupt to synchronize with the virtual machine CPU, the virtual peripheral generates an interrupt request and sends the interrupt request to the virtual processor after the interrupt request is logically processed by the virtual interrupt controller, so that the interrupt request is interrupted. That is, an I/O interrupt is a means of synchronization between the virtual processor and the virtual peripheral that informs the virtual interrupt controller of the request when an event occurs in the virtual peripheral that requires synchronization with a virtual processor thread. The virtual interrupt controller sets the logic based on the interrupt trigger.
Subsequently, when the interrupt controller processes a read request, the virtual processor will access the register of the interrupt controller through the address of 0xe010000000 ~ 0xe010000fff, while in general, there is no memory or other device in the address space of 0xe010000000 ~ 0xe01000 ffff. At this point, a page fault exception will occur. This will make the information of the status register of the interrupt controller unreadable. That is, when the kernel virtual machine captures that the virtual processor has a page fault exception and the address of the page fault exception points to the interrupt controller, the kernel virtual machine finds that the running state of the virtual processor is an interrupt state, and the built-in page fault handler is started, so that the pre-stored memory address of the virtual machine is written into the page table of the virtual machine, and in the process, the attribute of the page table is set to be read only. That is, the problem of page fault exception is solved, and at this time, the step of initiating the read request to the status register of the interrupt controller by the interrupt handling program is executed again, so that the read result can be output.
In other words, to solve the technical problem, the value of the register is filled into a 4KB physical memory page, the page is mapped to 0xe 010000000-0 xe01000ffff of the virtual machine, and the page is set as a read-only attribute in the page table of the virtual machine, so that the virtual processor directly reads the preset memory address of the virtual machine to obtain the value stored in the status register in the interrupt controller. That is, the kernel virtual machine directly obtains the address of the state register of the interrupt controller in the virtual machine, and reads the current value of the address, so as to determine the current running state of the virtual machine according to the value.
The processing method for the interrupt controller of the virtual machine according to the first embodiment of the present disclosure enables the virtual machine to quickly read the information of the state register of the interrupt controller of the virtual machine by using the preset memory address and the attribute of the page table, thereby avoiding the problem that the virtual machine needs to exit to the VMM to read the information of the state register in the prior art.
On the basis of the foregoing examples of the first example, to further explain the processing method of the interrupt controller of the virtual machine provided by the present disclosure, fig. 4 is a flowchart illustrating a processing method of an interrupt controller of a further virtual machine provided by the first example of the present disclosure, and fig. 5 illustrates a flowchart illustrating a processing method of an interrupt controller of a virtual machine provided by the first example of the present disclosure. As shown in fig. 4 and 5, the processing method of the interrupt controller of the virtual machine includes:
The execution subject of the processing method of the interrupt controller of the virtual machine provided by the present disclosure is the processing device of the interrupt controller of the virtual machine, and the processing method of the interrupt controller based on the virtual machine can be applied to the simulation of the IO interrupt operation by the virtual machine.
In addition, the processing device of the interrupt controller of the virtual machine can be written by C/C + +, Java, Shell or Python; the electronic device may be, for example, a desktop computer, a tablet computer, a smart phone, etc.; the operating system may be a windows system, an ios system, a Linux system, or other systems that can be run based on the electronic device, and the electronic device and the operating system are not limited in any way by the present disclosure.
Unlike the foregoing example, in this example, a process of updating the running state of the virtual processor is also included.
Specifically, a preset memory address is also set in the virtual machine, and the preset memory address is used for recording the running state of the virtual processor; the preset memory address is the same as the address of the state register of the interrupt controller in the virtual machine.
Once the kernel virtual machine receives an interrupt request sent by the virtual machine, the interrupt controller executes the interrupt controller logic code prestored in the kernel virtual machine so as to update the running state of the virtual processor to an interrupt state by the preset memory address.
And the interrupt controller sends the generated interrupt request to the virtual processor so that the virtual machine monitors the interrupt of the virtual processor.
Subsequently, as in the previous example, initiating an interrupt handler in the virtual machine to cause the interrupt handler to initiate a read request to its status register to the interrupt controller; when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine; when the running state is an interrupt state, starting a missing page processing program of the kernel virtual machine and filling a preset memory address in the virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read-only; returning to the step that the interrupt processing program initiates a read request for the status register of the interrupt controller, and outputting a read result.
As shown in fig. 5, in the case where the page table entry is not swapped out, no read operation to the interrupt controller register needs to be trapped in KVM, direct access to memory, and only register write operation needs to be trapped in KVM emulation.
In other alternative examples, writing to the status register of the interrupt controller for a virtual machine line may also occur after the attribute of the page table of the virtual machine is read-only. At the moment, the kernel virtual machine calls a prestored hardware logic code to update the running state of the virtual processor to be a non-interrupt state according to the preset memory address; and the virtual machine executes write operation on the state register of the interrupt controller.
Fig. 6 is a schematic structural diagram of a processing device of an interrupt controller of a virtual machine according to an example of the present disclosure.
As shown in fig. 6, a processing apparatus of an interrupt controller of a virtual machine includes:
the virtual machine 10 is configured to start an interrupt handler in the virtual machine 10 when monitoring a virtual processor interrupt, so that the interrupt handler initiates a read request for a status register of the interrupt controller to the interrupt controller;
the kernel virtual machine 20 is configured to, when capturing that the virtual processor has a page fault exception and an address of the page fault exception points to the interrupt controller, determine an operating state of the virtual machine 10 according to an address of a state register of the interrupt controller in the virtual machine 10;
when the running state is an interrupt state, starting a page missing processing program of the kernel virtual machine 20 and filling a preset memory address in the virtual machine 10 into a page table of the virtual machine 10, so that the attribute of the page table is read-only;
the virtual machine 10 is further configured to restart the step of initiating, by the interrupt handler, a read request to the status register of the interrupt controller, and output a read result.
In an alternative example, the apparatus further comprises:
the kernel virtual machine 20 is further configured to, when the attribute of the page table of the virtual machine 10 is read-only and the virtual machine 10 performs a write operation on the status register of the interrupt controller, call a pre-stored interrupt controller logic code to update the running state of the virtual machine 10 to a non-interrupt state according to the preset memory address;
the virtual machine 10 is used to perform a write operation to the status register of the interrupt controller.
In an alternative example, the kernel virtual machine 20 is further configured to receive an interrupt request sent by the virtual machine before monitoring the virtual processor interrupt and starting an interrupt handler in the virtual machine 10;
the interrupt controller of the kernel virtual machine 20 executes the hardware logic code prestored in the kernel virtual machine, so as to update the running state of the virtual processor to an interrupt state by using the preset memory address.
In an alternative example, the interrupt controller is further configured to send the generated interrupt request to the virtual machine 10 processor, so that the virtual machine 10 monitors the virtual machine 10 processor for an interrupt.
In an optional example, a preset memory address is set in the virtual machine 10, and the preset memory address is used for recording the running state of the virtual machine 10;
the preset memory address is the same as the address of the status register of the interrupt controller in the virtual machine 10.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process and corresponding beneficial effects of the system described above may refer to the corresponding process in the foregoing method example, and are not described herein again.
In other examples, fig. 7 is a schematic diagram of a hardware structure of a processing apparatus of an interrupt controller of a virtual machine according to a third example of the present disclosure. As shown in fig. 7, the processing device of the interrupt controller of the virtual machine may specifically include:
a processor 32;
a memory 31 for storing processor-executable instructions;
wherein the processor 32 is configured to:
the method comprises the following steps that a virtual machine monitors the interruption of a virtual processor, and an interruption processing program in the virtual machine is started, so that the interruption processing program initiates a reading request of a state register of the interruption controller;
when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine;
when the running state is an interrupt state, starting a missing page processing program of an interrupt controller and filling a preset memory address in a virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read-only;
returning to the step that the interrupt processing program initiates a read request for the status register of the interrupt controller, and outputting a read result.
The memory 31 may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like. And processor 32 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital signal processor architectures (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessor architectures or other electronic components.
The above instructions may be written in languages such as C/C + +, Java, Shell, Python, etc., and this example is not intended to be limiting.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process and corresponding beneficial effects of the system described above may refer to the corresponding process in the foregoing method example, and are not described herein again.
Fig. 8 is a schematic structural diagram of an electronic device according to a fourth example of the present disclosure, where a processing apparatus 6 of an interrupt controller of a virtual machine according to any one of the foregoing embodiments is installed in the electronic device 4.
It should be noted that the processing apparatus of the interrupt controller of the virtual machine may be applied to various electronic devices, and the operation method thereof may refer to the scheme disclosed in the first example or the second example, and the structure thereof may refer to the scheme disclosed in the third example.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
The present disclosure provides a storage medium containing computer-executable instructions for performing a method as set forth in any one of the preceding claims when executed by a computer processor.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims (13)
1. A processing method of an interrupt controller of a virtual machine is characterized by comprising the following steps:
the method comprises the following steps that a virtual machine monitors the interruption of a virtual processor, and an interruption processing program in the virtual machine is started, so that the interruption processing program initiates a reading request of a state register of the interruption controller;
when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine;
when the running state is an interrupt state, starting a missing page processing program of an interrupt controller and filling a preset memory address in a virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read-only;
returning to the step that the interrupt processing program initiates a read request for the status register of the interrupt controller, and outputting a read result.
2. The processing method according to claim 1, wherein when the attribute of the page table of the virtual machine is read-only and the virtual machine performs a write operation to the status register of the interrupt controller, the method further comprises:
the kernel virtual machine calls a pre-stored interrupt controller logic code to update the running state of the virtual processor to be a non-interrupt state according to the preset memory address;
and the virtual machine executes write operation on the state register of the interrupt controller.
3. The processing method according to claim 1, wherein before the virtual machine monitors the virtual processor interrupt and starts an interrupt handler in the virtual machine, the method further comprises:
the kernel virtual machine receives an interrupt request sent by the virtual machine;
and the interrupt controller of the kernel virtual machine executes the hardware logic code prestored in the kernel virtual machine so as to update the running state of the virtual processor to be an interrupt state by the preset memory address.
4. The processing method of claim 3, wherein the monitoring by the virtual machine of a virtual processor interrupt comprises:
and the interrupt controller sends the generated interrupt request to the virtual processor so that the virtual machine monitors the interrupt of the virtual processor.
5. The processing method according to any one of claims 1 to 4, further comprising:
setting a preset memory address in a virtual machine, wherein the preset memory address is used for recording the running state of a virtual processor;
the preset memory address is the same as the address of the state register of the interrupt controller in the virtual machine.
6. A processing apparatus of an interrupt controller of a virtual machine, comprising:
the virtual machine is used for starting an interrupt handling program in the virtual machine when monitoring the interrupt of the virtual processor, so that the interrupt handling program initiates a read request for a state register of the interrupt handling program to an interrupt controller;
the kernel virtual machine is used for judging the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine when capturing that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller;
when the running state is an interrupt state, starting a page fault processing program of an interrupt controller in a kernel virtual machine and filling a preset memory address in the virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read only;
the virtual machine is also used for restarting the interrupt processing program to initiate a read request for the state register of the interrupt controller, and outputting the read result.
7. The processing apparatus according to claim 6, wherein the apparatus further comprises:
the kernel virtual machine is also used for calling a prestored interrupt controller logic code to update the running state of the virtual processor to be a non-interrupt state according to the preset memory address when the attribute of the page table of the virtual machine is read-only and the virtual machine performs write operation on the state register of the interrupt controller;
the virtual machine is used for executing write operation on the status register of the interrupt controller.
8. The processing apparatus according to claim 6,
the kernel virtual machine is also used for receiving an interrupt request sent by the virtual machine;
and the interrupt controller of the kernel virtual machine executes the hardware logic code prestored in the kernel virtual machine so as to update the running state of the virtual processor to be an interrupt state by the preset memory address.
9. The processing apparatus according to claim 8,
the interrupt controller is further configured to send the generated interrupt request to the virtual processor, so that the virtual machine monitors the virtual processor for an interrupt.
10. The processing apparatus according to any one of claims 6 to 9,
the virtual machine is provided with a preset memory address, and the preset memory address is used for recording the running state of the virtual processor;
the preset memory address is the same as the address of the state register of the interrupt controller in the virtual machine.
11. A processing apparatus of an interrupt controller of a virtual machine, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
the method comprises the following steps that a virtual machine monitors the interruption of a virtual processor, and an interruption processing program in the virtual machine is started, so that the interruption processing program initiates a reading request of a state register of the interruption controller;
when the kernel virtual machine captures that the virtual processor has page fault abnormality and the address of the page fault abnormality points to the interrupt controller, the kernel virtual machine judges the running state of the virtual processor according to the address of a state register of the interrupt controller in the virtual machine;
when the running state is an interrupt state, starting a page fault processing program of an interrupt controller in a kernel virtual machine and filling a preset memory address in the virtual machine into a page table of the virtual machine so as to enable the attribute of the page table to be read only;
returning to the step that the interrupt processing program initiates a read request for the status register of the interrupt controller, and outputting a read result.
12. An electronic device, characterized in that a processing apparatus of an interrupt controller of a virtual machine according to any one of claims 6 to 10 is installed in the electronic device.
13. A storage medium containing computer-executable instructions for performing the method of any one of claims 1-5 when executed by a computer processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911417508.0A CN111158863B (en) | 2019-12-31 | 2019-12-31 | Interrupt controller processing method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911417508.0A CN111158863B (en) | 2019-12-31 | 2019-12-31 | Interrupt controller processing method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111158863A true CN111158863A (en) | 2020-05-15 |
CN111158863B CN111158863B (en) | 2024-03-08 |
Family
ID=70560418
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911417508.0A Active CN111158863B (en) | 2019-12-31 | 2019-12-31 | Interrupt controller processing method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111158863B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112783600A (en) * | 2020-07-01 | 2021-05-11 | 中兴通讯股份有限公司 | Interrupt processing method, interrupt manager, electronic device, and computer-readable medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101681269A (en) * | 2007-05-16 | 2010-03-24 | 威睿公司 | The self-adaptation Dynamic Selection and the application of multiple virtualization techniques |
CN105095128A (en) * | 2014-05-22 | 2015-11-25 | 中兴通讯股份有限公司 | Interrupt processing method and interrupt controller |
US20160055108A1 (en) * | 2014-08-20 | 2016-02-25 | Red Hat Israel, Ltd. | Managing message signaled interrupts in virtualized computer systems |
US20160224484A1 (en) * | 2015-01-29 | 2016-08-04 | Red Hat Israel, Ltd. | Transmitting inter-processor interrupt messages by privileged virtual machine functions |
CN107038121A (en) * | 2016-02-03 | 2017-08-11 | 华为技术有限公司 | The memory address distribution method and device of virtual machine |
CN109710312A (en) * | 2018-12-13 | 2019-05-03 | 华东计算技术研究所(中国电子科技集团公司第三十二研究所) | RISC-V instruction set based real-time interrupt processing method and device and industrial control processor |
-
2019
- 2019-12-31 CN CN201911417508.0A patent/CN111158863B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101681269A (en) * | 2007-05-16 | 2010-03-24 | 威睿公司 | The self-adaptation Dynamic Selection and the application of multiple virtualization techniques |
CN105095128A (en) * | 2014-05-22 | 2015-11-25 | 中兴通讯股份有限公司 | Interrupt processing method and interrupt controller |
US20160055108A1 (en) * | 2014-08-20 | 2016-02-25 | Red Hat Israel, Ltd. | Managing message signaled interrupts in virtualized computer systems |
US20160224484A1 (en) * | 2015-01-29 | 2016-08-04 | Red Hat Israel, Ltd. | Transmitting inter-processor interrupt messages by privileged virtual machine functions |
CN107038121A (en) * | 2016-02-03 | 2017-08-11 | 华为技术有限公司 | The memory address distribution method and device of virtual machine |
CN109710312A (en) * | 2018-12-13 | 2019-05-03 | 华东计算技术研究所(中国电子科技集团公司第三十二研究所) | RISC-V instruction set based real-time interrupt processing method and device and industrial control processor |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112783600A (en) * | 2020-07-01 | 2021-05-11 | 中兴通讯股份有限公司 | Interrupt processing method, interrupt manager, electronic device, and computer-readable medium |
Also Published As
Publication number | Publication date |
---|---|
CN111158863B (en) | 2024-03-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101296025B1 (en) | Improving nested virtualization performance in a computer system | |
EP2479666B1 (en) | Methods and systems to display platform graphics during operating system initialization | |
US11487523B2 (en) | Updating machine emulator | |
US11422827B2 (en) | Method, device, apparatus for identifying graphics card of GPU server and medium | |
US9852052B2 (en) | Trusted execution of called function | |
CN101213518A (en) | System and method to optimize OS context switching by instruction group trapping | |
CN111936972A (en) | Exception handling in transactions | |
CN108292233B (en) | Application processor for starting virtual machine | |
CN112541166A (en) | Method, system and computer readable storage medium | |
CN108241522B (en) | Sleep state switching method and device in virtualization environment and electronic equipment | |
CN108268302A (en) | Realize the method and apparatus that equipment starts | |
KR920003044B1 (en) | Control system for guest execution of virtual computer system | |
CN111158863B (en) | Interrupt controller processing method and device and electronic equipment | |
US9535772B2 (en) | Creating a communication channel between different privilege levels using wait-for-event instruction in systems operable at multiple levels hierarchical privilege levels | |
CN111367799B (en) | Method, device, medium and electronic equipment for locating source code breakdown position | |
CN108139906B (en) | Method and device for processing data | |
CN105808440A (en) | Application low memory test method, apparatus and system | |
US11544092B2 (en) | Model specific register (MSR) instrumentation | |
CN114003421B (en) | Virtual machine timeout mechanism testing method, system, terminal and storage medium | |
WO2024021480A1 (en) | Method and apparatus for dynamic migration of virtual machine, and electronic device | |
CN112416536B (en) | Method for extracting processor execution context and processor | |
CN110795231A (en) | Processing method and device of virtual CPU | |
US20240086220A1 (en) | Delaying interrupts for virtual machines | |
CN114296712A (en) | Script data processing method and device and electronic equipment | |
CN115437751A (en) | Virtual machine operation method, device, equipment and storage medium |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant after: Loongson Zhongke Technology Co.,Ltd. Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing Applicant before: LOONGSON TECHNOLOGY Corp.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |