Data cache fault-tolerant method and system based on reliability-aware dirty line redundancy backup
By employing reliability-aware dirty row redundancy backup and interleaved parity checking in the data cache of the aerospace processor, the data error problem of the cache under space radiation environment is solved, the reliability and stability of the data cache are achieved, and the hardware complexity is reduced.
Patent Information
- Application Number
- CN202611636984.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-22
- Publication Date
- 2026-11-20
AI Technical Summary
In the space radiation environment, the high-speed cache of aerospace processors is susceptible to single-event upsets, which can lead to data errors. Existing cache fault-tolerance technologies suffer from data loss and high hardware complexity.
A reliability-aware dirty row redundancy backup method is adopted, which backs up dirty rows in the data cache through backup cache, and combines interleaved parity check for error detection and correction, selectively writes back to main memory, and reduces hardware complexity.
It improves the reliability of data caching, avoids data loss, reduces hardware implementation complexity, and enhances the stability of aerospace processors in space radiation environments with limited backup cache resources.
Smart Images

Figure CN123138034A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data caching technology, and in particular to a data caching fault-tolerant method and system based on reliability-aware dirty row redundancy backup. Background Technology
[0002] Processors used in aerospace and other space radiation environments are susceptible to various single-event effects (SEE) due to cosmic rays and high-energy particle radiation, which can lead to system failure. With the continuous development of integrated circuits, process technology has entered the nanometer scale, resulting in an increasing number of transistors integrated on a single device. The shrinking size and decreasing operating voltage of electronic components significantly increase their susceptibility to SEE, with typical SEE effects including single-event transients and single-event upsets. Furthermore, the increasing computing power of integrated circuits places higher demands on circuit reliability, leading to the wider application of hardening techniques.
[0003] As space missions place increasingly higher demands on processor computing performance and reliability, aerospace processors not only need to possess efficient data processing capabilities but also need to operate stably for extended periods in complex space environments. Cache memory, as a key component of modern processor architecture, effectively reduces the latency of processor accessing main memory by leveraging the locality of access characteristic of program access, significantly improving overall system performance. Therefore, cache systems are widely used in various high-performance aerospace processors.
[0004] However, since cache typically occupies a large proportion of the processor chip area—research indicates that the cache structure occupies more than half of the total processor area—it becomes one of the functional modules most susceptible to soft errors in the harsh space environment. Because the overall reliability of a system is often limited by its least reliable component, improving the fault tolerance and reliability of the cache system is crucial for ensuring the stable operation of aerospace processors in the harsh space environment.
[0005] In the space radiation environment, high-energy particles can cause single-event upsets (SEUs) in the processor's internal memory cells, leading to cache data errors or even system anomalies. Existing cache reliability enhancement methods mainly employ error checking and correcting codes (ECC), but these methods typically involve long combined logic paths, resulting in increased access latency and reduced processor performance.
[0006] Some studies have proposed detection and fault tolerance devices for multi-bit data flip errors in embedded microprocessor caches, employing a BCH encoding verification mechanism. Other studies have proposed a cache fault tolerance mechanism for embedded processors, based on parity checking and combined with exception handling to achieve cache fault tolerance. However, after the aforementioned BCH encoding verification and parity checking detect errors and invalidate the cache line, it needs to be reloaded from main memory. Currently, most CPU caches adopt a write-back strategy, and there is no backup of dirty lines in main memory. This may lead to the loss of the latest data in the cache, resulting in incorrect final calculation results.
[0007] Furthermore, existing cache replacement strategies, such as pseudo-FIFO (First In First Out), select replacement objects based on a circular pointer, which cannot distinguish the risk and write-back cost of each cached data. LRU (Least Recently Used, a commonly used page replacement algorithm) mainly considers the strategy of locality. Recently accessed data may be retained for a long time, but frequent access does not mean that the data is safe. Summary of the Invention
[0008] To address the aforementioned issues, this invention proposes a data caching fault tolerance method and system based on reliability-aware dirty row redundant backup. This method enables reliability-aware backup management under limited backup cache storage resources, eliminating the need to maintain a strict cache line order. It selects write-back objects based on the reliability risk level while reducing hardware implementation complexity.
[0009] To achieve the above objectives, the present invention adopts the following technical solution: In a first aspect, the present invention provides a data caching fault tolerance method based on reliability-aware dirty redundancy backup, comprising: Back up the dirty rows in the data cache and write them to the backup cache; In response to a cache access command, perform a cache access operation on the data cache and determine whether the backup cache is full; If the backup cache is not full, a backup cache line is allocated in the backup cache to back up the data to be written; If the backup cache is full, select the backup cache line to be replaced in the backup cache, write the cache data corresponding to the backup cache line to be replaced back to main memory, and then write the data to be written at the corresponding address in the data cache and the backup cache. The process of selecting a backup cache line to be replaced includes: using a circular replacement pointer to determine a local candidate region that includes multiple candidate backup cache lines; determining the reliability risk level based on the historical error status, number of write operations, and dirty state residence time of the candidate backup cache lines; and selecting the candidate backup cache line with the lowest reliability risk level as the backup cache line to be replaced.
[0010] As an optional implementation, the historical error status indicates whether the dirty line corresponding to the current candidate backup cache line has a data error or a marking error during the current residency period; if an error occurs and is recovered from the backup cache, the historical error status is set to 1; The write operation count represents the cumulative number of data modifications that the dirty row corresponding to the current candidate backup cache row has undergone while it has not yet been written back to main memory; The dirty state residency time represents the duration of the dirty state of the current candidate backup cache line before it has been written back to main memory.
[0011] As an alternative implementation method, the process of determining the reliability risk level includes: When the historical error status of a candidate backup cache line is 1, it is determined to be a high-risk cache line; When the historical error status is not 1, but the number of write operations is greater than or equal to the preset threshold, it is judged as a medium-to-high risk cache line; When the historical error status is not 1 and the number of write operations is less than the preset number threshold, but the dirty state residence time is greater than or equal to the preset time threshold, it is judged as a medium-risk cache line. Otherwise, it is judged as a low-risk cache line.
[0012] As an alternative implementation, after completing the replacement of an entry in the backup cache and the backup of a new dirty line, the circular replacement pointer moves one entry to the right. When the circular replacement pointer reaches the last backup cache line in the backup cache, the first backup cache line is returned when updating again, thereby realizing the circular traversal.
[0013] As an alternative implementation, an interleaved parity check method is used for error detection in the data cache, including: when the flag bit or data bit of a dirty row is detected as faulty, the backup address in the backup cache is determined according to the index bit in the backup cache, the pipeline is paused, and the corresponding backup cache data is read into the data cache to overwrite the faulty cache data.
[0014] As an alternative implementation, cache access instructions include load instructions and store instructions; In response to a load instruction, when performing a cache access operation on the data cache, if the cache misses, the cache block that was not hit is written from main memory to the data cache according to the address index. In response to a storage command, when performing a cache access operation on the data cache, if the currently hit cache line is not a dirty line and the backup cache is full, select the backup cache line to be replaced from the backup cache for backup.
[0015] Secondly, the present invention provides a data caching fault-tolerant system based on reliability-aware dirty redundancy backup, comprising: The backup module is configured to back up dirty rows in the data cache and write them to the backup cache; The access module is configured to respond to cache access commands, perform cache access operations on the data cache, and determine whether the backup cache is full; The first backup control module is configured to allocate a backup cache line in the backup cache if the backup cache is not full, so as to back up the data to be written. The second backup control module is configured to select a backup cache line to be replaced in the backup cache if the backup cache is full, write the cache data corresponding to the backup cache line to be replaced back to the main memory, and then write the data to be written at the corresponding address of the data cache and the backup cache. The process of selecting a backup cache line to be replaced includes: using a circular replacement pointer to determine a local candidate region that includes multiple candidate backup cache lines; determining the reliability risk level based on the historical error status, number of write operations, and dirty state residence time of the candidate backup cache lines; and selecting the candidate backup cache line with the lowest reliability risk level as the backup cache line to be replaced.
[0016] Thirdly, the present invention provides an electronic device including a memory and a processor, and computer instructions stored in the memory and running on the processor, wherein the computer instructions, when executed by the processor, implement the method as described in the first aspect.
[0017] Fourthly, the present invention provides a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the method described in the first aspect.
[0018] Fifthly, the present invention provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the first aspect.
[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention proposes a reliability-aware replacement strategy. When backup cache space is insufficient, it no longer simply replaces according to a fixed first-in-first-out order. Instead, it selects from a defined local candidate range based on the reliability risk level, prioritizing the retention of dirty cache lines with higher risk and writing dirty cache lines with lower risk back to main memory. This achieves reliability-aware backup management under limited backup cache storage resources, eliminating the need to maintain a strict cache line order. It selects write-back objects based on the reliability risk level, while reducing hardware implementation complexity.
[0020] This invention employs a backup cache to back up dirty rows in the data cache, and uses an interleaved parity check method to verify the flag bits and data bits of the data cache. When an error is detected in the flag bit or data bit of a dirty row, the backup address in the backup cache is first found based on the index bit in the backup cache. Then, the pipeline is paused, and the corresponding data is read into the data cache to overwrite the erroneous data, thereby achieving the purpose of error detection and correction and solving the data loss problem that may exist in existing cache fault tolerance technologies.
[0021] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0023] Figure 1 This is a flowchart of a data caching fault tolerance method based on reliability-aware dirty row redundancy backup provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of the reliability-aware replacement strategy provided in Embodiment 1 of the present invention; Figure 3 This is a flowchart for reliability risk level classification and judgment provided in Embodiment 1 of the present invention; Figure 4 This is a diagram of the interleaved parity check coding structure provided in Embodiment 1 of the present invention; Figure 5 This is a block diagram of data caching interleaved parity checking provided in Embodiment 1 of the present invention; Figure 6 This is a flowchart of the loading instruction processing provided in Embodiment 1 of the present invention; Figure 7 This is a flowchart of the processing and storage instructions provided in Embodiment 1 of the present invention. Detailed Implementation
[0024] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0025] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.
[0026] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of exemplary embodiments according to the invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form as well. Furthermore, it should be understood that the terms “comprising” and “including”, and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or apparatus that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0028] Terminology Explanation: (1) CPU cache write-back strategy: This is a delayed write mechanism. When the CPU performs a write operation on a cache line and a cache hit occurs, it only updates the cache content of the cache line in the data cache (DCache) and marks it as a dirty line (Dirty=1), but does not write it back to main memory synchronously. At this time, the content of the cache line is inconsistent with the data at the corresponding address in main memory. The dirty line data is only written back to main memory when the cache line is replaced out of the data cache (DCache).
[0029] (2) Cache access: refers to the process by which the processor reads from and writes to high-speed memory during program execution to speed up data access. The purpose of cache is to reduce data transfer latency between main memory and the main memory, thereby improving the overall running efficiency of the program. By quickly accessing the cache, the processor can significantly improve the response speed of data operations.
[0030] (3) Cache access instructions: These are instructions in the computer instruction set specifically designed to generate cache accesses, which instruct the processor to access data at a specific memory address. These instructions typically include data loading and storage operations.
[0031] (4) Cache access operations: The specific operations of finding, inserting, updating or deleting data in the data cache, involving cache hit and miss handling. When data is found in the data cache, it is called a cache hit; if the data is not in the data cache, it needs to be retrieved from main memory.
[0032] Example 1 Regarding the write-back strategy of CPU cache systems, when a dirty line of data experiences a single-event flip or other error, reloading the erroneous cache line from main memory can lead to data loss, resulting in incorrect calculation results. To address this issue, this embodiment proposes a data cache fault tolerance method based on reliability-aware dirty line redundancy backup, such as... Figure 1 As shown, it includes: Back up the dirty rows in the data cache and write them to the backup cache; In response to a cache access command, perform a cache access operation on the data cache and determine whether the backup cache is full; If the backup cache is not full, a backup cache line is allocated in the backup cache to back up the data to be written; If the backup cache is full, select the backup cache line to be replaced in the backup cache, write the cache data corresponding to the backup cache line to be replaced back to main memory, and then write the data to be written at the corresponding address in the data cache and the backup cache. The process of selecting a backup cache line to be replaced includes: using a circular replacement pointer to determine a local candidate region that includes multiple candidate backup cache lines; determining the reliability risk level based on the historical error status, number of write operations, and dirty state residence time of the candidate backup cache lines; and selecting the candidate backup cache line with the lowest reliability risk level as the backup cache line to be replaced.
[0033] The method of this embodiment will be described in detail below.
[0034] In this embodiment, all dirty lines in the data cache DCache are backed up and written to the backup cache RCache.
[0035] Among them, the backup cache RCache is a group-associative mapping. Each backup cache line in the backup cache RCache contains a valid bit, an index bit, a flag bit, and a data bit, as well as historical error status, number of write operations, number of resident operations, and risk level.
[0036] When the backup cache RCache is not full, a backup cache line is allocated in the backup cache RCache to back up the data to be written.
[0037] When the backup cache RCache is full, select the backup cache line to be replaced in the backup cache RCache, write the cache data corresponding to the backup cache line to be replaced back to main memory, change the corresponding cache line in the data cache DCache from a dirty state to a clean state (Dirty=0), write the data to be written, and then release the backup cache line to be replaced for backup of the data to be written.
[0038] In this embodiment, a reliability-aware pseudo-FIFO (First In First Out) replacement strategy is adopted in the backup cache RCache to select the backup cache line to be replaced, such as... Figure 2 As shown, it specifically includes: (1) When the backup cache RCache is full, the pseudo FIFO cyclic replacement pointer determines the local candidate region, and selects several RCache entries from the local candidate region as candidate backup cache lines.
[0039] Specifically: Starting from the circular replacement pointer, a fixed number of entries are continuously retrieved, and all of these entries are included in the comparison. Taking RCache with 32 entries and comparing 4 entries at a time as an example, a 5-bit circular replacement pointer ptr is set to point to the starting point of the local candidate region; the size of the local candidate region is set to 4. For example, if the pointer position is 0, the corresponding local candidate regions are 0, 1, 2, and 3.
[0040] (2) Determine the reliability risk level Risk_Level based on the historical error status ErrorFlag, write operation count WriteCnt, and dirty state residence time Age of the candidate backup cache line.
[0041] Specifically: (2-1) The historical error status ErrorFlag indicates whether the cached data corresponding to the current candidate backup cache line has a data error or a marking error during the current residence period.
[0042] If an error occurs in the corresponding cache line in the data cache DCache and is restored from the backup cache RCache, set ErrorFlag to 1.
[0043] Even if the error has been fixed by the backup cache RCache, ErrorFlag=1 is retained, indicating that the cache line has experienced an anomaly during the current residency period. Therefore, the backup protection priority is increased, and the cache line will not be prioritized for eviction when it is full.
[0044] When the cache line is written back to main memory, its dirty state changes to a clean state, and the corresponding entry in the backup cache RCache is released, the ErrorFlag is cleared to zero.
[0045] (2-2) WriteCnt represents the number of times a cache line is modified by the processor when it executes a store instruction after the cache line becomes a dirty line.
[0046] In other words, it is the cumulative number of data modifications that the corresponding dirty row has undergone while it has not yet been written back to main memory. The larger the number of write operations (WriteCnt), the higher the protection priority.
[0047] (2-3) Dirty state residence time Age represents the duration of the dirty state after a cache line becomes a dirty line, before it is written back to main memory.
[0048] The dirty state dwell time Age does not need to be incremented by 1 every clock cycle. Instead, a low-frequency uniform timing pulse is used to increment the dirty state dwell time Age of all valid backup cache entries by 1 every 256 cycles. The larger the dirty state dwell time Age, the higher the protection priority.
[0049] (2-4) such as Figure 3 As shown, the process for determining the reliability risk level (Risk_Level) is as follows: The reliability risk level is divided into four levels: high risk 11, medium-high risk 10, medium risk 01, and low risk 00. When the cached data corresponding to a candidate backup cache line has been found to have a data error or a marking error, i.e., the historical error status ErrorFlag is 1, it is determined to be a high-risk cache line; When the historical error status ErrorFlag is not 1 (i.e. no historical error has occurred), but the number of write operations is greater than or equal to the preset number threshold TH_W, it is determined to be a medium-to-high risk cache line; in a specific embodiment, when WriteCnt uses a 5-bit saturation counter, the preset number threshold TH_W is set to 16.
[0050] When the historical error status ErrorFlag is not 1, and the number of write operations is less than the preset threshold TH_W, but the dirty state residence time is greater than or equal to the preset time threshold TH_A, it is determined to be a medium-risk cache line. Here, Age does not need to be incremented by 1 every clock cycle; a low-frequency uniform timing pulse is used to increment the Age of all valid RCache entries by 1 every 256 cycles. The larger the Age, the higher the protection priority. In one specific embodiment, Age uses a 4-bit saturation counter, incrementing once every 256 clock cycles through global statistical ticks, and the preset time threshold TH_A is set to 4.
[0051] Otherwise, it is judged as a low-risk cache line.
[0052] (3) Compare the reliability risk level Risk_Level of each candidate backup cache line, and use the candidate backup cache line with the lowest reliability risk level as the backup cache line to be replaced, so that dirty lines with higher risk levels can continue to be retained in the backup cache RCache for redundancy protection as much as possible.
[0053] (4) After completing a replacement of a backup cache RCache entry and a new dirty line backup, the circular replacement pointer moves one entry to the right; when the circular replacement pointer reaches the last entry of the backup cache RCache, the first entry of the backup cache RCache is returned when updating again, thus realizing the circular traversal.
[0054] In this embodiment, for the selected backup cache line to be replaced, the dirty line in the corresponding data cache DCache is first written back to the main memory so that the main memory obtains the latest data of the cache line. After the write-back is completed, the dirty flag of the corresponding cache line in the data cache DCache is cleared to zero, so that it changes from a dirty state to a clean state. Then the selected backup cache line to be replaced is released, and the new dirty line data is written into the entry to complete the redundancy backup.
[0055] In this embodiment, when the backup cache RCache space is insufficient, it no longer simply replaces cache lines according to a fixed FIFO order. Instead, it selects from a local candidate range determined by the pseudo-FIFO based on the reliability risk level, thus prioritizing the retention of higher-risk dirty cache lines and prioritizing the writing of lower-risk dirty cache lines back to main memory. This achieves reliability-aware backup management under limited backup cache RCache storage resources. It eliminates the need to maintain a strict cache line order, achieving a near-FIFO replacement effect while reducing hardware implementation complexity.
[0056] In this embodiment, an interleaved parity check method is used to detect errors in the data cache. When an error is detected in the flag bit or data bit of a dirty row, the backup address in the backup cache RCache is first found according to the index bit in the backup cache RCache. Then, the pipeline is paused and the corresponding backup cache data is read into the data cache DCache to overwrite the erroneous cache data, thus achieving the purpose of error detection and correction.
[0057] The purpose of interleaved parity checking is to logically separate physically adjacent storage units to increase redundancy and speed up the encoding and decoding of circuits. This involves splitting the originally closely arranged data into independent groups, each with a parity bit. Although the storage space for the parity bit increases, the circuits that generate the parity code and detect errors are faster.
[0058] like Figure 4 The diagram shows the structure of the interleaved parity check encoding. Taking 16-bit data as an example, the data bits are divided into multiple parity check groups. The distance between the data bits belonging to each parity check group is the same. Each parity check group is XORed to obtain the parity check bit corresponding to the group.
[0059] In this embodiment, the data cache interleaved parity check block diagram is as follows: Figure 5 As shown, it includes an encoder, a decoder, a comparator (COMP), a data array, a dirty array, and a tag array.
[0060] When data is written (data_in), it is encoded in the encoder. The data bits and the corresponding check bits are stored in the corresponding positions according to the index. When accessed, the data is decoded and the decoded result is compared with the stored check bits. If they are the same, it is considered that no error has occurred; otherwise, an error is issued.
[0061] Similarly, when a tag is written (tag_in), it is encoded in the encoder. The tag and the corresponding check bit are stored in the corresponding position according to the index. When accessed, the tag is decoded and the decoded result is compared with the stored check bit. If they are the same, it is considered that no error has occurred; otherwise, an error is issued.
[0062] When a data bit or flag bit is incorrect and the currently accessed cached data is dirty, a stall signal is triggered. The backup address in the backup cache RCache is found based on the index bit in the backup cache RCache, and the corresponding data is read into the data cache DCache to overwrite the erroneous data.
[0063] If the data bits or flag bits are incorrect, but the currently accessed cache line is not a dirty line, a cache miss is triggered, and the cache line is reloaded from main memory.
[0064] In this embodiment, the encoder and decoder are used to perform interleaved parity check encoding and decoding on the data bits and tag bits. The comparator COMP has two uses in the interleaved parity check design: First, it compares whether the parity bit stored in the tag memory and the parity value obtained after decoding by the decoder are consistent. Second, when the processor access type is a read operation, if a hit occurs, the data and the interleaved parity code are read from the data memory. The parity code generated by the decoder is compared with the read parity code by the comparator. If they are the same, the check passes; if they are different, the check fails and an error signal is raised.
[0065] In this embodiment, based on the above method, the process for processing the load instruction is as follows: Figure 6 As shown, it specifically includes: (1) First, send a read request to the tag array of the data cache DCache, and read the tag value corresponding to the current address in the data cache DCache to determine whether the cache hit is successful.
[0066] (2) If the cache is hit, the data is read directly and the loading operation is completed.
[0067] (3) If the cache misses, a cache line replacement operation is performed based on the address index, that is, the cache block that misses is written from main memory to the data cache DCache based on the address index.
[0068] Specifically: (3-1) If the cache misses and the replaced cache line is not a dirty line, the data is read from the main memory according to the address index and written to the data cache DCache, and then the current loading operation ends.
[0069] (3-2) If the cache miss is a cache line and the replaced cache line is a dirty line, the dirty line is written back to main memory according to the address index, and the corresponding backup cache line in the backup cache RCache is found according to the index bit and the tag bit in the backup cache RCache. Since all dirty lines are backed up in the backup cache RCache, the corresponding backup cache line in the backup cache RCache should also be invalidated at this time.
[0070] If the cache line being replaced at this time corresponds to the last element of the backup cache RCache, that is, the last backup cache line of the backup cache RCache, then it is only necessary to write the corresponding dirty line in the data cache DCache back to main memory according to the address index, and invalidate the last element in the backup cache RCache. If the cache line being replaced is not the last element in the backup cache RCache, then the corresponding dirty line in the data cache DCache needs to be written back to main memory based on the address index. After writing the last backup cache line in the backup cache RCache to the backup position of the current dirty line in the backup cache RCache, the last element in the backup cache RCache is invalidated to ensure that the last position in the backup cache RCache is empty. The next time a dirty line is written, it can be written directly to the last position without traversing the backup cache RCache to find an empty position.
[0071] After writing the dirty lines back to main memory, the data is read from main memory to end the current loading operation.
[0072] In this embodiment, based on the above method, the process for processing storage instructions (Store instructions) is as follows: Figure 7 As shown, it specifically includes: (1) Send a read request to the tag array of the data cache DCache, and read the tag value corresponding to the current address in the data cache DCache to determine whether the cache hit is successful.
[0073] (2) If the cache hit is a dirty line, the cache line in the data cache DCache is written back to the main memory, and the location of the backup cache line is found in the backup cache RCache. The new data to be stored is written to the data cache DCache and the backup cache RCache respectively, and then the storage operation ends.
[0074] (3) If the cache hit is successful and the currently hit cache line is not a dirty line, determine whether the backup cache RCache is full.
[0075] (3-1) If the backup cache RCache is not full at this time, the new data is directly written to the cache line hit in the data cache DCache, and a new backup cache line is allocated in the backup cache RCache. Since the backup cache RCache uses a fully associative mapping, all empty lines in the backup cache RCache are allocated as backups, and then the storage operation ends.
[0076] (3-2) If the backup cache RCache is full at this time, a backup cache line in the backup cache RCache should be replaced, and the corresponding cache line should be written back to the main memory according to the index bit and the tag bit. The replacement strategy used by the backup cache RCache is a reliability-aware pseudo-FIFO. Then, the new data to be stored is written to the data cache DCache according to the address index and backed up in the backup cache RCache. Then the storage operation ends.
[0077] (4) If the cache misses and the cache line found by the address index is a dirty line (i.e. the cache line that exists in the current data cache DCache to be replaced), write the dirty line back to main memory, load the corresponding memory block into the data cache DCache according to the address index, write the new data into the cache line in the data cache DCache, and write the new data into the corresponding backup cache line in the backup cache RCache, and then end the storage operation.
[0078] (5) If a cache miss occurs and the current cache line is not a dirty line, load the corresponding memory block from main memory into the data cache DCache according to the address index, and write the new data into the cache line in the data cache DCache; If the backup cache RCache is not full at this time, a backup cache line is allocated in the backup cache RCache to back up the new data; If the backup cache RCache is full at this time, a backup cache line in the backup cache RCache is replaced by a reliability-aware pseudo FIFO, and the corresponding cache line is written back to main memory, and then the storage operation ends.
[0079] This embodiment proposes a data caching fault tolerance method based on reliability-aware dirty row redundant backup. It uses a backup cache (RCache) to back up dirty rows in the data cache (DCache), and employs interleaved parity checking to verify the flag bits and data bits of the data cache (DCache). When an error is detected in the flag bit or data bit of a dirty row, its backup address in the backup cache (RCache) is first found based on the index bit in the backup cache (RCache). Then, the pipeline is paused, and the corresponding data is read into the data cache (DCache) to overwrite the erroneous data. This achieves the purpose of error detection and correction, solving the data loss problem that may exist in existing cache fault tolerance technologies.
[0080] Meanwhile, when the backup cache (RCache) space is insufficient, it no longer simply replaces cache lines according to a fixed FIFO order. Instead, it selects from a local candidate range determined by the pseudo-FIFO, taking into account the reliability risk level. This prioritizes retaining high-risk dirty cache lines and writing low-risk dirty cache lines back to main memory, achieving reliability-aware backup management under limited backup cache (RCache) storage resources. It eliminates the need to maintain a strict cache line order, achieving a near-FIFO replacement effect while reducing hardware implementation complexity.
[0081] Example 2 This embodiment provides a data caching fault-tolerant system based on reliability-aware dirty redundancy backup, including: The backup module is configured to back up dirty rows in the data cache and write them to the backup cache; The access module is configured to respond to cache access commands, perform cache access operations on the data cache, and determine whether the backup cache is full; The first backup control module is configured to allocate a backup cache line in the backup cache if the backup cache is not full, so as to back up the data to be written. The second backup control module is configured to select a backup cache line to be replaced in the backup cache if the backup cache is full, write the cache data corresponding to the backup cache line to be replaced back to the main memory, and then write the data to be written at the corresponding address of the data cache and the backup cache. The process of selecting a backup cache line to be replaced includes: using a circular replacement pointer to determine a local candidate region that includes multiple candidate backup cache lines; determining the reliability risk level based on the historical error status, number of write operations, and dirty state residence time of the candidate backup cache lines; and selecting the candidate backup cache line with the lowest reliability risk level as the backup cache line to be replaced.
[0082] It should be noted that the above modules correspond to the steps described in Embodiment 1, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1. It should also be noted that the above modules, as part of the system, can be executed in a computer system such as a set of computer-executable instructions.
[0083] In further embodiments, the following is also provided: An electronic device includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, implement the method described in Embodiment 1. For brevity, further details are omitted here.
[0084] It should be understood that in this embodiment, the processor can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0085] Memory may include read-only memory and random access memory, and provides instructions and data to the processor. A portion of memory may also include non-volatile random access memory. For example, memory may also store information about the device type.
[0086] A computer-readable storage medium for storing computer instructions that, when executed by a processor, implement the method described in Embodiment 1.
[0087] The method in Example 1 can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor. The software modules can reside in readily available storage media in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, a detailed description is not provided here.
[0088] A computer program product includes a computer program that, when executed by a processor, implements the method described in Example 1.
[0089] The present invention also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer-executable instructions, such as instructions included in program modules, which execute in a device on a target real or virtual processor to perform the processes / methods described above. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc., that perform specific tasks or implement specific abstract data types. In various embodiments, the functionality of program modules can be combined or divided among program modules as needed. The machine-executable instructions for the program modules can execute within a local or distributed device. In a distributed device, the program modules can reside in both local and remote storage media.
[0090] The computer program code used to implement the methods of the present invention may be written in one or more programming languages. This computer program code may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the computer or other programmable data processing device, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a computer, partially on a computer, as a stand-alone software package, partially on a computer and partially on a remote computer, or entirely on a remote computer or server.
[0091] In the context of this invention, computer program code or related data may be carried by any suitable carrier to enable a device, apparatus, or processor to perform the various processes and operations described above. Examples of carriers include signals, computer-readable media, and the like. Examples of signals may include electrical, optical, radio, sound, or other forms of propagation signals, such as carrier waves, infrared signals, etc.
[0092] Those skilled in the art will recognize that the units and algorithm steps described in connection with the various examples of this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this invention.
[0093] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.
Claims
1. A data caching fault tolerance method based on reliability-aware dirty redundancy backup, characterized in that, include: Back up the dirty rows in the data cache and write them to the backup cache; In response to a cache access command, perform a cache access operation on the data cache and determine whether the backup cache is full; If the backup cache is not full, a backup cache line is allocated in the backup cache to back up the data to be written; If the backup cache is full, select the backup cache line to be replaced in the backup cache, write the cache data corresponding to the backup cache line to be replaced back to main memory, and then write the data to be written at the corresponding address in the data cache and the backup cache. The process of selecting a backup cache line to be replaced includes: using a circular replacement pointer to determine a local candidate region that includes multiple candidate backup cache lines; determining the reliability risk level based on the historical error status, number of write operations, and dirty state residence time of the candidate backup cache lines; and selecting the candidate backup cache line with the lowest reliability risk level as the backup cache line to be replaced.
2. The data caching fault tolerance method based on reliability-aware dirty row redundancy backup as described in claim 1, characterized in that, Historical error status indicates whether the dirty line corresponding to the current candidate backup cache line has experienced data errors or marking errors during the current residency period; If an error occurs and the system restores from the backup cache, the historical error status will be set to 1. The write operation count represents the cumulative number of data modifications that the dirty row corresponding to the current candidate backup cache row has undergone while it has not yet been written back to main memory; The dirty state residency time represents the duration of the dirty state of the current candidate backup cache line before it has been written back to main memory.
3. The data caching fault tolerance method based on reliability-aware dirty redundancy backup as described in claim 2, characterized in that, The process of determining the reliability risk level includes: When the historical error status of a candidate backup cache line is 1, it is determined to be a high-risk cache line; When the historical error status is not 1, but the number of write operations is greater than or equal to the preset threshold, it is judged as a medium-to-high risk cache line; When the historical error status is not 1 and the number of write operations is less than the preset number threshold, but the dirty state residence time is greater than or equal to the preset time threshold, it is judged as a medium-risk cache line. Otherwise, it is judged as a low-risk cache line.
4. The data caching fault tolerance method based on reliability-aware dirty row redundancy backup as described in claim 1, characterized in that, After completing the replacement of an entry in the backup cache and the backup of a new dirty line, the loop replacement pointer moves one entry to the right. When the loop replacement pointer reaches the last backup cache line in the backup cache, the next update returns to the first backup cache line, thus achieving loop traversal.
5. The data caching fault tolerance method based on reliability-aware dirty redundancy backup as described in claim 1, characterized in that, The data cache uses an interleaved parity check method for error detection, which includes: when the flag bit or data bit of a dirty row is detected as faulty, the backup address in the backup cache is determined based on the index bit in the backup cache, the pipeline is paused, and the corresponding backup cache data is read into the data cache to overwrite the faulty cache data.
6. The data caching fault tolerance method based on reliability-aware dirty redundancy backup as described in claim 1, characterized in that, Cache access instructions include load instructions and store instructions; In response to a load instruction, when performing a cache access operation on the data cache, if the cache misses, the cache block that was not hit is written from main memory to the data cache according to the address index. In response to a storage command, when performing a cache access operation on the data cache, if the currently hit cache line is not a dirty line and the backup cache is full, select the backup cache line to be replaced from the backup cache for backup.
7. A data caching fault-tolerant system based on reliability-aware dirty redundancy backup, characterized in that, include: The backup module is configured to back up dirty rows in the data cache and write them to the backup cache; The access module is configured to respond to cache access commands, perform cache access operations on the data cache, and determine whether the backup cache is full; The first backup control module is configured to allocate a backup cache line in the backup cache if the backup cache is not full, so as to back up the data to be written. The second backup control module is configured to select a backup cache line to be replaced in the backup cache if the backup cache is full, write the cache data corresponding to the backup cache line to be replaced back to the main memory, and then write the data to be written at the corresponding address of the data cache and the backup cache. The process of selecting a backup cache line to be replaced includes: using a circular replacement pointer to determine a local candidate region that includes multiple candidate backup cache lines; determining the reliability risk level based on the historical error status, number of write operations, and dirty state residence time of the candidate backup cache lines; and selecting the candidate backup cache line with the lowest reliability risk level as the backup cache line to be replaced.
8. An electronic device, characterized in that, It includes a memory and a processor, as well as computer instructions stored in the memory and running on the processor, which, when executed by the processor, implement the method as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, implement the method as described in any one of claims 1-6.
10. A computer program product, characterized in that, Includes a computer program, which, when executed by a processor, implements the method as described in any one of claims 1-6.
