A method and apparatus for handling faults
By combining monitoring equipment and a central processing unit, and utilizing timers and NMI requests to locate interrupt delay faults, the problem of high system overhead and high human resource costs in existing technologies is solved, achieving efficient and low-cost fault location.
Patent Information
- Application Number
- CN202210496843.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-09
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-05-09
AI Technical Summary
Existing technologies incur high system overhead and human resource costs when locating interrupt delay faults, making it difficult to efficiently pinpoint the fault location.
By combining monitoring equipment and a central processing unit, a timer is used to monitor the response time of interrupt requests. If the response time exceeds a threshold, a non-maskable interrupt (NMI) request is sent to obtain abnormal context information and locate the fault point.
It reduces system overhead and human resource costs, improves the efficiency and availability of fault location, and can quickly locate the cause of interruption delay faults.
Smart Images

Figure CN117076061B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method and apparatus for fault handling. Background Technology
[0002] An interrupt is an asynchronous event notification / response mechanism in which, after a device reports an interrupt request, the central processing unit (CPU) ultimately processes the interrupt request. The term "asynchronous" refers to the delay caused by the CPU's inability to respond to or process the interrupt request in real time.
[0003] A failure caused by the failure to respond to or process interrupt requests in a timely manner can be called an interrupt delay failure. In order to troubleshoot the cause of an interrupt delay failure, it is necessary to locate the point in the program where the interrupt delay failure occurs.
[0004] In existing technologies, software methods can be used to locate the fault point causing interruption delays. However, using software methods requires recording the complete system operation trajectory, and then analyzing this trajectory to find the fault point when a fault occurs, resulting in significant system overhead. Furthermore, using software methods to locate interruption delay faults requires personnel to manually invoke debugging functions to find the fault point, leading to high human resource costs and making this method difficult to use. Summary of the Invention
[0005] This application provides a method and apparatus for fault handling. The method can locate the fault point causing the interruption delay fault by combining software and hardware, so as to reduce the location cost and system overhead, while improving availability.
[0006] In a first aspect, a fault handling method is provided, which can be executed by a monitoring device, or by a chip or circuit installed in the monitoring device, and this application does not limit this.
[0007] The method may include: the monitoring device receiving an interrupt request; the monitoring device acquiring the timing of a timer, the start time of which is the moment the monitoring device receives the interrupt request; and, if the timing is greater than or equal to a threshold, the monitoring device sending a non-maskable interrupt (NMI) request to the central processing unit (CPU), the NMI request being used by the CPU to determine the exception context information corresponding to the delayed response to the interrupt request.
[0008] According to the method of this embodiment, when an interrupt is triggered, a timer can automatically start counting. If the timer's counting time is greater than or equal to a threshold, it can be considered that the time for the interrupt to be responded to by the central processing unit exceeds the normal range, or in other words, an interrupt delay fault has occurred. At this time, the monitoring device can report an NMI request to the central processing unit to interrupt the operation currently being executed by the CPU. Then, the central processing unit can determine the abnormal context information corresponding to the delayed response to the interrupt request. By analyzing the abnormal context information, the fault point causing the interrupt delay fault can be located.
[0009] In this embodiment, timing can be achieved via hardware (using a timer). If the timer's duration is greater than or equal to a threshold, abnormal information is obtained via software (using the central processing unit to determine the abnormal context information). The method provided in this application locates the fault point causing the interruption delay without needing to record the complete system operation trajectory, thus reducing system overhead. Furthermore, the method according to this embodiment eliminates the need for personnel to manually invoke debugging functions to discover the fault point, thereby saving human resource costs and improving availability.
[0010] In conjunction with the first aspect, in some implementations of the first aspect, the method further includes: if the interrupt number corresponding to the interrupt request is consistent with the target interrupt number, the monitoring device starts a timer, wherein the target interrupt number is a predefined interrupt number of the interrupt that needs to be monitored.
[0011] In this embodiment, the monitoring device can compare the acquired interrupt number with the target interrupt number, and then determine whether to start the timer based on the comparison result.
[0012] Specifically, if the monitoring device finds that the interrupt number corresponding to the interrupt request belongs to the target interrupt number, or in other words, the monitoring device determines through comparison that the interrupt number corresponding to the interrupt request is consistent with the target interrupt number, then the timer starts counting.
[0013] According to the method in this embodiment, users can set the target interrupt number according to actual needs, thereby enabling targeted monitoring of the interrupts that need to be monitored.
[0014] In conjunction with the first aspect, in some implementations of the first aspect, the timer ends at the moment when the interrupt request is responded to by the central processing unit.
[0015] The end time of the timer can also be understood as the moment when the timer stops counting.
[0016] In this embodiment, when the interrupt request is responded to by the central processing unit, the timer can be stopped and initialized. In other words, the time when the timer stops is the time when the interrupt request is responded to by the central processing unit.
[0017] Initializing a timer can also be understood as returning the timer to its initial state, resetting the timer's timing duration, or setting the timer's timing duration to an initial value, such as 0.
[0018] According to the method of this embodiment, since the timer stops counting at the moment when the interrupt request is responded to by the central processing unit, by reading the timer's counting time, the time during which the interrupt request is delayed in being responded to can be known, or in other words, the duration from the triggering of the interrupt request to its response can be known.
[0019] In conjunction with the first aspect, in some implementations of the first aspect, the exception context information includes at least one of the following: call stack information and scheduling trajectory information.
[0020] The call stack information and / or scheduling trajectory information can be used to record the operations being performed by the central processing unit when an interrupt delay fault occurs.
[0021] For example, by using the call stack information and / or scheduling trajectory information, the process or function that the central processing unit was executing when the interrupt delay fault occurred can be located. Furthermore, by analyzing the process or function, the specific cause of the interrupt delay fault can be identified, or in other words, the fault point causing the interrupt delay fault can be located.
[0022] In conjunction with the first aspect, in some implementations of the first aspect, the interrupt service routine (ISR) corresponding to the NMI request includes exception context information.
[0023] According to the method of this embodiment, the interrupt service routine (ISR) corresponding to the NMI request includes exception context information. Thus, the central processing unit can obtain the exception context information corresponding to the delayed response to the interrupt request from the ISR corresponding to the NMI request. Furthermore, by analyzing the exception context information, the fault point causing the interrupt delay fault can be located.
[0024] In conjunction with the first aspect, in some implementations of the first aspect, the ISR also includes one or more of the following information: the interrupt number corresponding to the interrupt request, the threshold, and the timing period.
[0025] Secondly, a fault handling method is provided, which can be executed by a central processing unit.
[0026] The method may include: a central processing unit (CPU) receiving an interrupt request; the CPU receiving a non-maskable interrupt (NMI) request from a monitoring device, wherein the NMI request is sent by the monitoring device when the timer's duration is greater than or equal to a threshold, and the duration is the time during which the interrupt request is delayed; and the CPU determining the exception context information corresponding to the delayed response to the interrupt request based on the NMI request.
[0027] According to the method of this embodiment, since the NMI request has the characteristic of being non-maskable, when the central processing unit receives the NMI request reported by the monitoring device, it can immediately respond to the NMI request and determine the abnormal context information corresponding to the delayed response to the interrupt request based on the NMI request. Therefore, it can obtain the key abnormal information of the first scene, thereby improving the efficiency of locating the fault point.
[0028] The method provided in this application locates the fault point causing the interruption delay, and can obtain key abnormal information at the scene without recording the complete system operation trajectory, thereby reducing system overhead. Furthermore, the method according to the embodiments of this application eliminates the need for personnel to manually invoke debugging functions to find the fault point, thus saving human resource costs and improving availability.
[0029] In conjunction with the second aspect, in some implementations of the second aspect, the central processing unit determines the exception context information corresponding to the delayed response to the interrupt request based on the NMI request, including: the central processing unit obtains the exception context information from the interrupt service routine (ISR) corresponding to the NMI request.
[0030] According to the method of this embodiment, the central processing unit determines the exception context information corresponding to the delayed response to the interrupt request based on the NMI request by obtaining the exception context information corresponding to the delayed response to the interrupt request from the ISR corresponding to the NMI request. Furthermore, by analyzing the exception context information, the fault point causing the interrupt delay fault can be located.
[0031] In conjunction with the second aspect, in some implementations of the second aspect, the exception context information includes at least one of the following: call stack information and scheduling trajectory information.
[0032] The call stack information and / or scheduling trajectory information can be used to record the operations being performed by the central processing unit when an interrupt delay fault occurs.
[0033] For example, by using the call stack information and / or scheduling trajectory information, the process or function that the central processing unit was executing when the interrupt delay fault occurred can be located. Furthermore, by analyzing the process or function, the specific cause of the interrupt delay fault can be identified, or in other words, the fault point causing the interrupt delay fault can be located.
[0034] In conjunction with the second aspect, in some implementations of the second aspect, the ISR also includes one or more of the following information: the interrupt number corresponding to the interrupt request, the threshold, and the timing period.
[0035] Thirdly, a fault handling apparatus is provided, comprising: a transceiver unit and an acquisition unit. The transceiver unit is used to receive an interrupt request; the acquisition unit is used to acquire the timing of a timer, the start time of which is the moment when the apparatus receives the interrupt request; if the timing is greater than or equal to a threshold, the transceiver unit is further used to send a non-maskable interrupt (NMI) request to the central processing unit, the NMI request being used by the central processing unit to determine the exception context information corresponding to the delayed response to the interrupt request.
[0036] In conjunction with the third aspect, in some implementations of the third aspect, the device further includes a startup unit. If the interrupt number corresponding to the interrupt request is consistent with the target interrupt number, the startup unit is used to start a timer, wherein the target interrupt number is a predefined interrupt number of the interrupt that needs to be monitored.
[0037] In conjunction with the third aspect, in some implementations of the third aspect, the timer ends at the moment when the interrupt request is responded to by the central processing unit.
[0038] In conjunction with the third aspect, in some implementations of the third aspect, the exception context information includes at least one of the following: call stack information and scheduling trajectory information.
[0039] In conjunction with the third aspect, in some implementations of the third aspect, the interrupt service routine (ISR) corresponding to the NMI request includes exception context information.
[0040] In conjunction with the third aspect, in some implementations of the third aspect, the ISR also includes one or more of the following information: the interrupt number corresponding to the interrupt request, the threshold, and the timing period.
[0041] Fourthly, a fault handling apparatus is provided, comprising: a transceiver unit and a processing unit; the transceiver unit is configured to receive an interrupt request; the transceiver unit is further configured to receive a non-maskable interrupt (NMI) request from a monitoring device, wherein the NMI request is sent by the monitoring device when the timer's timing period is greater than or equal to a threshold, the timing period being the time during which the interrupt request is delayed in response; the processing unit is configured to determine the abnormal context information corresponding to the delayed response to the interrupt request based on the NMI request.
[0042] In conjunction with the fourth aspect, in some implementations of the fourth aspect, the processing unit is also used to obtain exception context information from the interrupt service routine (ISR) corresponding to the NMI request.
[0043] In conjunction with the fourth aspect, in some implementations of the fourth aspect, the exception context information includes at least one of the following: call stack information and scheduling trajectory information.
[0044] In conjunction with the fourth aspect, in some implementations of the fourth aspect, the ISR also includes one or more of the following information: the interrupt number corresponding to the interrupt request, the threshold, and the timing period.
[0045] Fifthly, a computer-readable storage medium is provided that stores program code for execution by a device, the program code including methods for performing any possible implementation of the first or second aspect described above.
[0046] Sixthly, a computer program product is provided that, when run on a computer, causes the computer to perform the method in any possible implementation of the first or second aspect described above.
[0047] A seventh aspect provides a communication apparatus for performing the method provided in the first aspect. Specifically, the apparatus may include units and / or modules for performing the method provided in any implementation of the first aspect, such as a communication unit and / or an acquisition unit.
[0048] In one implementation, the device is a monitoring device. When the device is a monitoring device, the transceiver unit can be a transceiver or an input / output interface. Optionally, the input / output interface can be an input / output circuit.
[0049] Eighthly, a communication apparatus is provided for performing the method provided in the second aspect. Specifically, the apparatus may include units and / or modules for performing the method provided in any implementation of the second aspect, such as processing units and / or communication units.
[0050] In one implementation, the device is a central processing unit (CPU). When the device is a CPU, the communication unit can be a transceiver or an input / output interface. Optionally, the input / output interface can be input / output circuitry.
[0051] A ninth aspect provides a communication device comprising: at least one processor for executing a computer program or instructions stored in a memory to perform the method provided in any implementation of the first aspect. Optionally, the communication device further comprises a memory for storing the program.
[0052] A tenth aspect provides a communication apparatus comprising: at least one processor for executing a computer program or instructions stored in a memory to perform the method provided in any implementation of the second aspect described above. Optionally, the communication apparatus further comprises a memory for storing the program.
[0053] In the eleventh aspect, this application provides a processor for performing the methods provided in the foregoing aspects.
[0054] Unless otherwise specified, or if it does not contradict its actual function or internal logic in the relevant description, the transmission and acquisition / reception operations involved in the processor can be understood as processor output and reception, input and other operations, or as transmission and reception operations performed by radio frequency circuits and antennas. This application does not limit them in this regard.
[0055] In a twelfth aspect, a chip is provided, the chip including a processor and a communication interface, the processor reading instructions stored in a memory through the communication interface and executing the method provided by any implementation of either the first or second aspect.
[0056] Optionally, as one implementation, the chip also includes a memory storing computer programs or instructions, and a processor for executing the computer programs or instructions stored in the memory. When the computer programs or instructions are executed, the processor is used to perform the method provided by any implementation of either the first or second aspect described above.
[0057] In a thirteenth aspect, a chip is provided, the chip including a logic circuit and a communication interface, the communication interface being used to receive data and / or information to be processed and to transmit the data and / or information to be processed to the logic circuit, the logic circuit being used to perform the encoding processing provided by any of the implementations of the first or second aspect above, and the communication interface being further used to output the encoded polar codeword.
[0058] Fourteenthly, a communication system is provided, including the aforementioned monitoring equipment and central processing unit. Attached Figure Description
[0059] Figure 1 This is a schematic diagram illustrating the application scenario of the technical solution provided in the embodiments of this application.
[0060] Figure 2 This is a schematic diagram of a fault handling method provided in an embodiment of this application.
[0061] Figure 3 This is a schematic diagram of a specific application scenario of the technical solution provided in the embodiments of this application.
[0062] Figure 4 This is a schematic diagram of a fault handling method provided according to an embodiment of this application.
[0063] Figure 5 This is a schematic block diagram of a fault handling device provided in an embodiment of this application.
[0064] Figure 6 This is a schematic block diagram of the monitoring device provided in the embodiments of this application.
[0065] Figure 7 This is a schematic block diagram of another fault handling device provided in the embodiments of this application.
[0066] Figure 8 This is a schematic block diagram of the central processing unit provided in the embodiments of this application. Detailed Implementation
[0067] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0068] The technical solutions of this application can be applied to various operating systems, such as disk operating systems (DOS), window operating systems (WINDOWS), multi-user computer operating systems (Linux), etc.
[0069] To facilitate understanding of the embodiments of this application, a brief introduction to several terms involved in this application will be given first.
[0070] 1. Interrupt Request (IRQ): An interrupt request is an event sent by the interrupt controller to the central processing unit (CPU). When the CPU receives an IRQ, it needs to store the currently running program, suspend the program, and execute the program corresponding to the IRQ. In this application, an interrupt request can be simply referred to as an interrupt.
[0071] 2. Non-maskable interrupt (NMI): A non-maskable interrupt is an interrupt that the central processing unit (CPU) cannot mask. Regardless of the state of the interrupt flag (IF) bit in the status register, the CPU must respond to a valid NMI. NMIs are typically used for fault handling, such as coprocessor operation errors, memory check errors, and input / output (I / O) port check errors, and are used to save the operating system's (OS) error state and exception information. Compared to ordinary interrupts (INT), the use of NMIs is more restricted. In this application, NMI can also be referred to as an NMI interrupt, and INT can also be referred to as an INT interrupt.
[0072] It should be understood that, unless explicitly stated otherwise, the interrupts mentioned in this application refer to INT interrupts.
[0073] 3. Interrupt Controller: The interrupt controller is located between the device initiating the interrupt request and the CPU. Its main function is to collect IRQs generated by various devices and send these IRQs to the CPU. In this application, "interrupt controller" is a general term; different systems may have different names and functional components. For example, for the ARM architecture, the interrupt controller is called a generic interrupt controller (GIC), while for the x86 architecture, it is called an advanced programmable interrupt controller ((A)PIC).
[0074] 4. Call Stack: The call stack, also known as the execution stack, control stack, runtime stack, or machine stack, is a stack that stores messages about the running subroutine.
[0075] 5. Scheduling Trajectory: The scheduling trajectory, also known as the call trajectory or system operation process trajectory, can be used to record information about the system's operation process, such as interrupt response information, process scheduling information, system call information, and function call information.
[0076] To facilitate understanding of the embodiments of this application, the following description is provided in conjunction with... Figure 1 This application provides a detailed description of an application scenario for the technical solution provided in the embodiments of this application.
[0077] Figure 1 This is a schematic diagram illustrating the application scenario of the technical solution provided in the embodiments of this application.
[0078] This application scenario may include a central processing unit and at least one monitoring device, such as... Figure 1 The diagram shows a central processing unit 110 and a monitoring device 140. The central processing unit 110 can be used to configure and enable the monitoring device 140. This application scenario may also include an interrupt controller and at least one device that initiates an interrupt request, such as... Figure 1 The interrupt controller 120 and device 130 are shown. Device 130 can be used to send interrupt requests to both interrupt controller 120 and monitoring device 140 simultaneously. Interrupt controller 120 can be used to send the interrupt request from device 130 to central processing unit 110, and then central processing unit 110 can complete the response and processing of the interrupt request.
[0079] exist Figure 1In the application scenario shown, the monitoring device 140 may be equipped with a timer 150. The monitoring device 140 can be used to monitor situations where interrupt requests are delayed in response. When an interrupt delay timeout occurs, or when the time for waiting for an interrupt request to be responded to is greater than or equal to a threshold, the monitoring device 140 can report an NMI interrupt request to the central processing unit 110 through the interrupt controller 120. Thus, the central processing unit 110 can obtain the abnormal context information corresponding to the delayed response to the device's interrupt request by responding to or processing the NMI interrupt request.
[0080] It should be understood that, in this application, interrupt delay timeout can also be understood as the interrupt request waiting for a response for a time greater than or equal to a threshold, or it can also be understood as the interrupt request being delayed for a response for a time greater than or equal to a threshold.
[0081] This threshold can be pre-configured according to the characteristics of different services. This threshold can also be called the interruption delay timeout threshold.
[0082] It should also be understood that, in this application, exception context information may also be referred to as exception information or interruption delay exception information.
[0083] It should also be understood that, for ease of explanation, Figure 1 Only one monitoring device and timer are shown. In real-world applications, there can be multiple monitoring devices and timers. As an example, each monitoring device is associated with one timer, or in other words, each monitoring device can have one timer. When an application scenario includes multiple monitoring devices, these devices can operate independently without affecting each other.
[0084] It should also be understood that in this application, the interrupt controller can be a GIC under the ARM architecture, or it can be an APIC under the x86 architecture. This application does not limit the type of interrupt controller. For ease of description, the following embodiments use a GIC as an example for illustrative purposes.
[0085] It should also be understood that Figure 1 This is a simplified illustration for ease of understanding only; other devices may be included in this application scenario. Figure 1 Not shown in the drawing. For example, Figure 1 The application scenarios shown may also include storage devices for storing the exception context information acquired by the central processing unit 110.
[0086] In system-on-chip (SoC) audio and video services, there are certain special interrupt requests. If the CPU fails to respond to or process these interrupt requests within a limited time, the service will malfunction. For example, after an interrupt request is triggered in the video display process (VDP) service, the CPU must respond to or process the interrupt request within 16ms; otherwise, problems such as screen flickering or distorted display will occur.
[0087] The main reasons why interruption requests cannot be responded to or processed are as follows:
[0088] One possible scenario involves concurrent access between process context and interrupt context. In this case, synchronization is typically achieved using functionality similar to `spin_lock_irqsave` or `spin_unlock_irqrestore`, which temporarily disables CPU response or interrupt request processing, thus causing interrupt requests to be delayed.
[0089] Another possible scenario is that, since the kernel does not support interrupt nesting by default, if an interrupt service routine is already running, the CPU will not respond to or process other interrupts during the execution of that interrupt service routine, thus causing interrupt requests to be delayed.
[0090] The above two scenarios are illustrative examples using the Linux operating system. It is understood that similar situations where interrupt requests cannot be responded to or processed in a timely manner exist in other operating systems as well.
[0091] Faults caused by the failure to respond to or process interrupt requests in a timely manner can be called interruption delay faults. These faults are generally intermittent soft faults, meaning they have a low probability of recurrence. Although the system can still operate normally after such an issue occurs, the user experience may be degraded. For example, in an audio or video service, if an interrupt request is not responded to or processed in a timely manner, it may cause the audio or video to stutter, thus affecting the user experience. These types of problems are usually difficult to troubleshoot and are costly to resolve.
[0092] To investigate the cause of the interrupt delay fault, it is necessary to locate the point in the program that is causing the interrupt delay fault.
[0093] Currently, interrupt delay faults can be located using software methods. For example, the ftrace function provided by the Linux kernel can be used to locate the fault point causing the interrupt delay fault, which will be referred to as Method 1 below; another example is that the irqsoff tracer function provided by ftrace can be used to locate the fault point causing the interrupt delay fault, which will be referred to as Method 2 below.
[0094] The following sections will introduce methods 1 and 2 respectively.
[0095] Method 1:
[0096] Enable the logging function provided by ftrace. This function can be used to record the system's runtime trajectory and the corresponding timestamp information. Then, based on the captured trajectory information, the fault causing the interruption delay can be delimited and located. For example, delimitation can be performed by comparing the timestamps of two consecutive interrupt responses. If the difference between the timestamps of the previous and subsequent interrupt responses exceeds a maximum limit, the fault can be delimited to the function corresponding to the timestamp of the subsequent interrupt response. Furthermore, by analyzing the call trajectory of this function, the fault point can be located.
[0097] Method 2:
[0098] Enable the irqsoff tracer function provided by ftrace. This function can mark the locations where interrupts are enabled or disabled, thus allowing you to calculate the time difference from disabling interrupts to enabling them, and record the call stack when interrupts are enabled. If the time difference from disabling interrupts to enabling them exceeds a certain threshold, the faulty call stack context can be found from the call stack when interrupts are enabled.
[0099] However, using software methods for fault location requires recording the complete system runtime trajectory, which is then analyzed to pinpoint the fault when it occurs, resulting in significant system overhead. Furthermore, software methods for locating interrupt delay faults necessitate manual debugging by personnel to identify the fault, leading to high human resource costs and making the method difficult to implement. Additionally, regarding method 2, since the Linux kernel defaults to tickless mode, which disables interrupts and invokes the WFI (waiting for instructions) instruction when the system is idle, and wakes up the WFI and re-enables interrupts when a new interrupt arrives, the time difference obtained using the irqsoff function in tickless mode may represent the time difference between disabling and enabling interrupts in idle mode. This interrupt disabling operation is not a cause of interrupt delay faults; therefore, the time difference obtained in idle mode is meaningless. The kernel needs to be reconfigured (with tickless mode disabled) and recompiled before this function can be used.
[0100] Therefore, this application provides a fault handling method that can locate the fault point causing the interruption delay fault by combining software and hardware, so as to reduce the location cost and system overhead, while improving availability.
[0101] The fault handling method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings. The fault handling method provided in the embodiments of this application can be applied to the above-described... Figure 1 The application scenarios shown.
[0102] Figure 2 This is a schematic diagram of a fault handling method provided in an embodiment of this application.
[0103] The method 200 may include steps S210 to S240. The monitoring device may be, for example, [missing information - likely a specific type of device]. Figure 1 The monitoring device 140 in the middle; the CPU can be, for example, Figure 1 The central processing unit 110 in it.
[0104] S210, the monitoring device and CPU receive interrupt requests.
[0105] In S210, the monitoring device and the CPU can simultaneously receive interrupt requests from a certain device. For ease of description, this device will be referred to as the first device below. The first device could be, for example, a... Figure 1 Equipment 130.
[0106] The CPU can be used to respond to received interrupt requests; the monitoring device can be used to monitor the CPU's response to the interrupt request. For example, when an interrupt delay timeout occurs, or when the interrupt request waits for a response for a time greater than or equal to a threshold, the monitoring device can send an NMI request to the CPU. This NMI request can then be used by the CPU to determine the exception context information corresponding to the delayed response to the interrupt request.
[0107] S220, the monitoring device obtains the timing time of the timer.
[0108] In S220, the monitoring device can obtain the timing duration of the timer, wherein the timing duration is the time during which the interrupt request received in S210 is delayed in response. Optionally, before S220, the method further includes: the monitoring device starting the timer.
[0109] The time during which an interrupt request is delayed in response can also be understood as the time during which the interrupt request waits for a response from the CPU. This timing period can be used by the monitoring device to determine whether to send an NMI request to the CPU. Subsequently, the CPU can respond to the NMI request in S240 and obtain the exception context information corresponding to the delayed response to the interrupt request from the interrupt service routine (ISR) corresponding to the NMI request.
[0110] Optionally, the timer can be set within the monitoring device.
[0111] The timer starts counting when the monitoring device receives the interrupt request, or in other words, the timer starts counting when the interrupt is triggered.
[0112] In the embodiments of this application, the interrupt triggering method can be either level triggering or edge triggering. For level triggering, the timer starts counting when the monitoring device detects that the level of the interrupt signal line is low or high. For edge triggering, the timer starts counting when the monitoring device detects a pulse change in the level of the interrupt signal line; that is, the timer starts counting when the monitoring device detects that the level of the interrupt signal line changes from high to low or from low to high.
[0113] As an example, an interrupt can be triggered by a rising edge. In this case, a low level on the interrupt signal line indicates no interrupt; a change from low to high indicates an interrupt is triggered; and a change from high to low indicates the interrupt is cleared. Therefore, the timer can start counting at the moment the interrupt signal line changes from low to high, or in other words, at the moment a rising edge appears on the interrupt signal line.
[0114] Optionally, before the timer starts counting, method 200 may further include: the monitoring device acquiring the interrupt number corresponding to the interrupt request sent by the first device.
[0115] In this application, the interrupt number corresponding to the interrupt request can also be understood as the interrupt number of the interrupt. Interrupt requests sent by different devices may correspond to different interrupt numbers. Subsequently, the monitoring device can compare the acquired interrupt number with the target interrupt number, and thus determine whether to start the timer based on the comparison result. The target interrupt number is the interrupt number of the interrupt to be monitored.
[0116] Specifically, if the monitoring device finds that the interrupt number corresponding to the interrupt request belongs to the target interrupt number, or in other words, the monitoring device determines through comparison that the interrupt number corresponding to the interrupt request is consistent with the target interrupt number, then the timer starts counting.
[0117] In the embodiments of this application, the monitoring device may pre-store the target interrupt number, or the target interrupt number may be configured by the CPU for the monitoring device, which is not limited in this application.
[0118] The target interrupt number can be a single interrupt number or multiple interrupt numbers, which can exist in the form of an interrupt number list. When the target interrupt number is an interrupt number list, the monitoring device can compare the interrupt number corresponding to the interrupt request with the interrupt numbers in the interrupt number list. If the interrupt number corresponding to the interrupt request matches one of the interrupt numbers in the interrupt number list, it can be considered that the interrupt number corresponding to the interrupt request matches the target interrupt number, and the timer can then start counting.
[0119] According to the method in this embodiment, users can set the target interrupt number according to actual needs, thereby enabling targeted monitoring of the interrupts that need to be monitored.
[0120] S230, the monitoring device sends an NMI request to the CPU. Correspondingly, the CPU receives the NMI request from the monitoring device.
[0121] The sending of an NMI request by the monitoring device to the CPU can be understood as the monitoring device reporting an NMI request to the CPU, or it can be understood as the monitoring device triggering an NMI report. This NMI request is used by the CPU to determine the exception context information corresponding to the delayed response to the interrupt request. For example, this NMI request can be used to interrupt an operation being performed by the CPU, so that the CPU can obtain the exception context information corresponding to the delayed response to the interrupt request through the ISR of the NMI. Alternatively, the CPU can obtain the exception context information corresponding to the delayed response to the interrupt request from the ISR corresponding to the NMI request.
[0122] In this application, the exception context information corresponding to the delayed response to the interrupt request can also be understood as exception context information associated with the interrupt delay fault. Furthermore, by analyzing this exception context information, the fault point causing the interrupt delay fault can be located.
[0123] In S230, the monitoring device can determine whether to send an NMI request to the CPU based on the timer duration obtained in S220.
[0124] One possible scenario is that the timer's duration is greater than or equal to a threshold. In this case, it can be assumed that the CPU failed to respond to or process the interrupt request sent by the first device in a timely manner, resulting in an interrupt delay fault. Therefore, the monitoring device can determine whether to send an NMI request to the CPU based on the timer's duration. Alternatively, the monitoring device can send an NMI request to the CPU when the timer's duration is greater than or equal to the threshold.
[0125] The timer's timing duration equals the threshold, which can also be understood as the timer's timing duration exactly reaching the threshold; the timer's timing duration is greater than the threshold, which can also be understood as the timer's timing duration exactly exceeding the threshold.
[0126] Another possible scenario is that the timer's duration is less than the threshold. In this case, it can be assumed that the CPU has already responded to and processed the interrupt request sent by the first device; therefore, the monitoring device does not need to send an NMI request to the CPU.
[0127] Optionally, when the interrupt request sent by the first device is responded to by the CPU, the timer may stop counting. In other words, the timer stops counting at the moment the interrupt request sent by the first device is responded to by the CPU. The moment the timer stops counting can also be understood as the end time of the timer. Since the timer stops counting at the moment the interrupt request is responded to by the CPU, by reading the timer's countdown, the delay in responding to the interrupt request can be determined, or in other words, the duration from triggering the interrupt request to receiving a response can be determined.
[0128] The threshold mentioned above can be a numerical value or a range of values, without restriction.
[0129] The threshold can be a predefined value from the protocol, a value generated according to predefined rules, a pre-configured value, or a dynamically configured value. The monitoring device can save the threshold in advance, or the threshold can be configured by the CPU for the monitoring device.
[0130] As an example, this threshold can be pre-configured according to the characteristics of different services. For instance, after an interrupt request is triggered in a VDP service, the CPU is required to respond to or process the interrupt request within 16ms; otherwise, issues such as screen flickering or distorted display may occur. Therefore, for VDP services, the threshold can be set to 16ms.
[0131] It should be understood that in the embodiments of this application, when the conditions for the monitoring device to send an NMI request to the CPU are met, for example, when the timer's timing is greater than or equal to a threshold, the monitoring device can send an interrupt request to the GIC, and then the GIC can set the interrupt request as an NMI request and send the NMI request to the CPU, thereby realizing the reporting of the NMI request.
[0132] In the embodiments of this application, when an interrupt is triggered, the timer can automatically start counting. If the time for which the interrupt request is delayed is greater than or equal to a threshold, it can be considered that the time for the interrupt to be responded to by the CPU exceeds the normal range, or in other words, an interrupt delay fault has occurred. At this time, the monitoring device can report an NMI request to the CPU to interrupt the operation currently being executed by the CPU, and then obtain the abnormal context information through the CPU. Therefore, by locating the fault point causing the interrupt delay fault using the method provided in this application, key abnormal information of the first scene can be obtained without recording the complete system operation trajectory, thereby reducing system overhead. In addition, according to the method of the embodiments of this application, there is no need for personnel to manually call the debugging function to debug in order to find the fault point, which helps to save human resource costs and improve availability.
[0133] S240, the CPU determines the exception context information corresponding to the delayed response to the interrupt request based on the NMI request.
[0134] In S240, the CPU can determine the exception context information corresponding to the delayed response to the interrupt request based on the NMI request. As an example, the CPU can obtain this exception context information from the ISR corresponding to the NMI request.
[0135] Among them, the exception context information can be used to locate the fault point that causes the interrupt delay fault, or in other words, it can be used to determine the program in the program executed by the CPU that causes the interrupt request sent by the first device to be delayed in response.
[0136] Because NMI requests are non-maskable, the CPU can respond to an NMI request immediately upon receiving it from the monitoring device. In other words, the NMI request can interrupt the CPU's current operation, allowing the CPU to obtain the exception context information corresponding to the delayed response to the interrupt request through the NMI's ISR; or, more specifically, the CPU can obtain the exception context information from the ISR corresponding to the NMI request; or, the ISR corresponding to the NMI request can be understood as including the exception context information corresponding to the delayed response to the interrupt request. Furthermore, by analyzing this exception context information, the fault point causing the interrupt delay can be located.
[0137] Optionally, the exception context information may include, for example, call stack information and / or scheduling trace information. The call stack information and / or scheduling trace information can be used to record the operations the CPU was performing when an interrupt latency fault occurred.
[0138] For example, by using the call stack information and / or scheduling trajectory information, the process or function that the CPU was executing at the time of the interrupt delay fault can be located. Furthermore, by analyzing this process or function, the specific cause of the interrupt delay fault can be identified, or in other words, the fault point can be located. For instance, during the analysis of this function, it might be discovered that it contains an interrupt disabling operation, causing the interrupt request sent by the first device to not be properly responded to by the CPU; or, for example, during the analysis of this function, it might be discovered that it contains a while loop operation, causing the interrupt request sent by the first device to not be responded to by the CPU in a timely manner.
[0139] Optionally, the ISR of the NMI may also include one or more of the following information, or in other words, one or more of the following information may be retrieved from the ISR of the NMI:
[0140] The interrupt number, threshold, and timer duration corresponding to the interrupt request sent by the first device.
[0141] According to the method of this embodiment, since the NMI request has the characteristic of being non-maskable, when the CPU receives the NMI request reported by the monitoring device, it can immediately respond to the NMI request and obtain the abnormal context information. Therefore, it can obtain the key abnormal information of the first scene, thereby improving the efficiency of locating the fault point.
[0142] The above text combined Figure 2 This application introduces a fault handling method 200 provided in an embodiment. To facilitate understanding of the fault handling method provided in this application, the following is a detailed explanation... Figure 3 and Figure 4This paper introduces a possible implementation process for applying method 200 to a specific application scenario.
[0143] Figure 3 This illustration shows a specific application scenario of the technical solution provided in the embodiments of this application.
[0144] This application scenario may include a CPU 310, a GIC 320, a device 330 (an example of a first device), an IRQ latency monitor 340 (an example of a monitoring device), and a storage device 360. The IRQ latency monitor 340 includes a timer 350, a control register 370, and a status register 380.
[0145] exist Figure 3 In the application scenario shown, CPU 310 can be used to configure and enable IRQ latency monitor 340, respond to received interrupt requests or NMI requests, and acquire and send the exception context information corresponding to the delayed response to the interrupt request from device 330 to storage device 360. Storage device 360 can be used to store the exception context information from CPU 310.
[0146] The IRQ latency monitor 340 can be used to monitor the latency of interrupt requests. When an interrupt timeout occurs, or when the time for an interrupt request to be responded to is greater than or equal to a threshold, the IRQ latency monitor 340 can report an NMI request to the CPU 310 via the GIC 320. By responding to the NMI request, the CPU 310 can obtain the exception context information corresponding to the delayed response to the interrupt request from the device 330.
[0147] In one possible implementation, if the IRQ delay monitor 340 detects that the timing duration (denoted as CNT) of the timer 350 is equal to the threshold and the timer's run enable bit (EN field) is enabled, then an NMI report is triggered. Figure 3 301 in the diagram illustrates the conditions required for the IRQ delay monitor 340 to trigger an NMI report in this implementation. Here, EN == 1 indicates that the timer 350 is enabled; as an example, in this embodiment, the threshold is 0x1234, then CNT == 0x1234 in 301 indicates that the timing of the timer 350 is equal to the threshold, or in other words, the timing of the timer 350 exactly reaches the threshold.
[0148] It should be understood that the above-mentioned condition of using the timing time equal to the threshold as the condition for the IRQ delay monitor to trigger NMI reporting is exemplary. In other possible implementations, the timing time may also be greater than the threshold as the condition for the IRQ delay monitor to trigger NMI reporting, which is not limited in this application.
[0149] Device 330 can be used to send interrupt requests to both GIC320 and IRQ delay monitor 340 simultaneously.
[0150] On the one hand, device 330 can send an interrupt request to GIC320 through an interrupt reporting operation. Then, GIC 320 can send the interrupt request to CPU 310 through an interrupt distribution operation so that CPU 310 can respond and process it.
[0151] On the other hand, the interrupt request sent by device 330 can be used to trigger timer 350 to start timing. The interrupt request can be triggered by either level-triggered or edge-triggered methods. For example, in this embodiment, a rising edge on the interrupt signal line indicates an interrupt trigger, and a falling edge on the interrupt signal line indicates an interrupt clearing.
[0152] It should be understood that the above-mentioned interruption request triggering method is exemplary, and other triggering methods may be used in other possible implementations, which are not limited in this application.
[0153] In one possible implementation, if the IRQ delay monitor 340 detects that the interrupt number (IRQ_ID) corresponding to the interrupt request is the target interrupt number X, the timer's run enable bit (EN field) is enabled, and a rising edge appears on the interrupt signal line, then the timer 350 starts timing. Figure 3 302 in the diagram illustrates the conditions required for the timer to start timing in this implementation. Here, IRQ_ID == X indicates that the interrupt request sent by device 330 corresponds to the target interrupt number X; EN == 1 indicates that timer 350 is enabled, and correspondingly, if EN == 0, it indicates that timer 350 is not enabled; IRQ == _| indicates that a rising edge has occurred on the interrupt signal line, and correspondingly, if IRQ == |_, it indicates that a falling edge has occurred on the interrupt signal line.
[0154] In one possible implementation of this embodiment, if the IRQ delay monitor 340 detects that the timer's run enable bit (EN field) is enabled and a falling edge appears on the interrupt signal line, then the timer 350 stops counting and returns to the initial state. Figure 3 303 in the diagram illustrates the conditions required for the timer to stop counting in this implementation. Here, EN == 1 indicates that timer 350 is enabled, and IRQ == |_ indicates a falling edge on the interrupt signal line.
[0155] In this embodiment, the IRQ delay monitor 340 also includes a control register 370 and a status register 380.
[0156] The control register 370 can be used to set the target interrupt number (IRQ_ID field) and the threshold (Threshold field). The control register 370 can also control the enabling status of the timer 350 by controlling the run enable bit (EN field) of the timer 350. For example, the control register 370 can enable the timer 350 by setting the run enable bit to 1, and can also disable the timer 350's timing function by setting the run enable bit to 0.
[0157] The status register 380 can be used to record / query the time during which an interrupt request is delayed (overflow field). It can be understood that in this embodiment, the time during which an interrupt request is delayed is the timing period of timer 350.
[0158] Table 1 shows an example of the contents that may be contained in control register 370 and status register 380. Control register 370 includes the EN field, IRQ_ID field, and Threshold field; status register 380 includes the Overflow field.
[0159] Table 1
[0160] EN IRQ_ID Threshold Overflow 1 X 0x1234 0x1235
[0161] It should be noted that the names and corresponding values of the various fields shown in Table 1 are merely illustrative and do not constitute any limitation on the scope of protection of this application. For example, the names of the various fields shown in Table 1 can also be replaced with any other names that can be used to express the same meaning.
[0162] Figure 4 This is a schematic diagram of a fault handling method 400 provided according to an embodiment of this application.
[0163] As an example, method 400 can be applied to Figure 3 In the application scenario shown, method 400 may include steps S401 to S413.
[0164] S401, Initialize target interrupt number.
[0165] S402, Initialize threshold.
[0166] S403, Enable Timer.
[0167] Initializing the target interrupt number can also be understood as configuring the target interrupt number, or configuring the initial value of the target interrupt number. Similarly, initializing the threshold can be understood as configuring the threshold, or configuring the initial value of the threshold.
[0168] In S401 to S403, the CPU (e.g.) Figure 3 CPU 310 in the middle) can be used as an IRQ latency monitor (e.g. Figure 3 Configure the target interrupt number and threshold in the IRQ delay monitor 340, and enable the timer (e.g., Figure 3 (Timer 350 in the IRQ latency monitor). As an example, the CPU can configure the control registers in the IRQ latency monitor (e.g., timer 350). Figure 3 Use the control register 370 in the middle to configure the target interrupt number and threshold, and enable the timer.
[0169] The target interrupt number is the interrupt number of the interrupt that needs to be monitored. This target interrupt number can be compared with the interrupt number corresponding to the interrupt request received by the IRQ delay monitor, and then the timer should be started based on the comparison result.
[0170] The threshold can be used by the IRQ latency monitor to determine whether to report an NMI request to the CPU.
[0171] S404, waiting for an interrupt to be triggered.
[0172] Waiting for an interrupt to trigger can also be understood as waiting for a device (e.g., Figure 3 The device 330 in the middle sends an interrupt request, or in other words, waits for the device to trigger an interrupt request.
[0173] S405 checks if an interrupt has been triggered.
[0174] In this embodiment, if an interrupt is triggered, a rising edge appears on the interrupt signal line. Therefore, the IRQ delay monitor can determine whether an interrupt has been triggered by detecting whether a rising edge appears on the interrupt signal line.
[0175] In other words, when a rising edge appears on the interrupt signal line, the S405 determines that an interrupt has been triggered. Conversely, if no rising edge appears on the interrupt signal line, the S405 determines that an interrupt has not been triggered.
[0176] In S405, if the result of S405 is that an interrupt has been triggered, then S406 is executed and the timer starts counting; if the result of S405 is that an interrupt has not been triggered, then S404 is returned to wait for an interrupt to be triggered.
[0177] S406, timer.
[0178] In S406, the IRQ delay monitor can determine whether to start the timer based on the target interrupt number, the timer's enable status, and the interrupt's trigger status.
[0179] As an example, if the S405 determines that an interrupt has been triggered, and the interrupt number corresponding to the interrupt request is consistent with the target interrupt number, and the timer is already enabled, then the timer will start counting.
[0180] S407 checks whether the interrupt has been cleared.
[0181] In this embodiment, a falling edge appears on the interrupt signal line if the interrupt is cleared. Therefore, the IRQ delay monitor can determine whether the interrupt has been cleared by detecting whether a falling edge appears on the interrupt signal line.
[0182] In other words, when a falling edge appears on the interrupt signal line, S407 determines that the interrupt is cleared. Conversely, if no falling edge appears on the interrupt signal line, S407 determines that the interrupt is not cleared.
[0183] Optionally, in this embodiment, the interrupt clearing time is the time when the interrupt request is responded to by the CPU.
[0184] In S407, if the result of S407 is that the interrupt is cleared, then S408 is executed to initialize the timer; if the result of S407 is that the interrupt is not cleared, then S409 is executed to determine whether a timeout has occurred.
[0185] S408, timer initialization.
[0186] If the result of S407 is interrupt clearing, then S408 is executed to initialize the timer.
[0187] Initializing a timer can also be understood as returning the timer to its initial state, resetting the timer's timing duration, or setting the timer's timing duration to an initial value, such as 0.
[0188] In this embodiment, after initializing the timer, the process returns to S404, waiting for an interrupt to be triggered.
[0189] S409, determine if a timeout has occurred.
[0190] If the result of S407 is that the interrupt has not been cleared, then S409 is executed to determine whether the timer has timed out.
[0191] As an example, if the timer's duration is greater than or equal to the threshold configured in S402, the interrupt delay is considered to have timed out, or in other words, an interrupt delay fault has occurred. In this case, the judgment result of S409 is timeout. Conversely, if the timer's duration is less than the threshold configured in S402, the interrupt delay fault is considered not to have occurred. In this case, the judgment result of S409 is no timeout.
[0192] In S409, if the judgment result of S409 is a timeout, then S410 and S411 are executed to record the timeout status and trigger NMI reporting; if the judgment result of S409 is no timeout, then return to S406 and the timer continues to count.
[0193] S410 records timeout status.
[0194] If the judgment result of S409 is a timeout, then in S410, the status register (e.g., Figure 3 The status register 380 in the system records the timeout status.
[0195] The timeout state refers to the state in which an interrupt request is responded to with a delay. Specifically, the timeout state can be represented, for example, by the duration of the delay in responding to the interrupt request. Thus, the timeout state can be recorded by recording the duration of the delay in responding to the interrupt request (Overflow field).
[0196] In this embodiment, the time during which the interrupt request is delayed is the timeout period of the timer. This timeout period can be queried through the status register.
[0197] It should be understood that the timer's duration can be a dynamically changing value. For example, before the timer is initialized (before S408 is executed), the timer's duration gradually increases. That is, S410 can be a continuous process that continues until S408.
[0198] S411, triggers NMI reporting.
[0199] If the judgment result of S409 is a timeout, then S411 can be executed, and the IRQ delay monitor will trigger NMI reporting.
[0200] As an example, when the S409's judgment result is a timeout, the IRQ latency monitor can be activated via GIC (e.g., Figure 3 The GIC320 in the CPU reports an NMI request to the CPU. This NMI request can be used to interrupt the operation currently being performed by the CPU, so that the CPU can obtain the exception context information corresponding to the delayed response to the interrupt request through the ISR of the NMI.
[0201] It should be understood that S410 and S411 can be executed in parallel. That is, both S410 and S411 are executed when the judgment result of S409 is a timeout. This application does not limit the execution order of S410 and S411.
[0202] S412, the CPU determines the exception context information.
[0203] Software processing may include: the CPU retrieving the exception context information corresponding to the delayed response to the interrupt request from the ISR of the NMI. The exception context information may include, for example, call stack information and / or scheduling trace information.
[0204] Optionally, the CPU may also obtain one or more of the following information from the ISR of the NMI: the interrupt number corresponding to the interrupt request, the threshold, and the timer duration.
[0205] Storage devices (e.g.) Figure 3 The storage device 360 in the memory can be used to store exception context information from the CPU. It can also be used to store information such as the interrupt number, threshold, and timer duration corresponding to the interrupt request.
[0206] S413, determine whether the interrupt has been cleared.
[0207] In the S413, the IRQ delay monitor can determine whether an interrupt has been cleared by detecting whether a falling edge appears on the interrupt signal line.
[0208] If the result of S413 indicates that the interrupt has been cleared, then S408 is executed to initialize the timer. If the result of S413 indicates that the interrupt has not been cleared, then the process returns to S412.
[0209] In this embodiment, timing can be achieved via hardware. If the delay in responding to an interrupt request is greater than or equal to a threshold, then abnormal information is obtained via software. The method provided in this application locates the fault point causing the interrupt delay without needing to record the complete system operation trajectory, thus reducing system overhead. Furthermore, the method according to this embodiment eliminates the need for personnel to manually invoke debugging functions to discover the fault point, thereby saving human resource costs and improving availability.
[0210] It is understood that in the embodiments of this application... Figures 1 to 4 The examples provided are merely to facilitate understanding of the embodiments of this application by those skilled in the art, and are not intended to limit the embodiments of this application to the specific scenarios illustrated. Figures 1 to 4 The examples are obviously subject to various equivalent modifications or changes, and such modifications or changes also fall within the scope of the embodiments of this application.
[0211] It is also understood that some optional features in the various embodiments of this application may not depend on other features in some scenarios, or may be combined with other features in some scenarios, without limitation.
[0212] It is also understood that the solutions in the various embodiments of this application can be used in reasonable combinations, and the explanations or descriptions of the various terms appearing in the embodiments can be referenced or explained to each other in the various embodiments, without limitation.
[0213] It should also be understood that the various numerical sequences in the embodiments of this application do not imply the order of execution, but are merely a distinction for the convenience of description, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0214] It is also understood that the names of the information transmitted between the communication devices in the various embodiments of this application do not limit the scope of protection of the embodiments of this application.
[0215] It can also be understood that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.
[0216] Corresponding to the methods given in the above method embodiments, this application also provides corresponding apparatus, which includes modules for performing the corresponding methods in the above method embodiments. It is understood that the technical features described in the above method embodiments are also applicable to the following apparatus embodiments.
[0217] Figure 5 This is a schematic block diagram of the fault handling apparatus 500 provided in an embodiment of this application. Figure 5 As shown, the device 500 includes a transceiver unit 510 and an acquisition unit 520.
[0218] In one design, the device 500 can be the monitoring device in the foregoing embodiments, or it can be a component of the monitoring device (such as a chip). The device 500 can implement the steps or processes performed by the monitoring device corresponding to the method embodiments described above.
[0219] In one possible implementation, the transceiver unit 510 is used to receive an interrupt request; the acquisition unit 520 is used to acquire the timing of a timer, the start time of which is the moment when the device receives the interrupt request; if the timing is greater than or equal to a threshold, the transceiver unit 510 is also used to send a non-maskable interrupt (NMI) request to the central processing unit, the NMI request being used by the central processing unit to determine the exception context information corresponding to the delayed response to the interrupt request.
[0220] Optionally, the device 500 further includes a startup unit 530, which starts a timer if the interrupt number corresponding to the interrupt request matches the target interrupt number. The target interrupt number is a predefined interrupt number of the interrupt that needs to be monitored.
[0221] Optionally, the timer ends at the moment when the interrupt request is responded to by the central processing unit.
[0222] Optionally, the exception context information includes at least one of the following: call stack information and scheduling trajectory information.
[0223] Optionally, the interrupt service routine (ISR) corresponding to the NMI request includes exception context information.
[0224] Optionally, the ISR may also include one or more of the following information: the interrupt number corresponding to the interrupt request, the threshold, and the timing period.
[0225] In an optional embodiment, the transceiver unit 510 can be the input / output interface 610 in the monitoring device 600, and the acquisition unit 520 can be the control component 620 in the monitoring device 600. Optionally, the monitoring device 600 also includes a register component 630. Specifically, as shown below... Figure 6 As shown.
[0226] Figure 6 This is a schematic block diagram of the monitoring device 600 provided in the embodiments of this application. Figure 6 The monitoring device 600 shown may include an input / output interface 610, a control unit 620, and optionally, a register unit 630. The input / output interface 610, control unit 620, and register 630 are connected via internal connection paths. The control unit is used to decode instructions and issue control signals for each operation to be performed to complete each instruction. The register is used to store temporarily stored register operands and operation results during instruction execution. The input / output interface is used to receive input data and information and output data such as operation results.
[0227] It should be noted that the register component may include at least one register. Specifically, the register component may include at least one of a register, a special-purpose register, and a control register.
[0228] In implementation, each step of the method can be completed through integrated logic circuits in the hardware of the computing device or through software instructions. The method disclosed in the embodiments of this application can be directly implemented by a hardware monitoring device, or by a combination of hardware and software modules in the monitoring device. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in the memory of the computing device, and the monitoring device reads the information in the memory and, in conjunction with its hardware, completes the steps of the method. To avoid repetition, detailed descriptions are omitted here.
[0229] Figure 7 This is a schematic block diagram of a fault handling apparatus 700 provided in an embodiment of this application. Figure 7 As shown, the device 700 includes a transceiver unit 710 and a processing unit 720.
[0230] In one design, the device 700 may be the central processing unit (CPU) in the foregoing embodiments, or a component of the CPU (such as a chip). The device 700 may implement steps or processes corresponding to those executed by the CPU in the above method embodiments.
[0231] One possible implementation is that the transceiver unit 710 is used to receive an interrupt request; the transceiver unit 710 is also used to receive a non-maskable interrupt NMI request from the monitoring device, the NMI request being sent by the monitoring device when the timer's timing is greater than or equal to a threshold, the timing being the time during which the interrupt request is delayed; and the processing unit 720 is used to determine the exception context information corresponding to the delayed response to the interrupt request based on the NMI request.
[0232] Optionally, the processing unit 720 is also configured to obtain exception context information from the interrupt service routine (ISR) corresponding to the NMI request.
[0233] Optionally, the exception context information includes at least one of the following: call stack information and scheduling trajectory information.
[0234] Optionally, the ISR may also include one or more of the following information: the interrupt number corresponding to the interrupt request, the threshold, and the timing period.
[0235] In an optional embodiment, the transceiver unit 710 may be an input / output interface 810 in the central processing unit 800, and the processing unit 720 may be a control unit 820 in the central processing unit. Optionally, the central processing unit 800 may also include a register unit 830, specifically as follows: Figure 8 As shown.
[0236] Figure 8This is a schematic block diagram of the central processing unit 800 provided in the embodiments of this application. Figure 8 The central processing unit shown may include an input / output interface 810, a control unit 820, and optionally, a register unit 830. The input / output interface 810, control unit 820, and register unit 830 are connected via internal interconnection paths. The control unit is used to decode instructions and issue control signals for the various operations to be performed to complete each instruction. The register unit is used to store temporarily stored register operands and operation results during instruction execution. The input / output interface is used to receive input data and information and output data such as operation results.
[0237] It should be noted that the register component may include at least one register. Specifically, the register component may include at least one of a register, a special-purpose register, and a control register.
[0238] In implementation, each step of the method can be completed through integrated logic circuits in the hardware of a computing device or through software instructions. The method disclosed in the embodiments of this application can be directly implemented by a hardware central processing unit (CPU), or by a combination of hardware and software modules within the CPU. The software modules can reside in readily available storage media in the art, such as random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (ROM), electrically erasable programmable memory (EEPROM), or registers. This storage medium is located in the memory of the computing device, and the CPU reads information from the memory and, in conjunction with its hardware, completes the steps of the method. To avoid repetition, detailed descriptions are omitted here.
[0239] This application also provides a computer-readable storage medium storing computer instructions for implementing the methods executed by a monitoring device or a central processing unit in the above-described method embodiments.
[0240] This application also provides a computer program product comprising instructions which, when executed by a computer, implement the methods performed by a monitoring device or a central processing unit in the above-described method embodiments.
[0241] This application also provides a communication system, including the aforementioned monitoring device and central processing unit.
[0242] The explanations and beneficial effects of the relevant contents in any of the devices provided above can be found in the corresponding method embodiments provided above, and will not be repeated here.
[0243] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0244] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0245] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0246] In this embodiment, it can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes program code. When the program code is loaded and executed on a computer, it generates, in whole or in part, the processes or functions described in the embodiments of this application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can read or a data storage device such as a server or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., Digital Video Discs (DVDs)), or semiconductor media (e.g., Solid State Disks (SSDs)).
[0247] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for troubleshooting, characterized in that, include: The monitoring equipment received an interrupt request; The monitoring device acquires the timing time of the timer, and the start time of the timer is the time when the monitoring device receives the interrupt request; If the timing time is greater than or equal to the threshold, the monitoring device sends a non-maskable interrupt (NMI) request to the central processing unit (CPU). The NMI request is used to instruct the CPU to determine the exception context information corresponding to the delayed response to the interrupt request. The exception context information is included in the interrupt service routine (ISR) corresponding to the NMI request.
2. The method according to claim 1, characterized in that, The method further includes: If the interrupt number corresponding to the interrupt request matches the target interrupt number, the monitoring device starts the timer, wherein the target interrupt number is a predefined interrupt number of the interrupt that needs to be monitored.
3. The method according to claim 1 or 2, characterized in that, The timer ends at the moment when the interrupt request is responded to by the central processing unit.
4. The method according to claim 1 or 2, characterized in that, The exception context information includes at least one of the following: call stack information and scheduling trajectory information.
5. The method according to claim 1 or 2, characterized in that, The ISR also includes one or more of the following information: The interrupt number corresponding to the interrupt request, the threshold, and the timing time.
6. A method for troubleshooting, characterized in that, include: The central processing unit receives an interrupt request; The central processing unit receives a non-maskable interrupt (NMI) request from the monitoring device. The NMI request is sent by the monitoring device when the timer's duration is greater than or equal to a threshold, where the duration is the time during which the interrupt request is delayed. The central processing unit obtains the exception context information corresponding to the delayed response to the interrupt request from the interrupt service routine (ISR) corresponding to the NMI request.
7. The method according to claim 6, characterized in that, The exception context information includes at least one of the following: call stack information and scheduling trajectory information.
8. The method according to claim 6 or 7, characterized in that, The ISR also includes one or more of the following information: The interrupt number corresponding to the interrupt request, the threshold, and the timing time.
9. A fault handling apparatus, characterized in that, include: Transceiver unit and acquisition unit, The transceiver unit is used to receive interrupt requests; The acquisition unit is used to acquire the timing time of the timer, wherein the start time of the timer is the moment when the device receives the interrupt request; If the timing time is greater than or equal to the threshold, the transceiver unit is further configured to send a non-maskable interrupt (NMI) request to the central processing unit, wherein the NMI request is used to instruct the central processing unit to determine the exception context information corresponding to the delayed response to the interrupt request, and the exception context information is included in the interrupt service routine (ISR) corresponding to the NMI request.
10. The apparatus according to claim 9, characterized in that, The device also includes a start-up unit. If the interrupt number corresponding to the interrupt request is consistent with the target interrupt number, the startup unit is used to start the timer, wherein the target interrupt number is a predefined interrupt number of the interrupt that needs to be monitored.
11. The apparatus according to claim 9 or 10, characterized in that, The timer ends at the moment when the interrupt request is responded to by the central processing unit.
12. The apparatus according to claim 9 or 10, characterized in that, The exception context information includes at least one of the following: call stack information and scheduling trajectory information.
13. The apparatus according to claim 12, characterized in that, The ISR also includes one or more of the following information: The interrupt number corresponding to the interrupt request, the threshold, and the timing time.
14. A fault handling apparatus, characterized in that, include: Transceiver unit and processing unit, The transceiver unit is used to receive interrupt requests; The transceiver unit is also configured to receive a non-maskable interruption (NMI) request from a monitoring device. The NMI request is sent by the monitoring device when the timer's timing period is greater than or equal to a threshold, where the timing period is the time during which the interruption request is delayed. The processing unit is used to obtain the exception context information corresponding to the delayed response to the interrupt request from the interrupt service routine (ISR) corresponding to the NMI request.
15. The apparatus according to claim 14, characterized in that, The exception context information includes at least one of the following: call stack information and scheduling trajectory information.
16. The apparatus according to claim 14 or 15, characterized in that, The ISR also includes one or more of the following information: The interrupt number corresponding to the interrupt request, the threshold, and the timing time.
17. A communication apparatus, characterized in that, include: A processor for executing a computer program stored in a memory to cause the apparatus to perform the method as claimed in any one of claims 1 to 5, or to cause the apparatus to perform the method as claimed in any one of claims 6 to 8.
18. The apparatus according to claim 17, characterized in that, The device also includes the memory.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 5, or causes the computer to perform the method as described in any one of claims 6 to 8.
20. A computer program product, characterized in that, The computer program product includes instructions that, when executed by a computer device, cause the computer device to perform the method as described in any one of claims 1 to 5, or cause the computer device to perform the method as described in any one of claims 6 to 8.
Citation Information
Patent Citations
Interrupt latency performance counters
US20140115198A1
Method of Providing Timing Information for Interrupts
US20160124875A1
