CN118034993B - Method and device for protecting stored data, electronic equipment and storage medium - Google Patents

Method and device for protecting stored data, electronic equipment and storage medium Download PDF

Info

Publication number
CN118034993B
CN118034993B CN202410432776.4A CN202410432776A CN118034993B CN 118034993 B CN118034993 B CN 118034993B CN 202410432776 A CN202410432776 A CN 202410432776A CN 118034993 B CN118034993 B CN 118034993B
Authority
CN
China
Prior art keywords
data
storage device
bit width
error
spliced
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410432776.4A
Other languages
Chinese (zh)
Other versions
CN118034993A (en
Inventor
张林生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Niuxin Semiconductor Shenzhen Co ltd
Original Assignee
Niuxin Semiconductor Shenzhen Co ltd
Filing date
Publication date
Application filed by Niuxin Semiconductor Shenzhen Co ltd filed Critical Niuxin Semiconductor Shenzhen Co ltd
Priority to CN202410432776.4A priority Critical patent/CN118034993B/en
Publication of CN118034993A publication Critical patent/CN118034993A/en
Application granted granted Critical
Publication of CN118034993B publication Critical patent/CN118034993B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The application provides a method and a device for protecting stored data, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving input data, and determining write data based on the input data, the write data characterizing data written to the storage device; determining coded data corresponding to the write-in data based on the write-in data, splicing the write-in data and the coded data to obtain spliced data, and storing the spliced data in a storage device; when the data request equipment requests to read spliced data in the storage equipment, decoding the spliced data, and executing check and error correction operation on the decoded data obtained by decoding; in the process of executing the verification and error correction operation, obtaining correct data obtained by performing error correction processing on error data in the decoded data; the correct data is sent to the data requesting device and written back to the storage device. Thus, the problem that the error data cannot be corrected due to excessive accumulation of the error data in the storage device can be effectively avoided.

Description

Method and device for protecting stored data, electronic equipment and storage medium
Technical Field
The present application relates to the field of data protection technologies, and in particular, to a method and apparatus for protecting stored data, an electronic device, and a computer readable storage medium.
Background
The memory plays a role in chip design, and often stores important data in the chip working process, such as programs required to be loaded when the chip is started, and cached contents in the chip working process. Therefore, it is important to protect the data stored in the memory, and related designs for protecting the stored data are also made in the industry.
At present, the related art often performs ECC (Error CHECKING AND correction) check and Error correction or CRC (Cyclic Redundancy Check) check on a data signal, and although the accuracy of data reading can be guaranteed to a certain extent, if the number of erroneous data is continuously increased, the stored data cannot be completely corrected.
Disclosure of Invention
To solve the above technical problems, embodiments of the present application provide a method, an apparatus, an electronic device, and a computer readable storage medium for protecting stored data.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
In a first aspect, there is provided a method of protecting stored data, the method comprising: receiving input data and determining write data based on the input data, the write data characterizing data written to a storage device; determining coding data corresponding to the writing data based on the writing data, splicing the writing data and the coding data to obtain spliced data, and storing the spliced data in the storage device; when the data request equipment requests to read the spliced data in the storage equipment, decoding the spliced data, and executing a check and error correction operation on the decoded data obtained by decoding; during the process of executing the verification and error correction operation, obtaining correct data obtained by performing error correction processing on error data in the decoded data; and sending the correct data to the data request device, and writing the correct data back to the storage device.
In one embodiment of the present application, based on the foregoing scheme, the receiving input data and determining the write data based on the input data includes: acquiring the bit width of the input data, and comparing the bit width of the input data with the corresponding data bit width of the storage device; and if the bit width of the input data is equal to the data bit width corresponding to the storage device, taking the input data as the writing data.
In one embodiment of the present application, based on the foregoing scheme, the receiving input data and determining the write data based on the input data further includes: if the bit width of the input data is smaller than the data bit width corresponding to the storage equipment, acquiring the original data corresponding to the storage equipment, wherein the bit width of the original data is the same as the data bit width corresponding to the storage equipment; and determining the position of the data to be replaced in the original data according to the bit width of the input data, replacing the input data into the position of the data to be replaced to obtain new data, and taking the new data as the writing data.
In one embodiment of the present application, based on the foregoing, the storage device includes a write data storage device and an encoded data storage device that have the same storage capacity, the method further includes: aligning addresses of the write data storage device and the encoded data storage device; the storing the spliced data in the storage device includes: and storing the written data in the spliced data to the written data storage device, and storing the coded data in the spliced data to the coded data storage device.
In one embodiment of the present application, based on the foregoing scheme, the method further includes: if detecting that error data in the decoded data are subjected to error correction processing in the process of executing the check and error correction operation, recording the address of the error data, and discarding the error data.
In one embodiment of the present application, based on the foregoing scheme, the method further includes: setting a watchdog reset mechanism; collecting the number of the error data detected in performing the check and correction operation; and if the number of the error data reaches a preset number threshold, controlling a chip to which the storage device belongs to reset according to the watchdog reset mechanism.
In one embodiment of the present application, based on the foregoing scheme, the method further includes: and reporting the number of the error data to a processor so that the processor can perform corresponding processing according to the number of the error data.
In a second aspect, there is provided a protection device for stored data, the device comprising: a write data determination module configured to receive input data and determine write data based on the input data, the write data characterizing data written to a storage device; the data splicing module is configured to determine the coding data corresponding to the writing data based on the writing data, splice the writing data and the coding data to obtain splicing data, and store the splicing data in the storage device; the verification error correction module is configured to decode the spliced data when the data request equipment requests to read the spliced data in the storage equipment, and perform verification error correction operation on the decoded data obtained by decoding; the correct data acquisition module is configured to acquire correct data obtained by performing error correction processing on error data in the decoded data in the process of executing the verification error correction operation; and the correct data processing module is configured to send the correct data to the data request device and write the correct data back to the storage device.
In a third aspect, an electronic device is provided, comprising: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the electronic device to implement a method of protecting stored data as claimed in any preceding claim.
In a fourth aspect, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of protecting stored data as claimed in any one of the preceding claims.
In the technical scheme provided by the embodiment of the application, the spliced data obtained by splicing the written data and the coded data is stored in the storage device, when the data request device requests to read the spliced data in the storage device, the spliced data is decoded to obtain the decoded data, and error data in the decoded data is subjected to error correction processing, and the correct data obtained by the error correction processing is sent to the data request device, so that the data request device can be effectively ensured to receive the correct data, and the correct data is written back into the storage device, and the problem that the error data cannot be corrected due to excessive accumulation of the error data in the storage device can be effectively avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
Fig. 1 is a schematic diagram of an application scenario for storage data protection according to an exemplary embodiment of the present application.
Fig. 2 is a flowchart illustrating steps of a method of protecting stored data according to an exemplary embodiment of the present application.
FIG. 3 is a flowchart illustrating steps for determining write data based on input data, according to an exemplary embodiment of the present application.
Fig. 4 is a flowchart illustrating steps of determining write data based on input data according to another exemplary embodiment of the present application.
Fig. 5 is a flowchart illustrating the steps for resetting a chip to which a memory device belongs, according to an exemplary embodiment of the present application.
FIG. 6 is a system architecture diagram illustrating device interactions, in accordance with an exemplary embodiment of the present application.
Fig. 7 is a block diagram showing a structure of a protection apparatus for storing data according to an exemplary embodiment of the present application.
Fig. 8 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
The application is described in further detail below with reference to the drawings and examples. It is specifically noted that the following examples are only for illustrating the present application, but do not limit the scope of the present application. Likewise, the following examples are only some, but not all, of the examples of the present application, and all other examples, which a person of ordinary skill in the art would obtain without making any inventive effort, are within the scope of the present application.
The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented, for example, in sequences other than those illustrated or otherwise described herein. Furthermore, in the embodiments shown in the drawings, indications of directions (such as up, down, left, right, front and rear) are used to explain the structure and movement of the various elements of the application are not absolute but relative. These descriptions are appropriate when these elements are in the positions shown in the drawings. If the description of the position of these elements changes, the indication of these directions changes accordingly. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the present application, the term "plurality" means two or more. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., a and/or B may represent: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
As described above, the technology often performs ECC (Error CHECKING AND correction) check and Error correction or CRC (Cyclic Redundancy Check) check on the data signal, and although the accuracy of data reading can be guaranteed to a certain extent, if the number of erroneous data is continuously increased, this will result in that the stored data cannot be completely corrected.
In order to solve the problem of data accumulation of error data in a storage device, the application provides a protection method, a device, an electronic device and a computer readable storage medium for storage data, and the scheme provided by the application is explained in detail below.
Referring to fig. 1, fig. 1 is a schematic diagram of an application scenario for storage data protection according to an exemplary embodiment of the present application. As shown in fig. 1, includes a preset requesting device 101, an electronic device 102, and a storage device 103. The preset requesting device 101 may be a host, the electronic device 102 may be a controller or a server, the storage device 103 may include a write data storage device and an encoded data storage device, the write data storage device stores write data, the encoded data storage device stores encoded data corresponding to the write data, and the storage device 103 may also be a FIFO (First Input First Output, first-in-first-out) queue and a register file (regfile).
The preset requesting device 101 may send input data to the electronic device 102, where the electronic device 102 determines write data according to a bit width of the input data and a data bit width corresponding to the storage device 103, encodes the write data to obtain encoded data, and splices the write data and the encoded data to obtain spliced data, and stores the spliced data in the storage device 103. The preset requesting device 101 may also be used as a data requesting device, and requests to read the spliced data in the storage device 103, the electronic device 102 decodes the spliced data to be read and performs a check and error correction operation on the decoded data, where during the process of performing the check and error correction operation, correct data obtained by performing an error correction process on error data in the decoded data can be obtained, and the correct data is sent to the data requesting device, and the correct data is written back to the storage device 103.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for protecting stored data according to an exemplary embodiment of the present application. The method for protecting the stored data according to the embodiment of the present application is described in detail below by taking the controller as an example of a specific execution body.
As shown in fig. 2, in an exemplary embodiment, the method for protecting stored data includes at least steps S210 to S250, which are described in detail below:
Step S210, receiving input data, and determining write data based on the input data, the write data characterizing the data written in the storage device.
In step S210, it may be understood that the input data refers to data sent by the preset requesting device; writing data refers to writing data in a memory device, and input data may be the same as or different from writing data.
Specifically, whether the written data is identical to the input data or not can be determined based on the bit width of the input data and the data bit width corresponding to the storage device, and if the bit width of the input data is exactly equal to the data bit width corresponding to the storage device, for example, the bit width of the input data and the data bit width corresponding to the storage device are both 8 bits or 16 bits, the written data can be determined to be identical to the input data; if the bit width of the input data is not equal to the data bit width corresponding to the storage device, for example, the bit width of the input data is 8 bits, and the data bit width corresponding to the storage device is 16 bits; or the bit width of the input data is 16 bits, and the bit width of the data corresponding to the storage device is 32 bits, the written data and the input data can be determined to be different.
Referring to fig. 3, fig. 3 is a flowchart illustrating steps for determining write data based on input data according to an exemplary embodiment of the present application. As shown in fig. 3, determining the write data based on the input data includes at least steps S310 to S320, which are described in detail as follows:
Step S310, obtaining the bit width of the input data, and comparing the bit width of the input data with the corresponding data bit width of the storage device;
In step S320, if the bit width of the input data is equal to the data bit width corresponding to the storage device, the input data is used as the write data.
Illustratively, if the input data is accompanied by a metadata tag, wherein the metadata tag contains information about the data format and structure, including the bit width of the data, the bit width of the input data may be obtained by parsing the metadata tag of the input data. In addition, if the header portion of the input data carries information including the data format and the data bit width, the header portion of the input data may also be parsed to obtain the bit width of the input data.
If the bit width of the input data is equal to the data bit width corresponding to the storage device, the write data is identical to the input data, so the input data can be taken as the write data.
Referring to fig. 4, fig. 4 is a flowchart illustrating steps for determining write data based on input data according to another exemplary embodiment of the present application. As shown in fig. 4, determining the write data based on the input data includes at least steps S410 to S420, which are described in detail as follows:
step S410, if the bit width of the input data is smaller than the data bit width corresponding to the storage device, acquiring the original data corresponding to the storage device, wherein the bit width of the original data is the same as the data bit width corresponding to the storage device;
Step S420, the position of the data to be replaced in the original data is determined according to the bit width of the input data, the input data is replaced into the position of the data to be replaced to obtain new data, and the new data is used as the writing data.
For example, the bit width of the input data is 8 bits, the bit width of the data corresponding to the storage device is 32 bits, and then the original data corresponding to the storage device is obtained, and the bit width of the original data is also 32 bits; the original data may be 32-bit insubstantial content data configured for the storage device in advance. Since the bit width of the input data is 8 bits, it can be determined that the bit width of the data to be replaced in the original data should also be 8 bits, and the position of the data to be replaced can be randomly determined, for example, the position of the data to be replaced can be 8 th bit to 15 th bit, or can be 6 th bit to 13 th bit; the data location to be replaced may also be a specific location in the original data, such as the first 8 bits in the original data; and the input data is replaced into the data position to be replaced, so that new data, such as 8-bit input data and 24-bit data without substantial content, is obtained, so that the new data is matched with the data bit width in the storage device, and is further used as the data written into the storage device, and the input data can be effectively stored.
Step S220, determining the coded data corresponding to the written data based on the written data, splicing the written data and the coded data to obtain spliced data, and storing the spliced data in a storage device.
In step S220, the encoded data may be an ECC (Error CHECKING AND Correction) code or a CRC (Cyclic Redundancy Check) code; the ECC code corresponding to the written data can be calculated through an ECC error correction algorithm, and the ECC code can be, for example, 32bit/7bit-ECC,64bit/8bit-ECC and 128bit/9bit-ECC; the CRC code corresponding to the written data can be calculated through a CRC check algorithm.
And splicing the written data with the calculated coded data to obtain spliced data. For example, the bit width of the written data is 32 bits, the bit width of the coded data is 7 bits, and the bit width of the spliced data is 39 bits; the bit width of the written data is 64 bits, the bit width of the encoded data is 8 bits, and the bit width of the spliced data is 72 bits.
In an exemplary embodiment, the storage devices include a write data storage device and an encoded data storage device that have the same storage capacity, i.e., the storage capacities of the two storage devices are the same, i.e., the depths of the two storage devices are the same.
Meanwhile, the address of the writing data storage device is aligned with the address of the coding data storage device, and coding data corresponding to the writing data can be read out while the writing data is read by aligning the addresses of the writing data storage device and the coding data storage device.
Storing the spliced data in a storage device, and particularly storing the write-in data in the spliced data into the write-in data storage device; and storing the coded data in the spliced data to a coded data storage device. By storing the write data separately from the encoded data, the degree of coupling between the data can be reduced, making the system easier to maintain and expand.
In step S230, when the data request device requests to read the spliced data in the storage device, the spliced data is decoded, and a check error correction operation is performed on the decoded data obtained by decoding.
In step S230, the data requesting device sends a request to the storage device to read data, which may include, for example, a central processing unit CPU and a graphics processing unit GPU. The read spliced data can be decoded by a decoder, so as to obtain decoded data, and the decoder can be an ECC decoder, a video decoder, an audio decoder and the like.
Performing check and error correction operation on the decoded data obtained by decoding, specifically, performing check and error correction on the decoded data through an ECC check and error correction algorithm, namely performing check and error correction on the decoded data; or a CRC cyclic redundancy check algorithm is adopted for checking and correcting errors.
Step S240, in the process of performing the check and error correction operation, obtaining correct data obtained by performing error correction processing on the error data in the decoded data.
In step S240, if it is detected that there is erroneous data in the decoded data in the course of performing the check error correction operation, the erroneous data in the decoded data is subjected to error correction processing, thereby obtaining correct data.
In an exemplary embodiment, if it is detected that error data in the decoded data is subjected to error correction processing in performing a check error correction operation, an address of the error data is recorded, and the error data is discarded.
Further, if it is detected that error data in the decoded data is subjected to error correction processing in performing the check error correction operation, the address of the error data is recorded, and the error data is discarded to avoid returning the read error data to the processor, and meanwhile, error information of the address can be avoided being read subsequently by recording the address of the error data, for example, when a read request for reading the data of the address is received subsequently, the read request can be directly ignored, and the read request is not processed until the address writes correct data.
In another exemplary embodiment, the number of error data is reported to the processor to cause the processor to make a corresponding process based on the number of error data.
Further, the processor can take corresponding processing measures according to the number of error data, for example, if the number of error data is small, the processor can be controlled to choose to ignore the error data or take some slight repair measures; if the amount of erroneous data is large but still in a controllable situation, the processor may be controlled to take corrective action, such as using an error correction code to repair the erroneous data; if the number of erroneous data is large and exceeds a processable number threshold, the processor may be controlled to take emergency action, such as raising an alarm or the like.
Step S250, the correct data is sent to the data requesting device, and the correct data is written back to the storage device.
In step S250, the corrected correct data is sent to the data request device, so as to effectively ensure that the data request device receives the correct data, and the correct data is written back into the storage device, so as to effectively avoid the problem that the error data cannot be corrected due to excessive accumulation of the error data in the storage device.
Referring to fig. 5, fig. 5 is a flowchart illustrating a procedure for resetting a chip to which a memory device belongs according to an exemplary embodiment of the present application. As shown in fig. 5, resetting the chip to which the storage device belongs includes at least steps S510 to S530, which are described in detail below:
in step S510, a watchdog reset mechanism is set.
In step S510, if the number of error data in the storage device is 2 or more, the error data cannot be corrected, and the error data is executed by the processor, the processor may not be able to solve the problem even if the error data is reported, and in a serious case, the processor may be caused to be abnormal, so that it is necessary to set a watchdog reset mechanism.
A watchdog (watch dog) reset mechanism is a timer used to monitor the state of operation of a system, and is typically used to detect whether the system is operating properly and take action in the event of a failure or deadlock in the system.
Step S520, the number of error data detected in performing the check and error correction operation is collected.
In step S520, the number of collected error data may be real-time collection or intermittent collection, which is not limited herein.
In step S530, if the number of error data reaches the preset number threshold, the chip to which the storage device belongs is controlled to reset according to the watchdog reset mechanism.
In step S530, if the number of error data detected reaches the preset number threshold, which means that the current error condition has affected the normal operation of the system, the chip to which the storage device belongs is controlled to reset according to the watchdog reset mechanism, and the system is restored to the stable state by restarting.
According to the method, the watchdog reset mechanism is arranged, so that the number of error data is monitored periodically, and the related chips are reset automatically when the number of the error data is excessive, further fault diffusion can be avoided, and the fault tolerance and the reliability of the system are improved.
Referring to fig. 6, fig. 6 is a system architecture diagram illustrating device interactions according to an exemplary embodiment of the present application. As shown in fig. 6, input data transmitted from a host is received, and the bit width of the input data is compared with the data bit width of a storage device after reception. And if the bit width of the input data is equal to the data bit width of the storage device, taking the input data as the write-in data, performing ECC coding on the write-in data to obtain an ECC code corresponding to the write-in data, and performing data splicing on the write-in data and the ECC code corresponding to the write-in data and storing the data in the storage device. If the bit width of the input data is smaller than the data bit width of the storage device, the input data is replaced into the data position to be replaced to obtain new data as writing data, then ECC encoding is carried out on the writing data to obtain ECC codes corresponding to the writing data, and the writing data and the ECC codes corresponding to the writing data are spliced and stored in the storage device.
If the host computer is detected to send a request reading signal, decoding spliced data in the storage device, performing check and error correction operation on the decoded data obtained after decoding, directly sending read data and state information to the host computer if no error data exists, performing error correction processing if the error data exists, obtaining correct data by correcting the error data, sending the correct data to the host computer, and writing the correct data back to the storage device.
Fig. 7 is a schematic structural view of a protection device for storing data according to an exemplary embodiment of the present application. As shown in fig. 7, in an exemplary embodiment, the protection apparatus 700 for storing data includes:
A write data determination module 710 configured to receive input data and determine write data based on the input data, the write data characterizing data written to the storage device;
The data splicing module 720 is configured to determine encoded data corresponding to the write data based on the write data, splice the write data and the encoded data to obtain spliced data, and store the spliced data in the storage device;
the check and error correction module 730 is configured to decode the spliced data when the data request device requests to read the spliced data in the storage device, and perform a check and error correction operation on the decoded data obtained by decoding;
A correct data obtaining module 740 configured to obtain correct data obtained by performing error correction processing on error data in the decoded data in the process of performing the check error correction operation;
The correct data processing module 750 is configured to send the correct data to the data requesting device and write the correct data back to the storage device.
In one embodiment of the present application, based on the foregoing scheme, the write data determining module 710 further includes a comparing unit and a first write data determining unit. And a comparison unit configured to acquire a bit width of the input data and compare the bit width of the input data with a data bit width corresponding to the storage device. The first write data determining unit is configured to take the input data as write data if the bit width of the input data is equal to the data bit width corresponding to the storage device.
In one embodiment of the present application, based on the foregoing scheme, the write data determining module 710 further includes a raw data acquiring unit and a second write data determining unit. And the original data acquisition unit is configured to acquire the original data corresponding to the storage device if the bit width of the input data is smaller than the data bit width corresponding to the storage device, wherein the bit width of the original data is the same as the data bit width corresponding to the storage device. And a second write data determining unit configured to determine a data position to be replaced in the original data according to the bit width of the input data, to replace the input data into the data position to be replaced to obtain new data, and to use the new data as write data.
In one embodiment of the present application, based on the foregoing scheme, the protection device for storing data further includes an alignment unit and a data storage unit. An alignment unit configured to align addresses of the write data storage device and the encoded data storage device. And a data storage unit configured to store the write data in the spliced data to the write data storage device and store the encoded data in the spliced data to the encoded data storage device.
In an embodiment of the application, the protection device for stored data further comprises an error data processing unit based on the foregoing scheme. And an error data processing unit configured to record an address of the error data and discard the error data if it is detected that the error data in the decoded data is subjected to error correction processing in performing the check error correction operation.
In one embodiment of the present application, based on the foregoing scheme, the protection device for storing data further includes a timeout mechanism setting unit, a number collecting unit, and a resetting unit. A timeout mechanism setting unit configured to set a watchdog reset mechanism. And a number collection unit configured to collect the number of error data detected in performing the check error correction operation. And the reset unit is configured to control the chip to which the storage device belongs to reset according to the watchdog reset mechanism if the number of the error data reaches a preset number threshold value.
In an embodiment of the present application, based on the foregoing scheme, the protection device for storing data further includes a quantity reporting unit. And the quantity reporting unit is configured to report the quantity of the error data to the processor so that the processor can make corresponding processing according to the quantity of the error data.
It should be noted that, the protection device for the stored data provided in the foregoing embodiment and the protection method for the stored data provided in the foregoing embodiment belong to the same concept, and the specific manner in which each module and unit perform the operation has been described in detail in the method embodiment, which is not repeated herein.
The embodiment of the application also provides electronic equipment, which comprises: one or more processors; and a storage device for storing one or more programs, which when executed by the one or more processors, cause the electronic device to implement the method for protecting stored data provided in the above embodiments.
Fig. 8 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
It should be noted that, the computer system 800 of the electronic device shown in fig. 8 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 8, the computer system 800 includes a central processing unit (Central Processing Unit, CPU) 801 that can perform various appropriate actions and processes, such as performing the methods in the above-described embodiments, according to a program stored in a Read-Only Memory (ROM) 802 or a program loaded from a storage section 808 into a random access Memory (Random Access Memory, RAM) 803. In the RAM 803, various programs and data required for system operation are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other by a bus 804. An Input/Output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, mouse, etc.; an output portion 807 including a Cathode Ray Tube (CRT), a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), and a speaker, etc.; a storage section 808 including a hard disk or the like; and a communication section 809 including a network interface card such as a LAN (Local Area Network ) card, modem, or the like. The communication section 809 performs communication processing via a network such as the internet. The drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as needed so that a computer program read out therefrom is mounted into the storage section 808 as needed.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication section 809, and/or installed from the removable media 811. When executed by a Central Processing Unit (CPU) 801, performs the various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable medium can be, for example, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), a flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with a computer-readable computer program embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Where each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
Another aspect of the application also provides a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method of protecting stored data as before. The computer-readable medium may be included in the electronic device described in the above embodiment or may exist alone without being incorporated in the electronic device.
Yet another aspect of the application provides a computer program product or computer program comprising computer instructions stored in a computer readable medium. The processor of the computer device reads the computer instructions from the computer-readable medium, and the processor executes the computer instructions, so that the computer device performs the protection method of the stored data provided in the above-described respective embodiments.
The foregoing is merely illustrative of the preferred embodiments of the present application and is not intended to limit the embodiments of the present application, and those skilled in the art can easily make corresponding variations or modifications according to the main concept and spirit of the present application, so that the protection scope of the present application shall be defined by the claims.

