A fault handling method and device based on Lockstep mode
By monitoring the instruction execution of multiple processor cores through initialization and clock synchronization in Lockstep mode, the problem of low fault recovery efficiency is solved, faster and more accurate fault recovery is achieved, and it is suitable for bit inversions caused by cosmic rays and other factors. Condition.
Patent Information
- Application Number
- CN202410788571.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-19
AI Technical Summary
The fault recovery method in the existing technology is inefficient. Especially in the case of bit reversal caused by factors such as cosmic rays and radiation, the possibility of rollback position errors is high, and the speed of obtaining synchronization programs from the memory is slow, which affects the system recovery efficiency.
By initializing the computer storage system in Lockstep mode and performing clock synchronization, an instruction distributor is constructed to receive and cache the instruction sequence, iteratively executes instruction monitoring and error checking, ensures that multiple processor cores execute instructions at the same starting point, and monitors and compares execution results. , if the instructions are cached consistently, if they are inconsistent, error detection and location are performed, and the instructions are rolled back to restore the system.
It achieves faster and more accurate fault recovery, reduces the amount of data, improves the timeliness and accuracy of fault recovery, avoids rollback position errors, and improves the recovery efficiency of the system in the event of a fault.
Smart Images

Figure CN118363798B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of computers and their reliability, and in particular to a fault handling method and device based on a Lockstep mode. Background Art
[0002] With the development of technology, the role of processors in equipment operation and management has become increasingly prominent, and at the same time, the complexity of calculations has become increasingly higher. In aerospace applications, factors such as cosmic rays and radiation may cause bit flips in hardware, leading to data corruption or calculation errors. Bit flip refers to the change of the value of one or more binary bits from 0 to 1 or from 1 to 0. Therefore, the requirements for the security and reliability of calculations are becoming more and more stringent. Lockstep can maintain the synchronous execution of multiple processors, execute the same instructions in the same clock, and improve the security and reliability of calculations.
[0003] Lockstep (core step lock) will stop the system from running when a fault or error occurs, thus achieving complete isolation. For general faults, the existing technology can restore the system to normal operation when a short-term error occurs during operation by rolling back the field data (system context status, register value, etc.). However, the data used by the field data comes from the register, which is itself an output data. In the case of a single particle flip, it is very likely that the output data itself is wrong, so it is very likely to cause the problem of rollback position error.
[0004] In addition, the on-site protection rollback requires re-obtaining the previous synchronization program from the memory based on the on-site data. However, the internal storage has high speed requirements, and the general clock cycle difference is: the access speed of L1 cache (first-level cache) is 4 CPU clock cycles, the access speed of L2 cache (second-level cache) is 11 CPU clock cycles, and the access speed of L3 cache (third-level cache) is 24 CPU clock cycles. The access speed of the memory is 167 CPU clock cycles, so the speed of obtaining the synchronization program from the memory is slow. Summary of the invention
[0005] The embodiment of the present application solves the problem of low efficiency of general fault recovery methods in the prior art by providing a fault handling method based on the Lockstep mode.
[0006] In a first aspect, an embodiment of the present application provides a fault handling method based on the Lockstep mode, comprising: initializing the storage system of a computer so that its initial operating state is the same, and performing clock synchronization; constructing an instruction distributor to receive and cache instructions to be executed to form an instruction sequence; iteratively executing instruction monitoring and error checking steps until exiting the Lockstep mode; wherein the instruction monitoring and error checking steps include: sending the instruction sequence to multiple processor cores in sequence and at the same time, and the multiple processor cores receive the instruction sequence and execute it from the same starting point at the same time; monitoring the process of multiple processor cores executing the instruction sequence to obtain status monitoring data; comparing the current instructions and / or execution results of the multiple processor cores according to a comparison strategy; if the current instruction is consistent with the execution result, caching the current instruction; if the current instruction and / or the execution result are inconsistent, performing error detection, and using the status monitoring data to locate the error; if the result of the error detection is a general error, rolling back the instruction, updating the instruction sequence, and executing the instruction monitoring and error checking steps; if the result of the error detection is a serious error, setting an error flag, exiting the Lockstep mode, and performing an error handling operation.
[0007] In combination with the first aspect, in a possible implementation, the storage system of the computer is initialized so that its initial operating state is the same, including: configuring the clock frequency of the system based on the application scenario; and / or setting the comparison strategy of the processor core, and setting the initial ratio of the comparison strategy based on the application scenario; and / or defining error types, error checking, error location and error handling operations, and configuring the status monitoring software of the processor core.
[0008] In combination with the first aspect, in a possible implementation, the clock synchronization includes: frequency modulating the clock until the clock frequency is synchronized; phase locking the clock to stabilize the frequency and phase of the clock; and outputting the frequency modulated and phase locked clock to each of the processor cores to achieve clock synchronization.
[0009] In combination with the first aspect, in a possible implementation method, if the current instruction and / or the execution result are inconsistent, error detection is performed, including: if the current instruction is inconsistent, the instruction distributor is ordered to redistribute the instruction, and when the instruction is redistributed more than a threshold number of times, it is a serious error; if the execution result is inconsistent, the instruction executor is tested according to the executed current instruction, if the test passes, it is a general error, if the test fails, it is a serious error.
[0010] In combination with the first aspect, in a possible implementation method, if the current instruction and / or the execution result are inconsistent, error detection is performed, and after the error is located using the status monitoring data, it also includes: saving error detection information and error location information, and triggering a processor interrupt; obtaining and saving current information based on the processor interrupt.
[0011] In combination with the first aspect, in a possible implementation method, the comparison strategy includes: comparing the current instructions of multiple processor cores with the execution results according to an initial ratio to obtain a first comparison result; wherein the initial ratio is the ratio of the number of comparisons of the current instructions to the number of comparisons of the execution results; when the continuous time that the first comparison result is consistent reaches a first threshold time, the initial ratio is enlarged to a second ratio.
[0012] In combination with the first aspect, in a possible implementation, the comparison strategy also includes: comparing the current instructions of the multiple processor cores with the execution results according to the second ratio to obtain a second comparison result; if the second comparison result is consistent for a continuous time exceeding a second threshold time or the second comparison result is inconsistent, regressing the second ratio to the initial ratio; wherein the second threshold time is longer than the first threshold time.
[0013] In combination with the first aspect, in one possible implementation, the error handling operation includes: lowering the system security level according to the error flag and restricting access to critical resources; and / or recording error logs and saving system critical information; wherein the system critical information includes system status, logs and user data; and / or initiating an emergency handling process and switching to a backup processor core.
[0014] In the second aspect, the embodiment of the present application provides a fault handling device based on the Lockstep mode, including: an initialization module, used to initialize the storage system of the computer so that its initial operating state is the same, and to perform clock synchronization; a construction module, used to construct an instruction distributor to receive and cache instructions to be executed to form an instruction sequence; an instruction monitoring and error checking module, used to iteratively execute instruction monitoring and error checking steps until the Lockstep mode is exited; wherein, the instruction monitoring and error checking steps include: sending the instruction sequence to multiple processor cores in sequence at the same time, and the multiple processor cores receive the instruction sequence and execute it from the same starting point at the same time; monitoring The state monitoring data is obtained during the process of executing the instruction sequence by multiple processor cores; the current instructions and / or execution results of the multiple processor cores are compared according to the comparison strategy; if the current instructions are consistent with the execution results, the current instructions are cached; if the current instructions and / or the execution results are inconsistent, error detection is performed, and the error is located using the state monitoring data; if the result of the error detection is a general error, the instruction is rolled back, the instruction sequence is updated, and the instruction monitoring and error checking steps are performed; if the result of the error detection is a serious error, an error flag is set, the Lockstep mode is exited, and an error handling operation is performed.
[0015] In the third aspect, an embodiment of the present application provides a device for executing a fault handling method based on the Lockstep mode, the device comprising: a processor; a memory for storing processor executable instructions; when the processor executes the executable instructions, it implements the method described in the first aspect or any possible implementation method of the first aspect.
[0016] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0017] The embodiment of the present application can ensure that different processor cores are in the same state at the beginning of operation by initializing and synchronizing the clock; send the instruction sequence to multiple processor cores in sequence and at the same time, which can ensure that different processor cores execute the same instruction at the same time; locate the error position and identify the error type through status monitoring data; and restore the system operation in time by rolling back instructions. This effectively solves the problem of low efficiency of general fault recovery methods in the prior art, and thus realizes a more timely, less data-saving, and more accurate general fault recovery method, which can restore the system operation in time after a general fault occurs in the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flowchart of a fault handling method based on the Lockstep mode provided in an embodiment of the present application;
[0020] Figure 2 A schematic diagram of the structure of a fault handling device based on the Lockstep mode provided in an embodiment of the present application;
[0021] Figure 3 A schematic diagram of a unit module for performing clock synchronization provided in an embodiment of the present application;
[0022] Figure 4 A schematic diagram of the structure of the instruction distributor and the processor core provided in the embodiment of the present application;
[0023] Figure 5 A schematic diagram of the structure of the monitoring system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] The following describes some of the techniques involved in the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.
[0026] Figure 1 is a flowchart of a fault handling method based on the Lockstep mode provided in an embodiment of the present application, including steps 101 to 112. Among them, Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of a fault handling method based on the Lockstep mode. If the final result can be achieved, Figure 1 The steps shown may be performed in parallel or reversed.
[0027] Step 101: Initialize the computer's storage system so that its initial operating state is the same, and perform clock synchronization. In the embodiment of the present application, after the system is powered on, the multiple processor cores (two processor cores or multiple processor cores when a multi-mode design is adopted) in the system are first initialized to ensure that all processor cores are in the same state at the beginning of operation. This application takes two processor cores as an example, and those skilled in the art should be aware that this is not intended to limit the scope of protection of this application, and those skilled in the art may also apply the method of this application to multiple (two or more) processor cores.
[0028] Perform hardware initialization. Specifically, initialize registers and set initial values for them.
[0029] Exemplarily, for general registers, it is a register used to perform arithmetic and logical operations. When the system starts, the general register is cleared or set to a specific initial value (for example, a non-zero status value, parameter value, constant, specific address, offset, etc.) to prevent residual data from affecting subsequent program execution. For the link register, it is used to store the return address after the function call or jump instruction. During the initialization phase, it is set to a safe or default address to prevent the program from jumping to the wrong location at startup. For the program counter register, it is used to store the address of the instruction currently to be executed. When the system starts, it is set to the memory address containing the startup code (such as the boot loader). For the floating-point register, it is used to perform floating-point operations. Similar to the general register, it is cleared or set to an initial value (such as a preset constant, threshold, or the starting point of a certain calculation) during initialization. For the status register, it is used to store the status information of the processor (such as the interrupt enable flag, processor mode, etc.), and when the system starts, it is configured to the appropriate initial state (for example, processor mode, interrupt enable flag, flag bit, reserved bit, etc.).
[0030] Initialize the cache and set its configuration parameters. The configuration parameters include the cache's working mode, memory size, line size, and replacement strategy. Specifically, initialize the cache and set the cache enable at startup so that the cache can start caching data in the main memory to increase the processor's access speed. The cache enable includes enable or disable.
[0031] The working mode of the cache is set to match the system requirements. The working modes of the cache include write-back mode and write-through mode. The working mode of the cache determines how it interacts with the main memory. This application is exemplarily set to write-back mode.
[0032] Configure the memory size, line size, and replacement policy of the cache. Among them, the memory size is a measure of the amount of data that the cache can store, usually expressed in bytes (B), kilobytes (KB), megabytes (MB), or larger units. The choice of memory size depends on system requirements, including expected data access patterns and performance requirements. This application is exemplarily set to 64KB (kilobytes). The line size is the smallest unit used to store data in the cache. Typically, the processor reads the entire cache line when reading data from the main memory, even if only a portion of the data in the cache line is requested. Therefore, the choice of line size affects the efficiency of memory access and bandwidth utilization. This application exemplarily sets the line size to 64B (bytes). The replacement policy determines which data blocks should be replaced when the cache is full and new data needs to be stored. Replacement strategies include the least recently used strategy (Least Recently Used, abbreviated as: LRU), the first in first out strategy (FIFO), the least frequently used strategy (LFU), the random replacement strategy (Random), etc. This application exemplarily adopts the least frequently used strategy.
[0033] In addition, those skilled in the art may also initialize the tag and data RAMs of the cache and clear these RAMs to zero to ensure that the cache does not contain any invalid data before the processor starts executing the code.
[0034] Check memory resources and establish memory mapping. Specifically, at the beginning of system startup, the size and distribution of memory resources will be detected first, and then divided into different areas (such as data area, stack area, etc.) as needed. Set up a memory mapping table to map the contents of files or devices to the address space of the process, that is, to map physical memory to virtual address space to increase data access speed. In addition, when setting up the memory mapping table, those skilled in the art can also set the permissions of the memory mapping table (such as read-only, read-write, etc.).
[0035] In addition, in the embodiments of the present application, the clock frequency of the system can be configured based on the application scenario. Specifically, to adapt to different application scenarios, for example, considering power consumption and reliability issues, the frequency is generally set lower; considering execution rate issues, the frequency is generally set higher; according to the application scenario, the specific frequency division, spread spectrum or non-operation frequency can be set through software.
[0036] Set the comparison strategy of the processor core, and set the initial ratio of the comparison strategy based on the application scenario. Specifically, set the comparison strategy between the current instructions and the execution results of multiple processor cores. For example, in application scenarios with general safety and reliability requirements, the comparison strategy can be set to compare only the execution results or only the current instructions. For application scenarios with high safety and reliability requirements, the current instructions and execution results can be set for joint comparison, and the initial ratio can be set, that is, the ratio of the number of comparisons of the current instructions to the number of comparisons of the execution results. Exemplarily, the initial ratio can be set to 5:1, that is, the execution results are compared once for every five comparisons of the current instructions. For application scenarios with very high safety and reliability requirements, both the current instructions and the execution results are compared, that is, the current instructions and the execution results are compared once for each instruction executed. At this time, the initial ratio is 1:1.
[0037] It should be noted that the initial ratio set here is only an embodiment of the present application and is not intended to limit the scope of protection of the present application. The initial ratio can also be set to 8:1, 10:1, etc. Those skilled in the art can set the initial ratio according to specific application scenarios or actual needs.
[0038] Define error types, error checking, error location, and error handling operations, and configure the status monitoring software of the processor core. Exemplarily, the error types include general errors and severe errors.
[0039] In the embodiment of the present application, the errors that the Lockstep system may encounter are defined, such as data inconsistency, hardware failure, etc. Then, error checking is added to the system to determine whether an error will occur by comparing the input data and / or output results of different processor cores. When an error occurs, the error is located according to the log file and the status monitoring data, and the error type is determined, and finally the corresponding error handling operation is adopted.
[0040] In the embodiment of the present application, the unit module for clock synchronization is as follows: Figure 3 As shown, clock synchronization is performed specifically as follows.
[0041] The clock is modulated until the clock frequency is synchronized. Specifically, frequency modulation includes spread spectrum and frequency division. On the one hand, spread spectrum is to disperse the spectrum energy of the clock signal into a certain spectrum range through the clock management unit, reduce the peak energy, thereby reducing EMI (English full name: Electromagnetic Interference) radiation, and can also reduce the bit error rate, improve the signal transmission quality, etc., indirectly improving the accuracy and stability of clock synchronization. Spread spectrum includes downward spread spectrum, center spread spectrum or upward spread spectrum, among which downward spread spectrum is more widely used in practical applications. The degree of spread spectrum can be adjusted by the expansion rate (the ratio of the expansion frequency to the original CLK frequency). Those skilled in the art should know that too large an expansion rate will affect system performance.
[0042] On the other hand, if the original clock frequency is too high, the clock management unit will divide it down to generate a lower frequency clock signal suitable for the processor core operation.
[0043] The clock is phase-locked to stabilize the frequency and phase of the clock. Specifically, in the clock management unit, PLL (Phase-Locked Loop) is a key component. PLL compares the input clock signal from the clock system with the clock signal generated by the internal oscillator, adjusts the frequency and phase of the internal oscillator, synchronizes the output clock signal with the input clock signal, effectively filters out noise and jitter in the input clock signal, and improves the stability and accuracy of the clock signal.
[0044] The frequency modulated and phase locked clock is output to each processor core to achieve clock synchronization. Specifically, after completing the frequency modulation and phase locking process, the clock management unit will output the generated stable and accurate clock signal to each processor core. This ensures that the clock signal received by each processor core has the same frequency and phase, and can achieve complete synchronization of the clocks of different processor cores, which helps to ensure the consistency and accuracy of data transmission and processing between various modules inside the processor.
[0045] Step 102: construct an instruction distributor to receive and cache instructions to be executed to form an instruction sequence. Figure 4 As shown, an instruction distributor is constructed to receive and cache the instructions to be executed from the bus, and the instruction distributor stores the instructions to be executed into the instruction sequence according to the time when the instructions are received. It should be noted that an instruction cache is set in the instruction distributor, and once there is free space in the instruction cache, the next instruction to be executed is obtained and stored in the instruction sequence.
[0046] It should be noted that the number of instructions that can be stored in the instruction cache of the instruction sequence in the present application should be greater than the value of the second ratio.
[0047] Step 103: Send the instruction sequence to multiple processor cores in sequence and at the same time, and the multiple processor cores execute the instruction sequence from the same starting point at the same time after receiving the instruction sequence. In an embodiment of the present application, when ready, the instruction sequence is sent to multiple processor cores at the same time. The instruction distributor needs to ensure the consistency of the sending order and time of the instructions, so that the two processors can start execution in the same order and time, and ensure that different processor cores execute the same instructions at the same time. Exemplarily, the above "when ready" means that the instruction is decoded into an instruction form that the processor can understand and execute, and / or the dependent instructions of the current instruction have been executed, and / or the resources required to execute the current instruction have been allocated.
[0048] After receiving the instruction sequence, the two processor cores start executing from the same starting point at the same time. The precise clock synchronization mechanism enables the two processor cores to execute the same instructions at the same time and access the same memory address, registers and IO devices at the same time, producing the same execution results.
[0049] Step 104: Monitor the process of multiple processor cores executing instruction sequences to obtain status monitoring data. In the embodiment of the present application, during the instruction execution process, the status of the two processors is continuously monitored, including register values, memory access, etc. The status of the processor executing each instruction is monitored to obtain status monitoring data, and the status monitoring data is transmitted to the monitoring system in real time for comparison and analysis. The relationship between the monitoring system and the processor core is shown in the figure below. Figure 5 As shown, the monitoring system includes caching, result comparison, error detection, error location and error handling operations.
[0050] Step 105: Compare the current instructions and / or execution results of multiple processor cores according to the comparison strategy. In an embodiment of the present application, the comparison strategy includes: comparing the current instructions and execution results of multiple processor cores according to an initial ratio to obtain a first comparison result. The initial ratio is the ratio of the number of comparisons of the current instructions to the number of comparisons of the execution results. When the continuous time that the first comparison result is consistent reaches a first threshold time, the initial ratio is enlarged to a second ratio. Compare the current instructions and execution results of multiple processor cores according to the second ratio to obtain a second comparison result. If the continuous time that the second comparison result is consistent exceeds the second threshold time or the second comparison result is inconsistent, the second ratio is regressed to the initial ratio. The second threshold time is longer than the first threshold time.
[0051] It should be noted that, according to step 102, the number of instructions that can be stored in the instruction cache of the instruction sequence should be greater than the value of the second ratio, and the value of the second ratio is greater than the value of the initial ratio, then the number of instructions that can be stored in the instruction cache of the instruction sequence must also be greater than the value of the initial ratio. Exemplarily, for example, if the initial ratio is 5:1, the second ratio must be greater than the initial ratio, and is set to 10:1, then at least 10 instructions can be stored in the instruction sequence, and the number of instructions between the current instruction and the first instruction in the instruction sequence (the earliest instruction stored in the instruction sequence) is greater than the value of the second ratio minus one (here at least nine instructions are spaced apart), so that when the current instructions of multiple processor cores are inconsistent, when the instruction distributor redistributes the instructions before the current instruction, it can trace back to the instructions before the current instruction in the instruction sequence that have the same comparison result.
[0052] In an embodiment of the present application, the comparison includes current instruction comparison and / or execution result comparison. Due to single particle flip or magnetic field interference caused by factors such as rays and radiation, the instructions that are distributed consistently will be inconsistent after arriving at the processor. The current instruction comparison, for example, monitors whether the next instructions executed by the two processor cores are consistent, and compares them by bitwise XOR. After each current instruction is executed, the execution results of the two processors are compared, and the execution result comparison can be achieved by bitwise XOR register values. Finally, the comparison result is obtained based on the comparison of the next instruction and / or the execution result.
[0053] Step 106: Determine whether the current instruction and the execution result are consistent. In the embodiment of the present application, when the current instructions of multiple processor cores are consistent, it can be recorded as zero, and when the current instructions are inconsistent, it can be recorded as non-zero. Those skilled in the art should be aware that the instruction sequences executed by multiple processor cores are completely consistent, so when comparing the current instruction here, it can also be modified to compare the next instruction of the current instruction.
[0054] When the execution results of multiple processor cores are consistent, it can be recorded as zero, and when the execution results are inconsistent, it can be recorded as non-zero. If the current instructions and execution results of multiple processor cores are consistent, step 107 is executed, otherwise steps 108 to 109 are executed.
[0055] Step 107: Cache the current instruction. Specifically, only when the current instructions of multiple processor cores are consistent with the execution results, the current instruction is cached, and the cache depth, position, etc. can be set. In order to roll back the instruction according to the current instruction stored in the cache when a general error occurs.
[0056] Step 108: Perform error detection and use the status monitoring data to locate the error. In an embodiment of the present application, if the current instructions and / or execution results of multiple processor cores are inconsistent, error detection is performed. Specifically, the inconsistency of the current instructions of multiple processor cores may be a hardware failure, such as electromagnetic interference (EMC), radiation, clock drift, low voltage, etc. It may also be a software error. There may be bugs in the operating system or application software, which may cause different processor cores to receive different instructions or data. It may also be that the synchronization mechanism fails, such as the clock signal is not synchronized or the bus communication delay is inconsistent, resulting in deviations when different processor cores execute instructions.
[0057] Inconsistent execution results of multiple processor cores may be caused by hardware failure, software error or external interference.
[0058] In the embodiment of the present application, if the current instruction is inconsistent, the instruction distributor is instructed to redistribute the instruction, and if the number of times the instruction is redistributed exceeds a threshold, it is a serious error. The threshold number here is equal to the value of the second ratio.
[0059] If the execution results are inconsistent, the instruction executor is tested according to the executed instructions. If the test passes, it is a general error. If the test fails, it is a serious error. The error location and error cause are determined based on the status monitoring data.
[0060] Exemplarily, if the execution results of multiple processor cores are inconsistent and the current instruction being executed is an addition instruction, the addition instruction executor of each processor core is tested separately. If the execution results obtained are still inconsistent, it is an addition instruction executor failure, which is a serious error.
[0061] In addition, the present application can also save error detection information and error location information, and trigger a processor interrupt. Based on the processor interrupt, the current information is obtained and saved. Specifically, the specific error location and cause are located using the status monitoring data and cache log. After the error detection and location are completed, the detection and location information is saved and the processor interrupt is triggered, and the current information is obtained in the interrupt software to save the status information and analyze the status information.
[0062] Furthermore, when an error occurs, the instruction executor will write the relevant information into the error register. Those skilled in the art should know that the process of writing the relevant information into the error register is automatically completed by hardware to ensure that the error information has been safely saved before the processor interrupt is triggered. Once the error is detected and located, the instruction executor will send an interrupt request to the processor, which is usually a specific signal or level change to notify the processor that an error has occurred. In addition, different errors may have different interrupt priorities. The processor will determine the order of response based on the interrupt priority. The saved current information is used for subsequent analysis and troubleshooting, and can also resume execution after the interrupt processing is completed.
[0063] Step 109: Determine whether the result of the error detection is a serious error. Specifically, determine whether it is a serious error or a general error according to the result of the error detection in step 108. If it is a serious error, execute step 112; if it is a general error, execute step 110.
[0064] Step 110: Is it safe to exit Lockstep mode? In the embodiment of the present application, when the Lockstep task is completed and the Lockstep mode is no longer needed, the Lockstep mode can be safely exited. Stop the instruction distribution and synchronization mechanism, release the relevant resources, and restore the normal operation state of the processor. When the task is not completed and the Lockstep task needs to be continued, step 111 is executed.
[0065] Step 111: Roll back the instruction and update the instruction sequence. In an embodiment of the present application, when a general failure occurs in the system but the Lockstep task has not been completed, the instruction is rolled back. Specifically, the instruction information of the last execution is obtained from the last synchronization point or cache. Undo or reverse all state changes of the system since the last instruction was executed, including the state of the processor core, the state of the memory, etc. Then, re-execute the last instruction to ensure that the system state returns to the state after the last instruction was executed. Finally, verify the execution result after rolling back the instruction to ensure that the states of different processor cores are consistent. After the rollback is successful, update the instruction sequence and continue to execute the remaining instructions in the instruction sequence, that is, execute steps 103 to 106.
[0066] It should be noted that it is necessary to ensure that the states of different processor cores before and after the instruction rollback are consistent to avoid further error propagation.
[0067] Here, by using the rollback instruction, the system state can be restored using only less data, which is less than the amount of data used for rollback using field data (system context state, register value, etc.) in the prior art. In addition, the data used for field protection comes from the register, which is itself an output data. In the case of a single particle flip, it is very likely that the output data itself is wrong, so it is very likely to cause the problem of rollback position error. When a general fault occurs. The instruction-based rollback method can directly distribute the previous synchronization instruction by the instruction distributor, while the field protection rollback needs to re-acquire the previous synchronization program from the memory based on the field data, but the internal storage has high speed requirements, and the speed of obtaining the synchronization program from the program memory will be much slower. The instruction distributor of the present application is designed inside the CPU, and the synchronization instruction can be obtained in one or two CPU clock cycles, so the response speed is faster.
[0068] It should be noted that the instruction distributor in the present application is designed inside the CPU. Those skilled in the art can also design it to be tightly integrated with the CPU based on the inventive concept of the present application to reduce the distance and delay of data transmission and further improve the speed of instruction distribution.
[0069] Step 112: Set an error flag, exit Lockstep mode, and perform error handling operations. In an embodiment of the present application, an error flag is set if it is a serious error. Exemplarily, the error flag can be in the form of a level or a register. Due to a serious error that causes the system to no longer participate in the Lockstep operation or different processor cores to no longer execute the same instruction, the system will automatically exit Lockstep mode to prevent the fault from spreading to the entire system and perform error handling operations.
[0070] In the embodiment of the present application, the error handling operation includes: reducing the system security level according to the error flag, limiting access to key resources. And / or recording error logs, and saving system key information. Among them, the system key information includes system status, logs and user data. And / or starting an emergency handling process and switching to a backup processor core.
[0071] Those skilled in the art should be aware that there are two situations for exiting the Lockstep mode in this application: one is to complete the Lockstep task and exit the Lockstep mode safely; the other is to exit the Lockstep mode passively to prevent the spread of the fault. Among them, step 110 belongs to the safe exit of the Lockstep mode, and step 112 is the passive exit of the Lockstep mode.
[0072] In addition, the system status can be cleaned and reset, including clearing status monitoring data, cache logs, etc., to ensure that the system is restored to the initial state before the Lockstep operation so as to facilitate the next Lockstep operation or other tasks.
[0073] Although the present application provides method operation steps such as embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in this embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order of the method shown in this embodiment or the accompanying drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).
[0074] like Figure 2 As shown, the embodiment of the present application also provides a fault handling device 200 based on the Lockstep mode. The device includes: an initialization module 201, a construction module 202 and an instruction monitoring and error checking module 203, as follows.
[0075] The initialization module 201 is used to initialize the storage system of the computer to make its initial operating state the same and perform clock synchronization.
[0076] The construction module 202 is used to construct an instruction distributor to receive and cache instructions to be executed to form an instruction sequence.
[0077] The instruction monitoring and error checking module 203 is used to iteratively execute the instruction monitoring and error checking steps until the Lockstep mode is exited. Among them, the instruction monitoring and error checking steps include: sending the instruction sequence to multiple processor cores in sequence at the same time, and the multiple processor cores receive the instruction sequence and execute it from the same starting point at the same time. The process of monitoring the execution of the instruction sequence by multiple processor cores is obtained by state monitoring data. The current instructions and / or execution results of multiple processor cores are compared according to the comparison strategy. If the current instruction and the execution result are consistent, the current instruction is cached. If the current instruction and / or the execution result are inconsistent, error detection is performed, and the error is located using the state monitoring data. If the result of the error detection is a general error, the instruction is rolled back, and the instruction sequence is updated, and the instruction monitoring and error checking steps are performed. If the result of the error detection is a serious error, an error flag is set, the Lockstep mode is exited, and an error handling operation is performed.
[0078] Some modules in the apparatus described in the present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0079] The devices or modules described in the above application embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.
[0080] The methods, devices or modules described in this application can be implemented in the form of computer-readable program codes. The controller can be implemented in any appropriate manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program codes (such as software or firmware) that can be executed by the (micro)processor, logic gates, switches, application-specific integrated circuits (English: Application Specific Integrated Circuit; Abbreviation: ASIC), programmable logic controllers and embedded microcontrollers. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program codes, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included in it for implementing various functions can also be regarded as structures within the hardware component. Or even, the means for realizing various functions may be regarded as both a software module for realizing the method and a structure within a hardware component.
[0081] An embodiment of the present application also provides a device for executing a fault handling method based on the Lockstep mode, the device comprising: a processor; a memory for storing processor executable instructions; when the processor executes the executable instructions, the method described in the embodiment of the present application is implemented.
[0082] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist independently, or two or more modules may be integrated into one module.
[0083] The above storage media include but are not limited to random access memory (RAM), read-only memory (ROM), cache, hard disk drive (HDD) or memory card. The memory can be used to store computer program instructions.
[0084] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on this understanding, the technical solution of the present application can be essentially or partly reflected in the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0085] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.
[0086] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.
Claims
1. A fault handling method based on Lockstep mode, characterized in that: include: Initialize the computer's storage system to make them in the same initial operating state and synchronize the clocks; Constructing an instruction distributor to receive and cache instructions to be executed to form an instruction sequence; Iteratively executing the instruction monitoring and error checking steps until exiting the Lockstep mode; wherein the instruction monitoring and error checking steps include: The instruction sequence is sent to multiple processor cores in sequence and at the same time, and the multiple processor cores receive the instruction sequence and execute it from the same starting point at the same time; Monitoring the process of executing the instruction sequence by the plurality of processor cores to obtain status monitoring data; Compare the current instructions and / or execution results of the plurality of processor cores according to the comparison strategy; if the current instructions and the execution results are consistent, cache the current instructions; if the current instructions and / or the execution results are inconsistent, perform error detection, and use the status monitoring data to locate the errors; If the result of the error detection is a general error, the instruction is rolled back, and the instruction sequence is updated, and the instruction monitoring and error checking steps are executed; If the result of the error detection is a serious error, an error flag is set, the Lockstep mode is exited, and an error handling operation is performed.
2. The method according to claim 1, characterized in that Initializing the storage system of the computer to make its initial operating state the same includes: Configure the system clock frequency based on the application scenario; and / or Setting the comparison strategy of the processor core, and setting an initial ratio of the comparison strategy based on the application scenario; and / or Error types, error checking, error location, and error handling operations are defined, and status monitoring software for the processor core is configured.
3. The method according to claim 1, characterized in that The clock synchronization comprises: Modulate the clock frequency until the clock frequency is synchronized; Phase-lock the clock to stabilize the frequency and phase of the clock; The frequency modulated and phase locked clock is output to each of the processor cores to achieve clock synchronization.
4. The method according to claim 1, characterized in that: If the current instruction and / or the execution result are inconsistent, error detection is performed, including: If the current instructions are inconsistent, the instruction distributor is instructed to redistribute instructions, and a serious error occurs when the number of times the instructions are redistributed exceeds a threshold; If the execution results are inconsistent, the instruction executor is tested according to the current instruction executed. If the test passes, it is a general error; if the test fails, it is a serious error.
5. The method according to claim 1, characterized in that If the current instruction and / or the execution result are inconsistent, error detection is performed, and after the error is located using the status monitoring data, the method further includes: Save error detection information and error location information, and trigger processor interrupt; Acquires and saves current information based on processor interrupts.
6. The method according to claim 1, characterized in that The comparison strategy includes: Comparing the current instructions of the plurality of processor cores with the execution results according to an initial ratio to obtain a first comparison result; wherein the initial ratio is a ratio of the number of comparisons of the current instructions to the number of comparisons of the execution results; When the continuous time during which the first comparison result is consistent reaches a first threshold time, the initial ratio is enlarged to a second ratio.
7. The method according to claim 6, characterized in that The comparison strategy also includes: Comparing the current instructions of the plurality of processor cores with the execution results according to the second ratio to obtain a second comparison result; If the second comparison result is consistent for a continuous time exceeding a second threshold time or the second comparison result is inconsistent, the second ratio is regressed to the initial ratio; wherein the second threshold time is longer than the first threshold time.
8. The method according to claim 1, characterized in that The error handling operation includes: Reducing the system security level according to the error flag to restrict access to key resources; and / or Record error logs and save key system information; wherein the key system information includes system status, logs and user data; and / or Initiate emergency response procedures and switch to the backup processor core.
9. A fault handling device based on Lockstep mode, characterized in that: include: An initialization module, used to initialize the storage system of the computer to make its initial operating state the same and perform clock synchronization; A construction module is used to construct an instruction distributor to receive and cache instructions to be executed to form an instruction sequence; The instruction monitoring and error checking module is used to iteratively execute the instruction monitoring and error checking steps until the Lockstep mode is exited; wherein the instruction monitoring and error checking steps include: The instruction sequence is sent to multiple processor cores in sequence and at the same time, and the multiple processor cores receive the instruction sequence and execute it from the same starting point at the same time; Monitoring the process of executing the instruction sequence by the plurality of processor cores to obtain status monitoring data; Compare the current instructions and / or execution results of the plurality of processor cores according to the comparison strategy; if the current instructions and the execution results are consistent, cache the current instructions; if the current instructions and / or the execution results are inconsistent, perform error detection, and use the status monitoring data to locate the errors; If the result of the error detection is a general error, the instruction is rolled back, and the instruction sequence is updated, and the instruction monitoring and error checking steps are executed; If the result of the error detection is a serious error, an error flag is set, the Lockstep mode is exited, and an error handling operation is performed.
10. A device for executing a fault handling method based on Lockstep mode, characterized in that: include: processor; a memory for storing processor-executable instructions; When the processor executes the executable instructions, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Main processor error detection using checker processors
CN109891393A
Method and device for processing problem of downtime caused by memory error report, equipment and medium
CN116893923A
Assembly line reinforcing method and system based on dual-core lockstep processor
CN117687846A
Using transactional execution for reliability and recovery of transient failures
US20150212906A1
Apparatus and method for increasing resilience to faults
US20190121689A1
