Interrupt processing method, device, system and equipment and storage medium
By directly querying and sending virtual interrupt requests by the interrupt controller, the problem of increasing interrupt processing delay in virtualization technology is solved and the performance of the virtual machine system is improved.
Patent Information
- Application Number
- CN202410845071.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-11-05
AI Technical Summary
In virtualization technology, the participation of the virtual machine monitor is required during interrupt processing, resulting in an increase in the delay in interrupt processing and affecting the performance of the virtual machine system.
Through the interrupt controller, the target processor and virtual machine information is directly queried in the configuration information, and the virtual interrupt request is sent, which avoids the participation of the virtual machine monitor and shortens the transmission time of the interrupt request.
It improves the interrupt processing delay, improves the overall performance of the virtual machine system, and reduces the delay in interrupt processing.
Smart Images

Figure CN118897713A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to, but is not limited to, the field of data processing technology, and in particular to an interrupt processing method, apparatus, system, device and storage medium. Background Art
[0002] Virtualization technology refers to running multiple virtual computers, namely virtual machines (VMs), on a physical computer. These virtual computers are isolated and independent from each other to implement different services. Different virtual computers share the hardware resources of the physical computer. Virtualization technology involves a virtual machine monitor (hypervisor), which is a software virtualization layer added between the computer hardware and the virtual computer to manage the physical resources of the physical computer. This software virtualization layer can use the interrupt controller to manage and distribute interrupt events from peripherals to the corresponding virtual computers. Summary of the invention
[0003] In view of this, embodiments of the present application at least provide an interrupt processing method, apparatus, device, and storage medium.
[0004] The technical solution of the embodiment of the present application is implemented as follows:
[0005] On the one hand, an embodiment of the present application provides an interrupt processing method, which is applied to an interrupt controller, and the method includes:
[0006] Receive physical interrupt request sent by interrupt source;
[0007] Based on the target interrupt identifier of the physical interrupt request, querying target processor information and target virtual machine information from preset configuration information;
[0008] When it is determined based on the target processor information and the target virtual machine information that the target processor runs the target virtual machine, the virtual interrupt request associated with the physical interrupt request is sent to the target virtual machine based on a target virtual interrupt interface corresponding to the target processor.
[0009] In the above embodiment, after receiving the physical interrupt request, the interrupt controller queries the target processor information indicating the target processor and the target virtual machine information indicating the target virtual machine from the preset configuration information, and when it is determined that the target processor runs the target virtual machine based on the queried target processor information and target virtual machine information, the virtual interrupt request associated with the physical interrupt request is sent to the target virtual machine; in this way, without the involvement of the virtual machine monitor, the target virtual machine is directly queried in the configuration information, and there is no need to send the physical interrupt request to the processor, nor is there any need to register the virtual interrupt request in the interrupt controller through the virtual machine monitor. In other words, the sending of the virtual interrupt request does not require the virtual machine monitor to perform routing configuration, thereby shortening the time from the receipt of the physical interrupt request to the sending of the associated virtual interrupt request to the virtual machine, improving the interrupt processing latency, and improving the overall performance of the virtual machine system.
[0010] In some embodiments, the method further comprises:
[0011] Obtaining a first address of a configuration table in a first register, and obtaining an address offset of the physical interrupt request, wherein the configuration information is located in the configuration table;
[0012] The first address of the configuration table is offset by the address offset to obtain a second address;
[0013] Correspondingly, based on the target interrupt identifier of the physical interrupt request, querying the target processor information and the target virtual machine information from the preset configuration information includes:
[0014] Based on the target interrupt identifier of the physical interrupt request, the target processor information and the target virtual machine information in the configuration table are read at the second address.
[0015] In the above embodiment, the address of the configuration table is stored by the first register, and the target address of the content in the memory corresponding to the received physical interrupt request in the configuration table is determined by the address of the configuration table storing the configuration information. In this way, the target device and the target virtual machine are determined based on the target address, thereby simply and quickly determining the target device and the target virtual machine.
[0016] In some embodiments, obtaining the address offset of the physical interrupt request includes:
[0017] Determine the position of the target interrupt identifier among the multiple interrupt identifiers included in the configuration information;
[0018] The address offset of the physical interrupt request is determined based on the order and the reference offset, where the reference offset is used to characterize the size of the content corresponding to one of the interrupt identifiers in the configuration information.
[0019] In the above embodiment, the sizes of the contents corresponding to different interrupt identifiers in the configuration table are all reference offsets, and the target address corresponding to the target interrupt identifier is obtained based on the position of the target interrupt identifier in the multiple interrupt identifiers included in the configuration table and the reference offset.
[0020] In some embodiments, the method further comprises:
[0021] In a case where the target processor runs a virtual machine monitor or a virtual machine other than the target virtual machine, a scheduling request is sent to the virtual machine monitor, where the scheduling request is used to request the virtual machine monitor to schedule the target processor to run the target virtual machine.
[0022] In the above embodiment, when the target processor is not running the target virtual machine, the virtual machine monitor can schedule the operation of the target virtual machine. In this way, there is no need to wait for the operation of the target virtual machine, so that the target processor can execute the interrupt corresponding to the physical interrupt request as soon as possible, thereby improving the interrupt processing speed and reducing the interrupt processing delay.
[0023] In some embodiments, the method further comprises:
[0024] Obtaining target indication information corresponding to the target interrupt identifier in a second register, wherein the target indication information is used to indicate enabling or disabling of a query function, wherein the query function is to query the target processor information and the target virtual machine information based on the target interrupt identifier;
[0025] Wherein, when the target indication information indicates that the query function is enabled, the execution step queries the target processor information and the target virtual machine information from preset configuration information based on the target interrupt identifier of the physical interrupt request.
[0026] In the above embodiment, indication information indicating whether the query function is enabled or disabled is set for the interrupt identifier in the second register, so that it is judged based on the indication information in the second register whether the target processor and the target virtual machine can be determined based on the current physical interrupt request. This avoids executing the step of querying the target processor and the target virtual machine when the target processor and the target virtual machine cannot be queried, thereby improving the interrupt processing efficiency.
[0027] In some embodiments, the method further comprises:
[0028] In the case that the target processor information and the target virtual machine information corresponding to the target interrupt identifier do not exist, the target indication information is set to indicate that the query function is disabled.
[0029] In the above embodiment, the indication information in the second register can be modified according to user needs. In this way, the configuration information can be modified according to user needs, thereby realizing a flexible setting of the indication information.
[0030] In some embodiments, the method further comprises:
[0031] When the target indication information indicates that the query function is disabled, searching for the target processor based on the target interrupt identifier, and sending the physical interrupt request to the target processor through a target physical interrupt interface corresponding to the target processor;
[0032] configuring, by a virtual machine monitor running on the target processor, a relationship between the virtual interrupt request and the target virtual machine;
[0033] In a case where the target processor runs the target virtual machine based on the scheduling of the virtual monitor, the virtual interrupt request is sent to the target virtual machine based on the target virtual interrupt interface.
[0034] In the above embodiment, two routing methods are provided for interrupt processing, wherein the indication information corresponding to the interrupt identifier is used as a selection switch for the two routing methods, so that different routing methods are adopted based on different scenarios while being compatible with different routing methods, thereby ensuring effective processing of the interrupt.
[0035] On the other hand, an embodiment of the present application provides an interrupt processing device, the device comprising:
[0036] A receiving module, used for receiving a physical interrupt request sent by an interrupt source;
[0037] A query module, configured to query target processor information and target virtual machine information from preset configuration information based on a target interrupt identifier of the physical interrupt request;
[0038] The sending module is used to send the virtual interrupt request associated with the physical interrupt request to the target virtual machine based on the target virtual interrupt interface corresponding to the target processor when it is determined that the target processor runs the target virtual machine based on the target processor information and the target virtual machine information.
[0039] In another aspect, an embodiment of the present application provides an interrupt processing system, the system comprising: an interrupt controller and one or more processors;
[0040] An interrupt controller, configured to receive a physical interrupt request sent by an interrupt source, and query target processor information and target virtual machine information from preset configuration information based on a target interrupt identifier of the physical interrupt request;
[0041] The interrupt controller is also used to send the virtual interrupt request associated with the physical interrupt request to the target virtual machine based on the target virtual interrupt interface corresponding to the target processor when it is determined that the target processor runs the target virtual machine based on the target processor information and the target virtual machine information, and the target processor is one of the one or more processors.
[0042] On the other hand, an embodiment of the present application provides a computer device, including a memory, an interrupt controller and one or more processors, wherein the memory stores a computer program that can be executed on the interrupt controller, and when the interrupt controller executes the program, it implements some or all of the steps in the above method.
[0043] On the other hand, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements part or all of the steps in the above method when executed by an interrupt controller.
[0044] On the other hand, an embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is executed in a computer device, an interrupt controller in the computer device executes some or all of the steps for implementing the above method.
[0045] On the other hand, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, it implements some or all of the steps in the above method.
[0046] In an embodiment of the present application, after the interrupt controller receives the physical interrupt request sent by the interrupt source, it queries the target processor information indicating the target processor and the target virtual machine information indicating the target virtual machine from the preset configuration information, and when it is determined that the target processor runs the target virtual machine based on the target processor information and the target virtual machine information, the virtual interrupt request associated with the physical interrupt request is sent to the target virtual machine; in this way, without the participation of the virtual machine monitor, the configuration information queries the target virtual machine, that is, there is no need to send the physical interrupt request to the processor, there is no need to trigger the processor to run the virtual machine monitor, and there is no need to register the virtual interrupt request in the interrupt controller through the virtual machine monitor. The sending of the virtual interrupt request does not require the virtual machine monitor to perform routing configuration, thereby shortening the time from the receipt of the physical interrupt request to the sending of the associated virtual interrupt request to the target virtual machine, improving the interrupt processing latency, and improving the overall performance of the virtual machine system.
[0047] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0049] Figure 1 A schematic diagram of a framework of a virtual machine system provided in an embodiment of the present application;
[0050] Figure 2 A schematic diagram of an interrupt processing flow provided in an embodiment of the present application;
[0051] Figure 3 A flowchart of an interrupt processing method provided in an embodiment of the present application;
[0052] Figure 4 A schematic diagram of the structure of an interrupt processing system provided in an embodiment of the present application;
[0053] Figure 5 A schematic diagram of an interrupt processing flow provided in an embodiment of the present application;
[0054] Figure 6 A flowchart of an interrupt processing method provided in an embodiment of the present application;
[0055] Figure 7 A flowchart of an interrupt processing method provided in an embodiment of the present application;
[0056] Figure 8 A flowchart of an interrupt processing method provided in an embodiment of the present application;
[0057] Fig. 9 A flowchart of an interrupt processing method provided in an embodiment of the present application;
[0058] Fig.10 A schematic diagram of an interrupt processing flow provided in an embodiment of the present application;
[0059] Fig.11 A schematic diagram of an interrupt processing flow provided in an embodiment of the present application;
[0060] Fig.12 A schematic diagram of an interrupt processing flow provided in an embodiment of the present application;
[0061] Fig.13 A flowchart of an interrupt processing method provided in an embodiment of the present application;
[0062] Fig.14 A schematic diagram of the structure of an interrupt processing device provided in an embodiment of the present application;
[0063] Fig.15 A hardware entity diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further elaborated in detail below in conjunction with the drawings and embodiments. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0065] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0066] The terms "first / second / third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first / second / third" can be interchanged with a specific order or sequence where permitted so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0067] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing this application and are not intended to limit this application.
[0068] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are described first. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0069] 1) Interrupt: It means that when some unexpected situation occurs during the operation of the computer and the host needs to intervene, the machine can automatically stop the running program and switch to the program to handle the new situation. After the processing is completed, it returns to the original suspended program to continue running.
[0070] 2) Virtualization: It is to simulate a single physical device into multiple isolated virtual devices, namely virtual machines, while ensuring the high efficiency of these virtual devices.
[0071] 3) Hypervisor: Also known as virtual machine monitor (VMM), it is an intermediate software layer running between the basic physical server, i.e. the processor and the operating system, and can access all physical devices on the server, including disks and memory. Hypervisor coordinates access to these hardware resources and protection between virtual machines. Hypervisor implements isolation between the operating system and application programs and the hardware layer, which can effectively reduce the software's dependence on hardware devices and drivers.
[0072] 4) Interrupt controller, which sends interrupt requests from multiple interrupt sources to different processors. The interrupt controller can be a programmable interrupt controller. Corresponding to a processor, the interrupt controller includes a physical interrupt interface and a virtual interrupt interface. Among them, the processor can be a unit for information processing such as a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), etc. When the processor is a CPU, the physical interrupt interface can be called a physical CPU interface, and the virtual interrupt interface can be called a virtual CPU interface.
[0073] In order to better understand the interrupt handling method provided in the embodiment of the present application, the interrupt handling scheme adopted in the related art is first described below.
[0074] In the related art, the framework of the virtual machine system can be as follows Figure 1 As shown, the hypervisor 101 is between the physical computer 102 and the virtual machines 103 (including the virtual machines 103 - 1 , 103 - 2 , . . . , and 103 -N). The hypervisor 101 can manage and distribute interrupt events from the peripherals 104 to the corresponding virtual machines 103 using an interrupt controller.
[0075] like Figure 1 As shown, the hypervisor 101 is between the physical computer 102 and the virtual machine 103. Therefore, in the process of distributing the interrupt request generated by the peripheral 104 to the virtual computer 103, the direct intervention of the hypervisor 1102 is required, which significantly increases the delay of interrupt processing. In particular, when there are many and frequent interrupts, the performance of the virtual machine system will be reduced.
[0076] In related technologies, such as Figure 2As shown, the interrupt processing system 200 includes: an interrupt controller 201, a CPU 202, wherein the interrupt controller includes an interrupt configuration module 211 and a physical CPU interface 212 and a virtual CPU interface 213 corresponding to the CPU 202, the physical CPU interface 212 is used to send a physical interrupt request to a hypervisor 221 running on the CPU 212, and the virtual CPU interface 213 is used to send a virtual interrupt request associated with the physical interrupt request to a virtual machine 222 running on the CPU 212. The virtual machine 222 and the hypervisor 221 do not run on the CPU 202 at the same time.
[0077] The interrupt request processing flow is as follows Figure 2 As shown, including:
[0078] S210: An interrupt configuration module in an interrupt controller receives an interrupt request from a peripheral device.
[0079] S220, the interrupt configuration module in the interrupt controller forwards the interrupt request to the physical CPU interface.
[0080] S230: The physical CPU interface sends an interrupt request to the CPU.
[0081] S240 , in response to the interrupt request, the CPU switches to a hypervisor running mode to run the hypervisor.
[0082] S250, the hypervisor configures, in an interrupt configuration module according to software configuration, a relationship between a virtual interrupt request associated with the interrupt request and a virtual machine processing the virtual interrupt request, thereby registering the virtual interrupt request with an interrupt controller.
[0083] Here, registering the virtual interrupt request to the interrupt controller can be understood as registering the virtual interrupt request to the virtual CPU interface corresponding to the CPU in the interrupt controller or performing routing configuration of the virtual interrupt request, so that the interrupt controller knows that the virtual interrupt request needs to be sent to the corresponding virtual machine through the virtual CPU interface.
[0084] S260: The interrupt configuration module in the interrupt controller forwards the virtual interrupt request to the virtual CPU interface.
[0085] S270: The CPU returns from the mode of running the hypervisor to the mode of running the virtual machine.
[0086] S280, in the mode where the CPU runs a virtual machine, the virtual CPU interface of the interrupt controller sends a virtual interrupt request (vIRQ) to the CPU, and the virtual machine running on the CPU implements the business logic of the virtual interrupt request.
[0087] It should be noted that, in the embodiment of the present application, the interrupt request may also be referred to as a physical interrupt request.
[0088] Figure 2 In the interrupt request processing flow shown in the figure, each arrival of an interrupt event of a peripheral requires the participation of the hypervisor, which will increase the delay of the interrupt.
[0089] The embodiment of the present application provides an interrupt processing method, which can be executed by an interrupt controller of a computer device. The computer device may refer to a server, a laptop, a tablet computer, a desktop computer, a smart TV, a set-top box, a mobile device (such as a mobile phone, a portable video player, a personal digital assistant, a dedicated messaging device, a portable gaming device), or other device with data processing capabilities. Figure 3 A schematic diagram of an implementation flow of an interruption data processing method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the method includes the following steps S301 to S303:
[0090] S301, receiving a physical interrupt request sent by an interrupt source.
[0091] The physical interrupt request in the embodiment of the present application may be initiated by an interrupt source, which may include: external device request interrupt, fault forced interrupt, real-time clock request interrupt, data channel interrupt, program voluntary interrupt, etc. The interrupt controller may determine the interrupt number corresponding to the physical interrupt request according to the interrupt source of the physical interrupt request.
[0092] In the embodiment of the present application, the physical interrupt request received in S301 may be any physical interrupt request among the physical interrupt requests received by the interrupt controller.
[0093] In the embodiment of the present application, the computer device may include: Figure 4 The interrupt processing system 400 shown in FIG. Figure 4 As shown, the interrupt processing system 400 includes: an interrupt controller 401 and one or more processors 402 .
[0094] The interrupt controller 401 includes: a configuration module and one or more virtual interrupt interfaces, wherein the interrupt controller includes a virtual interrupt interface corresponding to a processor, and different processors correspond to different virtual interrupt interfaces.
[0095] The processor 402 may be a CPU, an MPU, a DSP, etc. The processor 402 includes two operation modes: a first mode and a second mode. In the first mode, the processor runs a virtual machine, and in the second mode, the processor runs a Hypervisor.
[0096] S302, based on the target interrupt identifier of the physical interrupt request, query target processor information and target virtual machine information from preset coordination information, wherein the target processor information is used to indicate the target processor, and the target virtual machine information is used to indicate the target virtual machine.
[0097] After receiving the physical interrupt request, the interrupt controller queries the target processor information and the target virtual machine information in the preset configuration information. Here, the target virtual machine information is the information indicating the target virtual machine such as the identification and index of the target virtual machine, and the target virtual machine can be understood as a virtual machine that can implement the business logic of the received physical interrupt request. The target processor information is the information indicating the target processor such as the identification and index of the target processor, and the target processor is the processor that supports the operation of the target virtual machine.
[0098] The target interrupt identifier may be understood as the interrupt identifier of the received physical interrupt request, wherein the interrupt identifier may include: an interrupt number, an interrupt index, and other information capable of identifying different interrupt requests.
[0099] In an embodiment of the present application, configuration information may be preset, and the configuration information includes the relationship between the interrupt identifier and the corresponding processor information and virtual machine information, so that the target processor information and target virtual machine information can be queried from the configuration information based on the target interrupt identifier.
[0100] In an embodiment of the present application, the configuration information may include multiple first binding relationships, multiple second binding relationships, and the configuration information may also include multiple third binding relationships. The first binding relationship is the relationship between an interrupt and a corresponding processor, wherein the first binding relationship may include an interrupt identifier of the interrupt and processor information of the corresponding processor, indicating that the processor can run a virtual machine that implements the business logic of the interrupt. The second binding relationship is the relationship between an interrupt and a corresponding virtual machine, wherein the second binding relationship may include an interrupt identifier of the interrupt and virtual machine information of the corresponding virtual machine, indicating that the virtual machine can implement the business logic of the interrupt. The third binding relationship is the relationship between an interrupt identifier and a corresponding virtual machine and a corresponding processor, wherein the third binding relationship may include an interrupt identifier of the interrupt and virtual machine information of the corresponding virtual machine and processor information of the corresponding processor, indicating that the virtual machine running on the processor can implement the business logic of the interrupt.
[0101] When the configuration information includes multiple first binding relationships and multiple second binding relationships, the interrupt controller determines the first target binding relationship where the target interrupt identifier is located from the multiple first binding relationships, and determines that the processor identified by the processor information in the first target binding relationship is the target processor information. The interrupt controller determines the second target binding relationship where the target interrupt identifier is located from the multiple second binding relationships, and determines that the virtual machine identified by the virtual machine information in the second target binding relationship is the target virtual machine information.
[0102] When the configuration information includes multiple third binding relationships, the interrupt controller determines the third target binding relationship where the target interrupt identifier is located from the multiple third binding relationships, and determines that the processor indicated by the processor information in the third target binding relationship is the target processor, and determines that the virtual machine indicated by the virtual machine information in the third target binding relationship is the target virtual machine.
[0103] In the embodiment of the present application, when the configuration information includes multiple first binding relationships and multiple second binding relationships, the first binding relationship and the second binding relationship may be located in the same location, such as in a memory; or they may be located in different locations, such as the first binding relationship is located in a configuration module of an interrupt controller, and the second binding relationship is located in a memory. When the configuration information includes multiple third binding relationships, the third binding relationship may be located in a memory.
[0104] It is understandable that the interrupt controller can query preset target processor information in the interrupt controller and query preset target virtual machine information in the memory based on the target interrupt identifier, or can query preset target processor information and target virtual machine information in the memory.
[0105] based on Figure 4 In the interrupt processing system shown, the interrupt controller queries the target processor information and the target virtual machine information from the configuration information based on the target interrupt identifier of the physical interrupt request. In the case where the configuration information includes multiple first binding relationships located in the interrupt controller and multiple second binding relationships located in the memory, the interrupt controller directly obtains the target processor information from itself and reads the target virtual machine information from the memory. In the case where the configuration information includes multiple third binding relationships located in the memory, the interrupt controller reads the target processor information and the target virtual machine information from the memory.
[0106] S303: When it is determined based on the target processor information and the target virtual machine information that the target processor runs the target virtual machine, based on a target virtual interrupt interface corresponding to the target processor, send the virtual interrupt request associated with the physical interrupt request to the target virtual machine.
[0107] After querying the target processor information and the target virtual machine information, the interrupt controller sends the virtual interrupt request associated with the physical interrupt request to the target virtual interrupt interface corresponding to the target processor in the interrupt controller. When it is determined that the target processor runs the target virtual machine based on the target processor information and the target virtual machine information, the target virtual interrupt interface sends the virtual interrupt request to the target processor, thereby sending the virtual interrupt request to the target virtual machine, so that the target virtual machine executes the business logic of the virtual interrupt request.
[0108] In the embodiment of the present application, the physical interrupt request and the associated virtual interrupt request are requests for the same interrupt identifier, that is, requests for the same interrupt sent to different objects. The physical interrupt request is a request sent to hardware such as an interrupt controller and a processor running a hypervisor. The virtual interrupt request is a request sent to hardware related to a virtual machine such as a target virtual interrupt interface and a processor running a virtual machine.
[0109] Here, in the first mode, the target processor sends virtual machine information of the running virtual machine to the interrupt controller. If the interrupt controller receives the virtual machine information sent by the target processor representing the running virtual machine as the target virtual machine information, the target processor is determined to run the target virtual machine.
[0110] In the embodiment of the present application, the configuration information may be stored in the memory. At this time, the transmission path of the message (including physical interrupt request and virtual interrupt request) involved in the interrupt processing process is the node through which the routing method passes, such as Figure 5 As shown, it includes in sequence: an interrupt controller 401, a memory 403, an interrupt controller 401, and a target processor 402. The interrupt controller 401 sends a read request to the memory 403 to read the target processor information and the target virtual machine information from the memory 403, and sends the virtual interrupt request associated with the physical interrupt request to the target processor 402 running the target virtual machine 404. Here, the target processor 402 is one of the one or more processors 402 included in the interrupt processing system.
[0111] In an embodiment of the present application, after the interrupt controller receives the physical interrupt request sent by the interrupt source, it queries the target processor information indicating the target processor and the target virtual machine information indicating the target virtual machine from the preset configuration information, and when it is determined based on the target processor information and the target virtual machine information that the target processor runs the target virtual machine, the virtual interrupt request associated with the physical interrupt request is sent to the target virtual machine; in this way, without the participation of the virtual machine monitor, the configuration information queries the target virtual machine, that is, there is no need to send the physical interrupt request to the processor, nor is there any need to register the virtual interrupt request in the interrupt controller through the Hypervisor, and the sending of the virtual interrupt request does not require the Hypervisor to perform routing configuration, thereby shortening the time from the receipt of the physical interrupt request to the sending of the associated virtual interrupt request to the virtual machine, improving the interrupt processing latency, and improving the overall performance of the virtual machine system.
[0112] In some embodiments, Figure 6 As shown, before S302, the interrupt controller also executes the following S601 and S602:
[0113] S601, obtaining a first address of a configuration table in a first register, and obtaining an address offset of the physical interrupt request, wherein the configuration information is located in the configuration table.
[0114] S602: offset the address of the configuration table by the address offset to obtain a second address.
[0115] Accordingly, S302 includes:
[0116] S3021. Based on the target interrupt identifier of the physical interrupt request, read the target processor information and the target virtual machine information in the configuration table at the second address.
[0117] Here, a configuration table is set in the memory, and the configuration table includes configuration information. The interrupt controller includes a first register, and the content of the first register is the first address of the configuration table, that is, the first register points to the configuration table. The first address of the configuration table in the first register can be the address of the starting position of the configuration table in the memory.
[0118] The interrupt controller determines the address offset of the physical interrupt request based on the target interrupt identifier of the received physical interrupt request. The address offset can be understood as the offset of the content corresponding to the physical interrupt request in the configuration table, i.e., the address of the third target binding relationship in the memory relative to the first address of the configuration table.
[0119] After obtaining the first address of the configuration table and the address offset of the physical interrupt request, the interrupt controller obtains the second address after offsetting the address offset based on the first address of the configuration table. The second address can be understood as the storage address of the content corresponding to the physical interrupt request in the configuration table in the memory. The interrupt controller reads the third binding relationship corresponding to the physical interrupt request at the second address, thereby obtaining the target processor information and the target virtual machine information.
[0120] After reading the third binding relationship at the second address, the interrupt controller reads the processor information and virtual machine information in the third binding relationship when the interrupt identifier in the third binding relationship read at the second address is the target interrupt identifier, that is, the third binding relationship at this position is the third target binding relationship.
[0121] In the present application embodiment, based on Figure 4 In the interrupt processing system shown, the interrupt controller obtains the first address of the configuration table in the first register and obtains the address offset of the physical interrupt request; the interrupt controller offsets the first address of the configuration table by the address offset to obtain the second address.
[0122] In an embodiment of the present application, the address of the configuration table is stored through a first register, and the second address in the memory corresponding to the content in the configuration table of the received physical interrupt request is determined through the first address of the configuration table. In this way, the target processor information and the target virtual machine information are read based on the second address, thereby simply and quickly determining the target processor and the target virtual machine.
[0123] In some embodiments, the interrupt controller also performs the following processing:
[0124] Obtaining a first address of a configuration table in a first register, and obtaining an address offset of the physical interrupt request, wherein the configuration information is located in the configuration table, and the configuration information includes a plurality of second binding relationships; offsetting the address of the configuration table by the address offset to obtain a second address;
[0125] Correspondingly, based on the target interrupt identifier of the physical interrupt request, querying the target processor information and the target virtual machine information from the preset configuration information includes:
[0126] Based on the target interrupt identifier of the physical interrupt request, the target processor information is determined in the interrupt controller, and based on the target interrupt identifier of the physical interrupt request, the target virtual machine information in the configuration table is read at the second location.
[0127] For the interrupt controller, the target processor information is determined according to the multiple first binding relationships configured by the interrupt controller, and the target virtual machine information is obtained at the second address of the memory.
[0128] The process of determining the second address here can refer to the process of determining the second address when the configuration table information is stored in the configuration table, and the process of obtaining the target virtual machine information based on the second address can refer to the process of obtaining the target virtual machine information based on the second address when the configuration table information is stored in the configuration table, which will not be repeated here.
[0129] In the embodiment of the present application, the size relationship of the contents corresponding to different interrupt flags in the configuration table includes but is not limited to one of the following:
[0130] Relationship 1: The size of the content corresponding to different interrupt identifiers in the configuration table is the same;
[0131] Relationship 2: The sizes of the contents corresponding to different interrupt identifiers in the configuration table are independent.
[0132] Here, the size of the content corresponding to the interruption mark in the configuration table can be understood as the length or size of the third binding relationship.
[0133] In the case of relationship 1, the obtaining the address offset of the physical interrupt request includes:
[0134] Determine the position of the target interrupt identifier among the multiple interrupt identifiers included in the configuration information; determine the address offset of the physical interrupt request based on the position and a reference offset, wherein the reference offset is used to characterize the size of the content corresponding to one of the interrupt identifiers in the configuration information.
[0135] Here, the sizes of the contents corresponding to different interrupt identifiers in the configuration table, i.e., the configuration information, are all reference offsets. Based on the position, i.e., the order, and the reference offset of the target interrupt identifier among the multiple interrupt identifiers included in the configuration table, the sizes of the contents corresponding to all the interrupt identifiers before the target interrupt identifier are determined to obtain the address offset corresponding to the target interrupt identifier.
[0136] In the embodiment of the present application, the sizes of the multiple interrupt identifiers in the configuration table are continuous and are sorted by size in the configuration table.
[0137] In one example, the interrupt identifiers in the configuration table include: interrupt 0, interrupt 1, interrupt 2, ..., interrupt x. For interrupt n, the position is n+1. At this time, the position or order is n+1, and the address offset is n reference offsets.
[0138] In one example, the interrupt identifiers in the configuration table include: interrupt 1, interrupt 2, interrupt 3, ..., interrupt x. For interrupt n, the position is nth. At this time, the position or order is n, and the address offset is n-1 reference offsets.
[0139] Here, for different interrupt identifiers, the size of the corresponding content in the configuration table is the same, and there is no need to perform additional size configuration for the content corresponding to each interrupt identifier, thereby simplifying the setting of the configuration table and simplifying the process of determining the address offset corresponding to the current physical interrupt request, thereby improving processing efficiency.
[0140] In the case of relationship 2, the obtaining of the address offset of the physical interrupt request includes:
[0141] Determine one or more interrupt identifiers in the configuration information that are located before the target interrupt identifier;
[0142] The address offset is determined based on the size of the content corresponding to each interrupt identifier in the one or more interrupt identifiers in the configuration information.
[0143] When the sizes of the contents corresponding to different interrupt identifiers in the configuration table, i.e., the configuration information, are independent, a list may be set in the computer device, which is used to record the size of the contents corresponding to each interrupt identifier in the configuration information. The interrupt controller then determines all interrupt identifiers before the target interrupt identifier, and determines the size of the contents corresponding to each of these interrupt identifiers in the configuration table, and adds the sizes of the contents corresponding to these interrupt identifiers in the configuration table to obtain the address offset corresponding to the target interrupt identifier.
[0144] In the embodiment of the present application, the sizes of the contents corresponding to different interruption identifiers in the configuration table are independent of each other. In this way, space can be allocated for the interruption identifier according to the size of the contents corresponding to the interruption identifier, thereby ensuring the flexibility of the contents corresponding to different interruption identifiers.
[0145] In some embodiments, Figure 7 As shown, before S303, the interrupt controller also implements S701:
[0146] S701, when the target processor runs a virtual machine monitor or a virtual machine other than the target virtual machine, sending a scheduling request to the virtual machine monitor, wherein the scheduling request is used to request the virtual machine monitor to schedule the target processor to run the target virtual machine.
[0147] In the embodiment of the present application, after the interrupt controller sends the virtual interrupt request to the target virtual interrupt interface, it can determine whether the target processor is running the target virtual machine. In the case where the target processor is running the target virtual machine, the virtual interrupt request is directly sent to the target processor through the virtual interrupt interface; in the case where the target processor is not running the target virtual machine, that is, running the virtual machine monitor or the running virtual machine is not the target virtual machine, the target processor is scheduled to run the target virtual machine, so that the target processor runs the target virtual machine.
[0148] The process of the interrupt controller scheduling the target processor to run the target virtual machine is as follows: the interrupt controller sends a scheduling request to the target physical interrupt interface corresponding to the target processor, and the target physical interrupt interface sends the scheduling request to the target processor, so that the virtual machine monitor configures the operation of the target virtual machine based on the scheduling request, wherein the target processor runs the target virtual machine in response to the scheduling request. The scheduling request is an interrupt request.
[0149] If the target processor receives a scheduling request while running in the first mode, in response to the scheduling request, it switches from the first mode to the second mode to run the virtual machine monitor, and the running virtual machine monitor configures the operation of the target virtual machine; in response to the configuration of the virtual machine monitor, the target processor switches from the second mode to the first mode and runs the target virtual machine in the first mode.
[0150] If the target processor receives a scheduling request while running in the second mode, the running virtual machine monitor configures the operation of the target virtual machine. In response to the configuration of the virtual machine monitor, the target processor switches from the second mode to the first mode and runs the target virtual machine in the first mode.
[0151] In an embodiment of the present application, the virtual machine monitor can schedule the operation of the target virtual machine when the target processor is not running the target virtual machine. In this way, there is no need to wait for the operation of the target virtual machine, so that the target processor can execute the interrupt corresponding to the physical interrupt request as soon as possible, thereby improving the interrupt processing speed and reducing the interrupt processing delay.
[0152] In some implementations, the interrupt controller also performs the following processing:
[0153] Target indication information corresponding to the target interrupt identifier is obtained in the second register, where the target indication information is used to indicate enabling or disabling of a query function, wherein the query function is to query the target processor information and the target virtual machine information based on the target interrupt identifier.
[0154] Wherein, when the target indication information indicates that the query function is enabled, the execution step queries the target processor information and the target virtual machine information from preset configuration information based on the target interrupt identifier of the physical interrupt request.
[0155] Here, if Figure 8 As shown, before S302, the interrupt controller also implements S801:
[0156] S801, obtaining target indication information corresponding to the target interrupt identifier in a second register, wherein the target indication information is used to indicate enabling or disabling of a query function;
[0157] Accordingly, S302 includes:
[0158] S3022: When the target indication information indicates that the query function is enabled, query the target processor information and the target virtual machine information from preset configuration information based on the target interrupt identifier of the physical interrupt request.
[0159] In an embodiment of the present application, a second register is provided in the interrupt controller, and the second register is used to store indication information corresponding to each interrupt identifier, wherein the indication information is used to indicate whether the query function corresponding to the corresponding interrupt identifier is enabled or disabled, that is, whether the corresponding interrupt identifier can query the target virtual machine and the target processor. The second register may be located in the interrupt controller.
[0160] In implementation, the size of the indication information may be 1 bit, and different bits in the second register are indication information corresponding to different interrupt flags. In implementation, the size of the indication information may be set according to requirements, and this embodiment of the application does not limit this.
[0161] Understandably, the inability to query the target virtual machine and the target processor may include but is not limited to: only being able to query the target processor but not the target virtual machine, only being able to query the target virtual machine but not the target processor, that is, being unable to query the target processor or the target virtual machine.
[0162] The indication information indicates the enabling and disabling of the query function based on different values. Taking the indication information as 1 bit as an example, for an interruption flag, if the value of the 1 bit corresponding to the interruption flag is 0, it means that the query function corresponding to the interruption flag is disabled, and if the value of the 1 bit corresponding to the interruption flag is 1, it means that the query function corresponding to the interruption flag is enabled.
[0163] After receiving the physical interrupt request, the interrupt controller determines the indication information corresponding to the target interrupt identifier in the second register based on the target interrupt identifier, that is, the value of the target indication information, and determines whether the query function corresponding to the target interrupt identifier is enabled. When determining whether the query function corresponding to the target interrupt identifier is enabled, the interrupt controller executes S302.
[0164] In an embodiment of the present application, indication information indicating whether the query function is enabled or disabled is set for the interrupt flag in the second register, so that based on the indication information in the second register, it is possible to determine whether the current physical interrupt request directly determines the target processor and the target virtual machine based on the configuration information. This avoids executing the step of querying the target processor and the target virtual machine based on the configuration information when the target processor and the target virtual machine cannot be queried based on the configuration information, thereby improving the interrupt processing efficiency.
[0165] In some embodiments, the target indication information indicates whether the query function is enabled or disabled, including but not limited to one or more of the following:
[0166] Setting method 1: Setting based on user setting operation;
[0167] Setting method 2: Setting based on the content of configuration information.
[0168] In setting method one, for an interrupt identifier, the interrupt controller can provide a selection interface for selecting whether to enable or disable the query function for the indication information. The user can select the indication information corresponding to the interrupt identifier based on the selection interface to indicate whether the query function of the interrupt identifier is enabled or disabled.
[0169] In setting mode 2, when the target processor and the target virtual machine corresponding to the target interrupt identifier do not exist, the target indication information is set to indicate that the query function is disabled.
[0170] For setting mode 1, the interrupt controller may provide a setting interface, and the setting interface is used to receive a setting operation of the user on the indication information, that is, a modification of the indication information by the user.
[0171] For setting method 2, for an interrupt identifier such as a target interrupt identifier, the interrupt controller can determine whether the virtual machine or processor corresponding to the interrupt identifier can be queried in the configuration information. If the judgment result is that the virtual machine or processor corresponding to the interrupt identifier cannot be queried, the indication information corresponding to the interrupt identifier in the second register is set to indicate that the query function is disabled. If the judgment result is that the query is successful, the indication information corresponding to the interrupt identifier in the second register is set to indicate that the query function is enabled.
[0172] The computer device may provide a configuration modification interface, through which the user may modify the content in the configuration information. When the configuration information is modified through the configuration modification interface, the interrupt controller modifies the indication information in the second register so that the indication result of the indication information in the second register is synchronized with the query result of the target processor and the target virtual machine in the configuration information.
[0173] In the embodiment of the present application, the indication information in the second register can be modified according to user needs. In this way, the configuration information can be modified according to user needs, thereby achieving flexible setting of the indication information.
[0174] In some embodiments, based on Figure 8 ,like Fig. 9 As shown, the interrupt controller may also implement S901 to S903:
[0175] S901, when the target indication information indicates that the query function is disabled, searching for the target processor based on the target interrupt identifier, and sending the physical interrupt request to the target processor through the target physical interrupt interface corresponding to the target processor.
[0176] S902: Configure, by means of a virtual machine monitor running on the target processor, a relationship between the virtual interrupt request and the target virtual machine.
[0177] S903: When the target processor runs the target virtual machine based on the scheduling of the virtual monitor, send the virtual interrupt request to the target virtual machine based on the target virtual interrupt interface.
[0178] When the target indication information indicates that the query function corresponding to the target interrupt identifier is disabled, the target processor information and the target virtual machine information cannot be queried. At this time, the interrupt controller determines the target processor and sends the physical interrupt request to the target physical interrupt interface corresponding to the target processor, and the target physical interrupt interface sends the received physical interrupt request to the target processor. The target processor switches to the second mode to run the virtual machine monitor in response to the received physical interrupt request. Here, the inability to query the target processor information and the target virtual machine information can be understood as the inability to query the target processor information and the target virtual machine information in the preset configuration information.
[0179] The virtual machine monitor of the target processor running in the second mode responds to the physical interrupt request, associates the target interrupt identifier with the target virtual machine information of the target virtual machine based on the target interrupt identifier of the physical interrupt request, and thereby registers the virtual interrupt request, so that the interrupt controller determines that there is a virtual interrupt request that needs to be forwarded.
[0180] The interrupt controller forwards the virtual interrupt request to the target virtual interrupt interface corresponding to the target processor based on the registration of the virtual interrupt request. When the target processor runs the target virtual machine, the target virtual interrupt interface sends the virtual interrupt request to the target processor, so that the target virtual machine running on the target processor executes the business logic of the virtual interrupt request.
[0181] Here, the virtual machine monitor associates the target interrupt identifier with the target virtual machine information and configures the target virtual machine to run on the target processor. After the virtual machine monitor completes the registration of the virtual interrupt request and the configuration of the target virtual machine, it switches to the first mode and runs the target virtual machine in the first mode.
[0182] based on Figure 4 In the interrupt processing system shown, when the target indication information indicates that the query function is disabled, the interrupt controller searches for the target processor based on the target interrupt identifier, and sends the physical interrupt request to the target processor through the target physical interrupt interface corresponding to the target processor; through the virtual machine monitor running on the target processor, the relationship between the virtual interrupt request and the target virtual machine is configured on the interrupt controller; when the target processor runs the target virtual machine based on the scheduling of the virtual monitor, the interrupt controller sends the virtual interrupt request to the target virtual machine based on the target virtual interrupt interface.
[0183] In the embodiment of the present application, the transmission path of the message (including physical interrupt request and virtual interrupt request) involved in the interrupt processing process is the node passed by the routing mode, such as Fig.10As shown, it includes in sequence: an interrupt controller 401, a target processor 402, an interrupt controller 401, and a target processor 402. The interrupt controller 401 sends a physical interrupt request to the target processor 402; in response to the physical interrupt request, the target processor 402 runs a virtual machine monitor, and the virtual machine monitor sends a configuration message to the interrupt controller 401 to register the virtual interrupt request in the interrupt controller 401. When the target processor 402 runs a target virtual machine 404, the interrupt controller 401 sends the virtual interrupt request to the target processor 402.
[0184] In an embodiment of the present application, two routing methods are provided for interrupt processing, wherein the indication information corresponding to the interrupt identifier is used as a selection switch for the two routing methods. Thus, on the basis of compatibility with different routing methods, different routing methods are adopted based on different scenarios, thereby ensuring effective processing of interrupts.
[0185] Below, taking the processor as a CPU and the interrupt source as a peripheral as an example, the application of the interrupt processing method provided in the embodiment of the present application in an actual scenario is explained.
[0186] The interrupt processing method provided in the embodiment of the present application does not require software participation in processing peripheral interrupts in a virtual environment, thereby shortening the interrupt latency and improving system performance. Fig.11 As shown, a path configuration unit 11111 and a configuration table pointer 11112 are set in the interrupt configuration module 1111 of the interrupt controller 1101, and a configuration table is placed in the memory 1102. The binding relationship between the peripheral interrupt and the virtual machine that executes the interrupt business logic and the CPU that runs the virtual machine is set in advance in the configuration table to solve the problem of increased latency caused by the need for hypervisor software to participate in processing when routing peripheral interrupts to virtual machines. Fig.11 As shown, CPU 1102 can run virtual machine 1121 .
[0187] When the virtual machine system is started and running, the configuration table in the memory is configured according to the business logic, and the value of the configuration table pointer in the interrupt configuration module is set to the address of the configuration table in the memory.
[0188] Interrupt handling method such as Fig.11 As shown, including:
[0189] S1110. An interrupt configuration module in an interrupt controller receives an interrupt request from a peripheral device.
[0190] S1120: The interrupt configuration module queries the configuration table to obtain the binding relationship of the interrupt request according to the configuration status of the path configuration module and the configuration table pointer.
[0191] The binding relationship is the relationship between an interrupt request, a VM that processes the interrupt request, and a CPU of the VM.
[0192] S1130. The interrupt configuration module sends the virtual interrupt request to the virtual CPU interface corresponding to the CPU in the binding relationship.
[0193] S1140 : When the CPU runs the virtual machine, the virtual CPU interface sends the virtual interrupt request to the corresponding CPU via the virtual CPU interface.
[0194] Before S1120, after the virtual machine system is started, the hypervisor is started first, and the path configuration unit of the interrupt controller is configured by writing a register, and the configuration table is set by writing a memory.
[0195] For the path configuration unit, it includes a path enable register and a configuration table address register.
[0196] The path enable register, i.e., the second register mentioned above, is used to enable or disable (disable) the path of the peripheral interrupt, i.e., the query function. The structure of the path enable register is as follows: Fig.12 As shown, each bit corresponds to an interrupt number, for example, each register has 64 bits. If the virtual machine system supports 128 peripheral interrupts, two such registers are required. If the value of the bit corresponding to an interrupt number is 0, it means that the interrupt request path of the interrupt number is disabled or closed. If the value of the bit corresponding to an interrupt number is 1, it means that the interrupt request path of the interrupt number is enabled or opened.
[0197] The configuration table address register is used to query the configuration table. When peripheral interrupt n arrives, first determine whether the current peripheral interrupt can perform this function based on the path enable register. If enabled, read the binding information of the current interrupt n at the offset n of the configuration table address register.
[0198] The configuration table includes several binding relationship entries, each of which includes the ID number information of the peripheral interrupt, the ID information of the CPU, and the ID information of the virtual machine. In an example, as shown in Table 1, the following entries are included: interrupt ID1, CPU ID2, and virtual machine ID0, interrupt ID 2, CPU ID6, and virtual machine ID2, ..., interrupt ID x, CPU ID7, and virtual machine ID1.
[0199] Table 1. Example of configuration table entry structure
[0200] Interrupt ID0 CPU ID3 Virtual machine ID 0 Interrupt ID1 CPU ID2 Virtual machine ID 0 Interrupt ID2 CPU ID6 Virtual Machine ID2 …… …… …… Interrupt ID4 CPU ID7 Virtual Machine ID 1
[0201] If the binding relationship between the interrupt and the virtual machine or CPU needs to be changed, the entry corresponding to the interrupt in the configuration table is updated.
[0202] In S1140, if the virtual machine currently running on the CPU is a bound virtual machine, the interrupt request is sent to the current virtual machine; if the virtual machine currently running on the CPU is not a bound virtual machine, a scheduling interrupt is generated to notify the hypervisor to schedule the virtual machine bound to the peripheral interrupt as soon as possible.
[0203] The interrupt processing method provided in the embodiment of the present application can be as follows Fig.13 As shown, including:
[0204] S1301. Receive an interrupt request.
[0205] S1302: Determine whether the path of the interrupt request is enabled.
[0206] If enabled, execute S1303; if disabled, execute S1310.
[0207] S1303. Obtain the configuration table address.
[0208] S1304: Determine an entry address of the interrupt request in the configuration table based on the configuration table address.
[0209] Here, the entry address can be understood as the above-mentioned target address.
[0210] S1305: Read the binding relationship in the configuration table based on the entry address.
[0211] The binding relationship is the interrupt number of the interrupt request, the CPU identifier of the target CPU, and the virtual machine identifier of the target virtual machine.
[0212] S1306: Send the virtual interrupt request associated with the interrupt request to the virtual CPU interface corresponding to the target CPU in the binding relationship based on the binding relationship.
[0213] S1307: Determine whether the virtual machine running on the target CPU is the target virtual machine.
[0214] If not, execute S1308, if yes, execute S1309.
[0215] S1308: Send a scheduling request to the virtual machine monitor.
[0216] The scheduling request is used to request the hypervisor to schedule the target CPU to run the target virtual machine. When the target CPU runs the target virtual machine, S1309 is executed.
[0217] S1309: The virtual CPU interface corresponding to the target CPU sends the virtual scheduling request to the target CPU. The target virtual machine running on the target CPU executes the interrupt service corresponding to the virtual interrupt request.
[0218] S1310 , the virtual machine monitor registers a virtual interrupt request to the interrupt controller, and the interrupt controller sends the virtual interrupt request to the target CPU.
[0219] Here, the process of S1310 can refer to Figure 2 The interrupt handling method shown will not be repeated here.
[0220] In the embodiment of the present application, a path configuration unit and a configuration table pointer are added, and the configuration table pointer points to a configuration table configured in advance, which optimizes the delay problem of peripheral interrupts in a virtualized state. In addition, the configuration table defined in the memory can be flexibly modified and created dynamically.
[0221] Based on the foregoing embodiments, an embodiment of the present application provides an interrupt processing device, which includes the units included and the modules included in the units, and can be implemented by an interrupt controller in a computer device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.
[0222] Fig.14 A schematic diagram of the structure of an interrupt processing device provided in an embodiment of the present application is applied to an interrupt controller, such as Fig.14 As shown, the interrupt processing device 1400 includes: a receiving module 1401, a query module 1402 and a sending module 1403, wherein:
[0223] The receiving module 1401 is used to receive a physical interrupt request sent by an interrupt source;
[0224] A query module 1402, configured to query target processor information and target virtual machine information from preset configuration information based on a target interrupt identifier of the physical interrupt request;
[0225] The sending module 1403 is used to send the virtual interrupt request associated with the physical interrupt request to the target virtual machine through the target virtual interrupt interface corresponding to the target processor when it is determined that the target processor runs the target virtual machine based on the target processor information and the target virtual machine information.
[0226] In some embodiments, the interrupt processing device 1400 further includes: an acquisition module and an offset module.
[0227] An acquisition module, configured to acquire a first address of a configuration table in a first register and acquire an address offset of the physical interrupt request, wherein the configuration information is located in the configuration table;
[0228] An offset module, used for offsetting the address of the configuration table by the address offset to obtain a second address;
[0229] Correspondingly, the query module 1402 is used to obtain the target processor information and the target virtual machine information in the configuration table at the second address based on the target interrupt identifier of the physical interrupt request.
[0230] In some embodiments, the middle offset module is further used to determine the position of the target interrupt identifier among the multiple interrupt identifiers included in the configuration information;
[0231] The address offset of the physical interrupt request is determined based on the order and the reference offset, where the reference offset is used to characterize the size of the content corresponding to one of the interrupt identifiers in the configuration information.
[0232] In some embodiments, the interrupt processing device 1400 further includes: a scheduling module,
[0233] The scheduling module is used to send a scheduling request to the virtual machine monitor when the target processor runs the virtual machine monitor or a virtual machine other than the target virtual machine, wherein the scheduling request is used to request the virtual machine monitor to schedule the target processor to run the target virtual machine.
[0234] In some embodiments, the interrupt processing device 1400 further includes: an indication module,
[0235] an indication module, used for obtaining target indication information corresponding to the target interrupt identifier in a second register, wherein the target indication information is used for indicating enabling or disabling of a query function, wherein the query function is to query the target processor information and the target virtual machine information based on the target interrupt identifier;
[0236] Wherein, when the target indication information indicates that the query function is enabled, the target processor information and the target virtual machine information are queried based on the target interrupt identifier of the physical interrupt request.
[0237] In some embodiments, the interrupt processing device 1400 further includes: a setting module,
[0238] The setting module is used to set the target indication information to indicate that the query function is disabled when the target processor information and the target virtual machine information corresponding to the target interrupt identifier do not exist.
[0239] In some embodiments, the interrupt processing device 1400 further includes: a configuration module,
[0240] The sending module 1401 is further configured to search for the target processor based on the target interrupt identifier when the target indication information indicates that the query function is disabled, and send the physical interrupt request to the target processor through a target physical interrupt interface corresponding to the target processor;
[0241] A configuration module, configured to configure the relationship between the virtual interrupt request and the target virtual machine through a virtual machine monitor running on the target processor;
[0242] The sending module 1401 is further configured to send the virtual interrupt request to the target virtual machine based on the target virtual interrupt interface when the target processor runs the target virtual machine based on the scheduling of the virtual monitor.
[0243] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0244] It should be noted that in the embodiment of the present application, if the above-mentioned interrupt handling method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific hardware, software or firmware, or any combination of hardware, software, and firmware.
[0245] An embodiment of the present application provides a computer device, including a memory, an interrupt controller and one or more processors, wherein the memory stores a computer program that can be run on the interrupt controller, and when the interrupt controller executes the program, some or all of the steps in the above method are implemented.
[0246] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by an interrupt controller, some or all of the steps in the above method are implemented. The computer-readable storage medium can be transient or non-transient.
[0247] An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is executed in a computer device, an interrupt controller in the computer device executes some or all of the steps for implementing the above method.
[0248] The embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, some or all of the steps in the above method are implemented. The computer program product can be implemented specifically by hardware, software or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK) and the like.
[0249] It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device, storage medium, computer program and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiments of the device, storage medium, computer program and computer program product of this application, please refer to the description of the method embodiment of this application for understanding.
[0250] It should be noted that the embodiment of the present application provides an interrupt processing system, such as Figure 4 As shown, it includes: an interrupt controller 401 and one or more processors 402;
[0251] The interrupt controller 401 is used to receive a physical interrupt request sent by an interrupt source, and query target processor information and target virtual machine information from preset configuration information based on a target interrupt identifier of the physical interrupt request;
[0252] The interrupt controller 401 is also used to send the virtual interrupt request associated with the physical interrupt request to the target virtual machine based on the target virtual interrupt interface corresponding to the target processor when it is determined that the target processor is running the target virtual machine based on the target processor information and the target virtual machine information, and the target processor is one of the one or more processors.
[0253] In some embodiments, the interrupt controller 401 is further configured to:
[0254] Obtaining a first address of a configuration table in a first register, and obtaining an address offset of the physical interrupt request, wherein the configuration information is located in the configuration table;
[0255] The address of the configuration table is offset by the address offset to obtain a second address;
[0256] Based on the target interrupt identifier of the physical interrupt request, the target processor information and the target virtual machine information in the configuration table are read at the second address.
[0257] In some embodiments, the interrupt controller 401 is further configured to:
[0258] Determine the position of the target interrupt identifier among the multiple interrupt identifiers included in the configuration information;
[0259] The address offset of the physical interrupt request is determined based on the order and the reference offset, where the reference offset is used to characterize the size of the content corresponding to one of the interrupt identifiers in the configuration information.
[0260] In some embodiments, the interrupt controller 401 is further configured to:
[0261] In a case where the target processor runs a virtual machine monitor or a virtual machine other than the target virtual machine, a scheduling request is sent to the virtual machine monitor, where the scheduling request is used to request the virtual machine monitor to schedule the target processor to run the target virtual machine.
[0262] In some embodiments, the interrupt controller 401 is further configured to:
[0263] Obtaining target indication information corresponding to the target interrupt identifier in a second register, wherein the target indication information is used to indicate enabling or disabling of a query function, wherein the query function is to query the target processor information and the target virtual machine information based on the target interrupt identifier;
[0264] Wherein, when the target indication information indicates that the query function is enabled, the execution step queries the target processor information and the target virtual machine information from preset configuration information based on the target interrupt identifier of the physical interrupt request.
[0265] In some embodiments, the interrupt controller 401 is further configured to:
[0266] In the case that the target processor information and the target virtual machine information corresponding to the target interrupt identifier do not exist, the target indication information is set to indicate that the query function is disabled.
[0267] In some embodiments, the interrupt controller 401 is further configured to:
[0268] When the target indication information indicates that the query function is disabled, searching for the target processor based on the target interrupt identifier, and sending the physical interrupt request to the target processor through a target physical interrupt interface corresponding to the target processor;
[0269] configuring, by a virtual machine monitor running on the target processor, a relationship between the virtual interrupt request and the target virtual machine;
[0270] In a case where the target processor runs the target virtual machine based on the scheduling of the virtual monitor, the virtual interrupt request is sent to the target virtual machine based on the target virtual interrupt interface.
[0271] Fig.15 A schematic diagram of a hardware entity of a computer device in an embodiment of the present application is shown in FIG. Fig.15 As shown, the hardware entity of the computer device 1500 includes: an interrupt controller 1501, a communication interface 1502 and a memory 1503, wherein:
[0272] The interrupt controller 1501 is used to receive interrupt requests from multiple interrupt sources and distribute the interrupt requests to the processor.
[0273] The communication interface 1502 enables the computer device to communicate with other terminals or servers through a network.
[0274] In the embodiment of the present application, the computer device may further include a processor, and the processor may be used to control the operation of the computer device 1500 .
[0275] The memory 1503 is configured to store instructions and applications executable by the interrupt controller 1501, and can also cache data to be processed or processed by the interrupt controller 1501 and various modules in the computer device 1500 (for example, image data, audio data, voice communication data, and video communication data). Data can be transmitted between the interrupt controller 1501, the communication interface 1502, and the memory 1503 via the bus 1504.
[0276] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
[0277] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0278] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0279] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0280] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0281] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0282] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0283] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. An interrupt processing method, characterized in that: Applied to an interrupt controller, the method comprises: Receive physical interrupt request sent by interrupt source; Based on the target interrupt identifier of the physical interrupt request, querying target processor information and target virtual machine information from preset configuration information; When it is determined based on the target processor information and the target virtual machine information that the target processor runs the target virtual machine, the virtual interrupt request associated with the physical interrupt request is sent to the target virtual machine based on a target virtual interrupt interface corresponding to the target processor.
2. The method according to claim 1, characterized in that: The method further comprises: Obtaining a first address of a configuration table in a first register, and obtaining an address offset of the physical interrupt request, wherein the configuration information is located in the configuration table; The first address of the configuration table is offset by the address offset to obtain a second address; Correspondingly, based on the target interrupt identifier of the physical interrupt request, querying the target processor information and the target virtual machine information from the preset configuration information includes: Based on the target interrupt identifier of the physical interrupt request, the target processor information and the target virtual machine information in the configuration table are read at the second address.
3. The method according to claim 2, characterized in that The obtaining the address offset of the physical interrupt request includes: Determine the position of the target interrupt identifier among the multiple interrupt identifiers included in the configuration information; The address offset of the physical interrupt request is determined based on the order and a preset reference offset, wherein the reference offset is used to characterize the size of the content corresponding to one of the interrupt identifiers in the configuration information.
4. The method according to claim 1, characterized in that: The method further comprises: In a case where the target processor runs a virtual machine monitor or a virtual machine other than the target virtual machine, sending a scheduling request to the virtual machine monitor; The scheduling request is used to request the virtual machine monitor to schedule the target processor to run the target virtual machine.
5. The method according to claim 1, characterized in that The method further comprises: Obtaining target indication information corresponding to the target interrupt identifier in a second register, wherein the target indication information is used to indicate enabling or disabling of a query function, wherein the query function is to query the target processor information and the target virtual machine information based on the target interrupt identifier; Wherein, when the target indication information indicates that the query function is enabled, the execution step queries the target processor information and the target virtual machine information from preset configuration information based on the target interrupt identifier of the physical interrupt request.
6. The method according to claim 5, characterized in that The method further comprises: In the case that the target processor information and the target virtual machine information corresponding to the target interrupt identifier do not exist, the target indication information is set to indicate that the query function is disabled.
7. The method according to claim 5, characterized in that The method further comprises: When the target indication information indicates that the query function is disabled, searching for the target processor based on the target interrupt identifier, and sending the physical interrupt request to the target processor through a target physical interrupt interface corresponding to the target processor; configuring, by a virtual machine monitor running on the target processor, a relationship between the virtual interrupt request and the target virtual machine; In a case where the target processor runs the target virtual machine based on the scheduling of the virtual monitor, the virtual interrupt request is sent to the target virtual machine based on the target virtual interrupt interface.
8. An interrupt processing device, characterized in that: Applied to an interrupt controller, the device comprises: A receiving module, used for receiving a physical interrupt request sent by an interrupt source; A query module, configured to query target processor information and target virtual machine information from preset configuration information based on a target interrupt identifier of the physical interrupt request; The sending module is used to send the virtual interrupt request associated with the physical interrupt request to the target virtual machine based on the target virtual interrupt interface corresponding to the target processor when it is determined that the target processor runs the target virtual machine based on the target processor information and the target virtual machine information.
9. An interrupt processing system, characterized in that: The system includes: an interrupt controller and one or more processors; The interrupt controller is used to receive a physical interrupt request sent by an interrupt source, and based on a target interrupt identifier of the physical interrupt request, query target processor information and target virtual machine information from preset configuration information; The interrupt controller is also used to send the virtual interrupt request associated with the physical interrupt request to the target virtual machine based on the target virtual interrupt interface corresponding to the target processor when it is determined that the target processor is running the target virtual machine based on the target processor information and the target virtual machine information, and the target processor is one of the one or more processors.
10. A computer device comprising a memory, an interrupt controller and one or more processors, wherein the memory stores a computer program that can be run on the interrupt controller, characterized in that: When the interrupt controller executes the program, the steps in the method according to any one of claims 1 to 7 are implemented.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the interrupt controller, the steps in the method according to any one of claims 1 to 7 are implemented.