Claims (9)

1. A method of protecting stored data, the method comprising:
analyzing metadata tags of input data to obtain bit widths of the input data, and comparing the bit widths of the input data with data bit widths corresponding to storage equipment;
if the bit width of the input data is smaller than the data bit width corresponding to the storage equipment, acquiring the original data corresponding to the storage equipment, wherein the bit width of the original data is the same as the data bit width corresponding to the storage equipment;
Determining a data position to be replaced in the original data according to the bit width of the input data, replacing the input data into the data position to be replaced to obtain new data, and taking the new data as writing data, wherein the writing data represents the data written into the storage equipment;
Determining coding data corresponding to the writing data based on the writing data, splicing the writing data and the coding data to obtain spliced data, and storing the spliced data in the storage device;
when the data request equipment requests to read the spliced data in the storage equipment, decoding the spliced data, and executing a check and error correction operation on the decoded data obtained by decoding;
during the process of executing the verification and error correction operation, obtaining correct data obtained by performing error correction processing on error data in the decoded data;
And sending the correct data to the data request device, and writing the correct data back to the storage device.
2. The method according to claim 1, wherein the method further comprises:
And if the bit width of the input data is equal to the data bit width corresponding to the storage device, taking the input data as the writing data.
3. The method of claim 1, wherein the storage device comprises a write data storage device and an encoded data storage device having the same storage capacity, the method further comprising:
aligning addresses of the write data storage device and the encoded data storage device;
the storing the spliced data in the storage device includes:
And storing the written data in the spliced data to the written data storage device, and storing the coded data in the spliced data to the coded data storage device.
4. The method according to claim 1, wherein the method further comprises:
If detecting that error data in the decoded data are subjected to error correction processing in the process of executing the check and error correction operation, recording the address of the error data, and discarding the error data.
5. The method according to claim 1, wherein the method further comprises:
Setting a watchdog reset mechanism;
Collecting the number of the error data detected in performing the check and correction operation;
and if the number of the error data reaches a preset number threshold, controlling a chip to which the storage device belongs to reset according to the watchdog reset mechanism.
6. The method of claim 5, wherein the method further comprises:
And reporting the number of the error data to a processor so that the processor can perform corresponding processing according to the number of the error data.
7. A protection device for stored data, the device comprising:
The comparison module is configured to analyze metadata tags of input data to obtain the bit width of the input data, and compare the bit width of the input data with the data bit width corresponding to the storage device;
The original data acquisition module is configured to acquire original data corresponding to the storage equipment if the bit width of the input data is smaller than the data bit width corresponding to the storage equipment, and the bit width of the original data is the same as the data bit width corresponding to the storage equipment;
a second write data determining unit configured to determine a data position to be replaced in the original data according to a bit width of the input data, replace the input data into the data position to be replaced to obtain new data, and use the new data as write data, wherein the write data represents data written in the storage device;
The data splicing module is configured to determine the coding data corresponding to the writing data based on the writing data, splice the writing data and the coding data to obtain splicing data, and store the splicing data in the storage device;
The verification error correction module is configured to decode the spliced data when the data request equipment requests to read the spliced data in the storage equipment, and perform verification error correction operation on the decoded data obtained by decoding;
the correct data acquisition module is configured to acquire correct data obtained by performing error correction processing on error data in the decoded data in the process of executing the verification error correction operation;
And the correct data processing module is configured to send the correct data to the data request device and write the correct data back to the storage device.
8. An electronic device, comprising:
one or more processors;
Storage means for storing one or more programs which, when executed by the one or more processors, cause the electronic device to implement the method of protecting stored data as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when executed by a processor, implements a method of protecting stored data according to any one of claims 1 to 6.
CN202410432776.4A 2024-04-11 Method and device for protecting stored data, electronic equipment and storage medium Active CN118034993B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410432776.4A CN118034993B (en) 2024-04-11 Method and device for protecting stored data, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410432776.4A CN118034993B (en) 2024-04-11 Method and device for protecting stored data, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN118034993A CN118034993A (en) 2024-05-14
CN118034993B true CN118034993B (en) 2024-06-25

Family

ID=

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102203740A (en) * 2011-05-27 2011-09-28 华为技术有限公司 Data processing method, device and system
CN115729746A (en) * 2022-11-15 2023-03-03 中科芯集成电路有限公司 Data storage protection method based on CRC and ECC

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102203740A (en) * 2011-05-27 2011-09-28 华为技术有限公司 Data processing method, device and system
CN115729746A (en) * 2022-11-15 2023-03-03 中科芯集成电路有限公司 Data storage protection method based on CRC and ECC

Similar Documents

Publication Publication Date Title
CN111880740B (en) Data processing method, device, computer system and readable storage medium
US20090150721A1 (en) Utilizing A Potentially Unreliable Memory Module For Memory Mirroring In A Computing System
CN102135925B (en) Method and device for detecting error check and correcting memory
US8140940B2 (en) Method and apparatus for controlling memory
US20030037280A1 (en) Computer memory error management system and method
EP1224548B1 (en) System and method improving fault isolation and diagnosis in computers
JP2001256068A (en) Error detecting/correcting method, main storage controller of computer system and computer system
US9665448B2 (en) Semiconductor integrated circuit
CN114710224A (en) Frame synchronization method and device, computer readable medium and electronic device
CN110554929B (en) Data verification method, device, computer equipment and storage medium
CN118034993B (en) Method and device for protecting stored data, electronic equipment and storage medium
CN111352764B (en) Chip repairing method, device, equipment and storage medium
CN118034993A (en) Method and device for protecting stored data, electronic equipment and storage medium
CN105023616A (en) Method for storing and retrieving data based on Hamming code and integrated random access memory
WO2023024248A1 (en) Bus anomaly handling method and apparatus, electronic device and readable storage medium
CN111506460B (en) Memory fault processing method and device, mobile terminal and storage medium
CN115700549A (en) Model training method, failure determination method, electronic device, and program product
EP3882774A1 (en) Data processing device and data processing method
CN109918231B (en) Data reforming abnormity repairing method, device, equipment and storage medium
US20050138487A1 (en) Poisoned error signaling for proactive OS recovery
CN114124745A (en) Method and system for diagnosing MVB communication fault
CN118018153B (en) Method and device for processing transmission data and electronic equipment
CN117792565A (en) Error code detection method and device, storage medium and electronic equipment
CN116679991B (en) Method, system, equipment and storage medium for managing starting of memory
CN116089156A (en) Error correction module detection method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant