CN115629917A - Data recovery method and device, electronic equipment and readable storage medium - Google Patents

Data recovery method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN115629917A
CN115629917A CN202211663534.3A CN202211663534A CN115629917A CN 115629917 A CN115629917 A CN 115629917A CN 202211663534 A CN202211663534 A CN 202211663534A CN 115629917 A CN115629917 A CN 115629917A
Authority
CN
China
Prior art keywords
instruction
simulator
snapshot point
snapshot
point
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.)
Granted
Application number
CN202211663534.3A
Other languages
Chinese (zh)
Other versions
CN115629917B (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.)
Beijing Open Source Chip Research Institute
Original Assignee
Beijing Open Source Chip Research Institute
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Open Source Chip Research Institute filed Critical Beijing Open Source Chip Research Institute
Priority to CN202211663534.3A priority Critical patent/CN115629917B/en
Publication of CN115629917A publication Critical patent/CN115629917A/en
Application granted granted Critical
Publication of CN115629917B publication Critical patent/CN115629917B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1479Generic software techniques for error detection or fault masking
    • G06F11/1482Generic software techniques for error detection or fault masking by means of middleware or OS functionality

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention provides a data recovery method, a data recovery device, electronic equipment and a readable storage medium, wherein the method comprises the following steps: receiving a first recovery instruction, wherein the first recovery instruction carries a first snapshot point; in response to the first recovery instruction, reading register state information and a memory access operation record corresponding to the first snapshot point from a preset snapshot space, wherein the memory access operation record is used for recording each memory access instruction executed by the simulator from the first snapshot point to the current moment and a timestamp corresponding to each memory access instruction; restoring the register state of the simulator to the state corresponding to the first snapshot point according to the register state information; and reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record so as to restore the memory state of the simulator to the state corresponding to the first snapshot point. The embodiment of the invention can save the running expense caused by the system call of the operating system.

Description

Data recovery method and device, electronic equipment and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data recovery method and apparatus, an electronic device, and a readable storage medium.
Background
In the field of chip design, pre-silicon performance evaluation is indispensable to project promotion and design decision. When evaluating the performance of a processor, a simulator is often used to execute a program first, and a corresponding test signal is generated according to the execution result of the simulator and provided to the processor, which requires the simulator to execute before the processor. However, interrupts on a processor often occur randomly, and when an interrupt occurs during the execution of the processor, the simulator often has already executed to the point after the interrupt, which results in the execution result of the simulator not matching the execution result of the processor. At this point, the state of the simulator needs to be restored to or before the interrupt point to synchronize the state of the simulator and the processor.
There are two main ways to implement state recovery of a simulator in the prior art: 1) State recovery based on a full checkpoint. In this way, register state information corresponding to each check point and complete memory information at the current moment can be stored, the recovery time is long, and a large-scale storage space is required to be occupied; 2) State recovery based on fork mechanism. Compared with a state recovery mode of a full checkpoint, the fork mechanism reduces the time overhead and space overhead of storing complete memory information, but the system call of the operating system causes large running overhead, and the state recovery requirement of the simulator before the processor is executed cannot be met.
Disclosure of Invention
Embodiments of the present invention provide a data recovery method and apparatus, an electronic device, and a readable storage medium, which can save running overhead caused by system call of an operating system in a memory state recovery process of a simulator.
In order to solve the above problem, an embodiment of the present invention discloses a data recovery method, which is applied to a simulator, and the method includes:
receiving a first recovery instruction, wherein the first recovery instruction carries a first snapshot point;
in response to the first recovery instruction, reading register state information and a memory access operation record corresponding to the first snapshot point from a preset snapshot space, wherein the memory access operation record is used for recording each memory access instruction executed by the simulator from the first snapshot point to the current moment and a timestamp corresponding to each memory access instruction;
restoring the register state of the simulator to the state corresponding to the first snapshot point according to the register state information;
and reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record so as to restore the memory state of the simulator to the state corresponding to the first snapshot point.
Optionally, the first restore instruction further carries a first indication, where the first indication is used to indicate that the simulator restores the memory state to a first time, and the first snapshot point is before the first time; the method further comprises the following steps:
and taking the first snapshot point as a starting point, executing each memory access instruction between the first snapshot point and the current moment according to the time stamp sequence, and stopping executing until the time stamp corresponding to the next instruction is smaller than the first moment to obtain the memory state of the simulator at the first moment.
Optionally, the access operation record includes each access instruction executed by the simulator from the initial snapshot point to the current time and a timestamp corresponding to each access instruction; the method for reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record to restore the memory state of the simulator to the state corresponding to the first snapshot point comprises the following steps:
and sequentially and reversely executing each instruction in the memory access operation record according to the timestamp by taking the current moment as a starting point, and stopping executing until the timestamp of the next instruction is smaller than the first snapshot point to obtain the memory state of the simulator at the first snapshot point.
Optionally, the method further comprises:
receiving a second recovery instruction, where the second recovery instruction carries a second indication, and the second indication is used to indicate that the simulator recovers the memory state to a second time, where the second time is any time between a second snapshot point and the first snapshot point, and the second snapshot point is before the first snapshot point;
and sequentially and reversely executing the instructions between the first snapshot point and the second snapshot point in the access operation record according to the time stamps by taking the first snapshot point as a starting point until the time stamp of the next instruction is less than the second moment, stopping executing, and obtaining the memory state of the simulator at the second moment.
Optionally, the simulator is configured to simulate an operation process of the processor to be tested, and the first snapshot point is configured to synchronize a state of the simulator with a state of an interrupt point of the processor to be tested.
On the other hand, the embodiment of the invention discloses a data recovery device, which is applied to a simulator and comprises the following components:
a first receiving module, configured to receive a first recovery instruction, where the first recovery instruction carries a first snapshot point;
the data acquisition module is used for responding to the first recovery instruction, reading register state information and a memory access operation record corresponding to the first snapshot point from a preset snapshot space, wherein the memory access operation record is used for recording each memory access instruction executed by the simulator from the first snapshot point to the current moment and a timestamp corresponding to each memory access instruction;
the first recovery module is used for recovering the register state of the simulator to the state corresponding to the first snapshot point according to the register state information;
and the second recovery module is used for reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record so as to recover the memory state of the simulator to the state corresponding to the first snapshot point.
Optionally, the first restore instruction further carries a first indication, where the first indication is used to indicate that the simulator restores the memory state to a first time, and the first snapshot point is before the first time; the device further comprises:
and the third recovery module is used for executing each memory access instruction between the first snapshot point and the current moment according to the time stamp sequence by taking the first snapshot point as a starting point until the time stamp corresponding to the next instruction is smaller than the first moment, and stopping executing to obtain the memory state of the simulator at the first moment.
Optionally, the access operation record includes each access instruction executed by the simulator from the initial snapshot point to the current time and a timestamp corresponding to each access instruction; the second recovery module, comprising:
and the instruction execution submodule is used for sequentially and reversely executing each instruction in the access and storage operation record according to the timestamp by taking the current moment as a starting point, and stopping executing until the timestamp of the next instruction is smaller than the first snapshot point, so that the memory state of the simulator at the first snapshot point is obtained.
Optionally, the apparatus further comprises:
a second receiving module, configured to receive a second recovery instruction, where the second recovery instruction carries a second instruction, and the second instruction is used to instruct the simulator to recover the memory state to a second time, where the second time is any time between a second snapshot point and the first snapshot point, and the second snapshot point is before the first snapshot point;
and the fourth recovery module is used for sequentially and reversely executing the instructions between the first snapshot point and the second snapshot point in the access operation record by taking the first snapshot point as a starting point according to the time stamp, and stopping executing until the time stamp of the next instruction is smaller than the second moment, so as to obtain the memory state of the simulator at the second moment.
Optionally, the simulator is configured to simulate an operation process of the processor to be tested, and the first snapshot point is configured to synchronize a state of the simulator with a state of an interrupt point of the processor to be tested.
On the other hand, the embodiment of the invention also discloses electronic equipment, which comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus; the memory is used for storing executable instructions which enable the processor to execute the data recovery method.
The embodiment of the invention also discloses a readable storage medium, and when the instructions in the readable storage medium are executed by a processor of the electronic equipment, the electronic equipment can execute the data recovery method.
The embodiment of the invention has the following advantages:
the embodiment of the invention provides a data recovery method, which is characterized in that under the condition of receiving a first recovery instruction aiming at a first snapshot point, register state information and a memory access operation record corresponding to the first snapshot point are read from a preset snapshot space, the register state of a simulator is recovered to be the state of the first snapshot point according to the register state information, and each memory access instruction between the first snapshot point and the current moment is reversely executed according to the memory access operation record, so that the memory state of the simulator is recovered to be the state corresponding to the first snapshot point. Compared with the prior art, the data recovery method provided by the embodiment of the invention has the advantages that the complete state of the memory at the snapshot point is not required to be recorded, and the memory state of the simulator can be recovered to the state corresponding to the snapshot point only through the register state information and the memory access record corresponding to the snapshot point, so that the storage space is saved. In addition, the embodiment of the invention directly executes the data recovery operation by the simulator without the need of the operating system to carry out system call, thereby saving the hardware expense brought by the system call of the operating system.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive labor.
FIG. 1 is a flow chart of the steps of one embodiment of a data recovery method of the present invention;
FIG. 2 is a block diagram of an embodiment of a data recovery apparatus according to the present invention;
fig. 3 is a block diagram of an electronic device for data recovery according to an example of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms first, second and the like in the description and in the claims of the present invention are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that embodiments of the invention may be practiced other than those illustrated or described herein, and that the objects identified as "first," "second," etc. are generally a class of objects and do not limit the number of objects, e.g., a first object may be one or more. Furthermore, the term "and/or" in the specification and claims is used to describe an association relationship of associated objects, meaning that three relationships may exist, e.g., a and/or B, may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. The term "plurality" in the embodiments of the present invention means two or more, and other terms are similar thereto.
Method embodiment
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a data recovery method according to the present invention is shown, where the method specifically includes the following steps:
step 101, receiving a first recovery instruction, wherein the first recovery instruction carries a first snapshot point.
Step 102, in response to the first recovery instruction, reading register state information and a memory access operation record corresponding to the first snapshot point from a preset snapshot space, where the memory access operation record is used to record each memory access instruction executed by the simulator from the first snapshot point to the current time and a timestamp corresponding to each memory access instruction.
And 103, restoring the register state of the simulator to the state corresponding to the first snapshot point according to the register state information.
And 104, reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record so as to restore the memory state of the simulator to the state corresponding to the first snapshot point.
The data recovery method provided by the embodiment of the invention can be applied to a simulator. The simulator is used for simulating functions of a hardware processor and programs of an instruction system through software, so that a computer or other multimedia platforms (such as a palm computer, a mobile phone and the like) can run software on other platforms. It should be noted that the simulator may save and restore state information of the snapshot point through the snapshot function, such as a processor running state, a register state, a memory state, a peripheral state, and the like of the simulator. The data recovery method provided by the embodiment of the invention is mainly used for recovering the memory state of the simulator.
The first recovery instruction may be sent by the user to the simulator through the user terminal, or may be sent by the processor to be tested to the simulator in case of an interrupt. In a possible scenario of the present invention, the simulator is configured to simulate an execution process of the test program by the processor to be tested, and the first snapshot point is configured to synchronize a state of the simulator with a state of an interrupt point of the processor to be tested. In the process of executing the test program, if interruption occurs, the processor to be tested sends a first recovery instruction to the simulator, and triggers the simulator to recover the memory state to the state of an interruption point or a time point before the interruption point, so that the state synchronization of the simulator and the processor to be tested is realized. Wherein the interrupt point refers to a point in time at which an interrupt occurs. In this scenario, the first snapshot point carried in the first recovery instruction may be an interruption point, or may be a time point before the interruption point.
After receiving the first recovery instruction, the simulator reads the register state information and the access operation record corresponding to the first snapshot point from a preset snapshot space. It can be understood that the snapshot space is a pre-configured segment of storage space dedicated to storing snapshot point data, and the size of the snapshot space can be configured according to the actual data recovery requirement. The register state information is used for recording the values of all registers at the snapshot points, and if a plurality of snapshot points exist, each snapshot point corresponds to one group of register state information. The access operation record is used for recording each access instruction executed by the simulator from the first snapshot point to the current moment and a timestamp corresponding to each access instruction. The time stamp is used for recording the time of the simulator for executing the memory access instructions, and the execution sequence of each memory access instruction can be determined according to the time stamp of each memory access instruction. Illustratively, the memory access operation record may be a log record for recording each memory access instruction executed by the simulator in real time from the first snapshot point.
Then, the simulator can directly restore the register state of the simulator to the state corresponding to the first snapshot point according to the register state information corresponding to the first snapshot point, that is, restore the values recorded in each register to the values corresponding to the snapshot points.
And finally, reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record, so that the memory state of the simulator can be restored to the state corresponding to the first snapshot point.
It is understood that the memory access instruction is used for realizing the data transmission between the memory and the register, and the reverse transmission of the data between the memory and the register can be realized by executing the memory access instruction reversely. For example, a store instruction str (R1, R2) is used to store the number in register R1 into memory R2, and the data in memory R2 may be modified to the data before the store instruction is executed by executing the store instruction in reverse.
According to the data recovery method provided by the embodiment of the invention, the complete state of the memory at the snapshot point is not required to be recorded, and the memory state of the simulator can be recovered to the state corresponding to the snapshot point only through the register state information and the memory access record corresponding to the snapshot point, so that the storage space is saved. In addition, the embodiment of the invention directly executes the data recovery operation by the simulator without the need of the operating system to carry out system call, thereby saving the operation expense brought by the system call of the operating system.
In an optional embodiment of the present invention, the first restore instruction further carries a first indication, where the first indication is used to indicate that the simulator restores the memory state to a first time, and the first snapshot point is before the first time; the method further comprises the following steps:
step S11, with the first snapshot point as a starting point, executing each memory access instruction between the first snapshot point and the current time according to the time stamp sequence, and stopping executing until the time stamp corresponding to the next instruction is smaller than the first time, so as to obtain the memory state of the simulator at the first time.
The data recovery method provided by the embodiment of the invention can recover the memory state of the simulator to the state corresponding to the first snapshot point, and can also recover the memory state of the simulator to the state at any time after the first snapshot point.
Specifically, the first recovery instruction may carry a first indication in addition to the first snapshot point, where the first indication is used to indicate the simulator to recover the memory state to the first time. It will be appreciated that the first time may be any time after the first snapshot point. After the simulator restores the memory state to the state corresponding to the first snapshot point according to the processing procedures of the foregoing steps 101 to 104, the simulator executes each instruction between the first snapshot point in the access operation record and the current time according to the time stamp sequence with the first snapshot point as the starting point. If the next instruction, that is, the timestamp corresponding to the first instruction to be executed is smaller than the first time, it is indicated that the access instructions between the first snapshot point and the first time are all executed, and the execution may be stopped, so as to obtain the memory state of the simulator at the first time.
It should be noted that at least two snapshot points may be preset, and the first snapshot point may be any one snapshot point of a plurality of preset snapshot points. Each snapshot point corresponds to a group of register state information, all snapshot points can share access operation records, and the access operation records comprise each access instruction executed by the simulator from the initial snapshot point to the current moment and a timestamp corresponding to each access instruction. And sequencing all the snapshot points according to the time sequence, wherein the first snapshot point is the initial snapshot point. It will be appreciated that the time difference between the starting snapshot and the current time is greatest.
In an optional embodiment of the present invention, the step 104 of reversely executing each memory access instruction between the first snapshot and the current time according to the memory access operation record to restore the memory state of the simulator to the state corresponding to the first snapshot includes:
and S21, taking the current moment as a starting point, sequentially and reversely executing each instruction in the memory access operation record according to the timestamp, and stopping executing until the timestamp of the next instruction is smaller than the first snapshot point to obtain the memory state of the simulator at the first snapshot point.
In the embodiment of the invention, the current time is taken as a starting point, all instructions in the access operation record are reversely executed in sequence from back to front according to the timestamp, if the timestamp corresponding to the next instruction is smaller than the first snapshot point, the fact that all access instructions between the first snapshot point and the current instruction are completely reversely executed is shown, at the moment, the execution is stopped, and the memory state of the simulator at the first snapshot point can be obtained.
Optionally, the method further comprises:
step S31, receiving a second recovery instruction, where the second recovery instruction carries a second indication, and the second indication is used to indicate the simulator to recover the memory state to a second time, where the second time is any time between a second snapshot point and the first snapshot point, and the second snapshot point is before the first snapshot point;
and step S32, taking the first snapshot point as a starting point, sequentially and reversely executing the instructions between the first snapshot point and the second snapshot point in the access operation record according to the time stamps, and stopping executing until the time stamp of the next instruction is less than the second moment, so as to obtain the memory state of the simulator at the second moment.
In the embodiment of the present invention, if a second recovery instruction is received, where the second recovery instruction carries a second indication for instructing the simulator to recover the memory state to the second time, the memory state of the simulator needs to be recovered to the state at the second time. Wherein the second time is any time between two snapshot points.
Assume that the snapshot point after the second time Ta is the first snapshot point T1, the snapshot point before the second time Ta is the second snapshot point T2, and T2< Ta < T1. As an example, according to the processing procedure of the foregoing steps 101 to 104, the memory state of the simulator may be restored to the state corresponding to the second snapshot point, and then according to the processing procedure of the foregoing step S11, each instruction between the second snapshot point and the second time in the access operation record is instructed according to the sequence of the timestamp with the second snapshot point as the starting point, so as to restore the memory state of the simulator to the state at the second time.
As another example, the first snapshot point may be used as a starting point, the instructions in the access operation record are executed in a reverse direction in sequence from back to front according to the timestamp, and if the timestamp corresponding to the next instruction is smaller than the second time, it is described that all the access instructions between the second time and the first snapshot point have been executed in a reverse direction, and at this time, the execution is stopped, so that the memory state of the simulator at the second time may be obtained.
If the memory state of the simulator is restored to the state corresponding to the first snapshot point, a restoration instruction for other snapshot points is also received, the memory state of the simulator may be restored according to the processing procedures of the foregoing steps 101 to 104, or the memory access instruction in the memory access operation record may be executed in the forward direction or the reverse direction according to the sequence of the snapshot point and the first snapshot point carried in the restoration instruction, so as to realize the restoration processing of the memory state. As an example, assuming a first snapshot point T1 and a second snapshot point T2, after the simulator restores the memory state of the simulator to the state corresponding to the first snapshot point T1, a restoration instruction for the second snapshot point T2 is also received. If the second snapshot point T2 is before the first snapshot point T1, that is, T2 is less than T1, the processing procedure of S32 may be referred to, and the memory access instructions between the first snapshot point and the second snapshot point in the memory access operation record are sequentially and reversely executed according to the timestamp with the first snapshot point as the starting point, so that the memory state of the simulator may be restored to the state corresponding to the second snapshot point. If the second snapshot point T2 is behind the first snapshot point T1, that is, T2 is greater than T1, the processing procedure of S11 may be referred to, and each access instruction between the first snapshot point and the second snapshot point in the access operation record is executed according to the time stamp sequence with the first snapshot point as the starting point, so that the memory state of the simulator may be restored to the state corresponding to the second snapshot point.
To sum up, an embodiment of the present invention provides a data recovery method, where, when a first recovery instruction for a first snapshot point is received, register state information and a memory access operation record corresponding to the first snapshot point are read from a preset snapshot space, a register state of a simulator is recovered to a state of the first snapshot point according to the register state information, and each memory access instruction between the first snapshot point and a current time is executed in a reverse direction according to the memory access operation record, so as to recover a memory state of the simulator to the state corresponding to the first snapshot point. Compared with the prior art, the data recovery method provided by the embodiment of the invention can recover the memory state of the simulator to the state corresponding to the snapshot point only through the register state information and the memory access record corresponding to the snapshot point without recording the complete state of the memory at the snapshot point, so that the storage space is saved. In addition, the embodiment of the invention directly executes the data recovery operation by the simulator without the need of the operating system to carry out system call, thereby saving the hardware expense brought by the system call of the operating system.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those of skill in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the embodiments of the invention.
Device embodiment
Referring to fig. 2, a block diagram of a data recovery apparatus according to an embodiment of the present invention is shown, where the apparatus is applied to a simulator, and specifically may include:
a first receiving module 201, configured to receive a first recovery instruction, where the first recovery instruction carries a first snapshot point;
a data obtaining module 202, configured to, in response to the first recovery instruction, read register state information and a memory access operation record corresponding to the first snapshot point from a preset snapshot space, where the memory access operation record is used to record each memory access instruction executed by the simulator from the first snapshot point to a current time and a timestamp corresponding to each memory access instruction;
a first restoring module 203, configured to restore the register state of the simulator to a state corresponding to the first snapshot point according to the register state information;
a second restoring module 204, configured to execute each memory access instruction between the first snapshot and the current time in a reverse direction according to the memory access operation record, so as to restore the memory state of the simulator to the state corresponding to the first snapshot.
Optionally, the first restore instruction further carries a first indication, where the first indication is used to indicate that the simulator restores the memory state to a first time, and the first snapshot point is before the first time; the device further comprises:
and the third recovery module is used for executing each memory access instruction between the first snapshot point and the current moment according to the time stamp sequence by taking the first snapshot point as a starting point until the time stamp corresponding to the next instruction is smaller than the first moment, and stopping executing to obtain the memory state of the simulator at the first moment.
Optionally, the memory access operation record includes each memory access instruction executed by the simulator from the initial snapshot point to the current time and a timestamp corresponding to each memory access instruction; the second recovery module comprising:
and the instruction execution submodule is used for sequentially and reversely executing each instruction in the access operation record according to the timestamp by taking the current moment as a starting point until the timestamp of the next instruction is smaller than the first snapshot point, and stopping executing to obtain the memory state of the simulator at the first snapshot point.
Optionally, the apparatus further comprises:
a second receiving module, configured to receive a second recovery instruction, where the second recovery instruction carries a second instruction, and the second instruction is used to instruct the simulator to recover the memory state to a second time, where the second time is any time between a second snapshot point and the first snapshot point, and the second snapshot point is before the first snapshot point;
and the fourth recovery module is used for sequentially and reversely executing the instructions between the first snapshot point and the second snapshot point in the access and storage operation record by taking the first snapshot point as a starting point according to the timestamp, and stopping executing until the timestamp of the next instruction is smaller than the second moment so as to obtain the memory state of the simulator at the second moment.
Optionally, the simulator is configured to simulate an operation process of the processor to be tested, and the first snapshot point is configured to synchronize a state of the simulator with a state of an interrupt point of the processor to be tested.
To sum up, an embodiment of the present invention provides a data recovery apparatus, where, when a first recovery instruction for a first snapshot point is received, register state information and a memory access operation record corresponding to the first snapshot point are read from a preset snapshot space, a register state of a simulator is recovered to a state of the first snapshot point according to the register state information, and each memory access instruction between the first snapshot point and a current time is executed in a reverse direction according to the memory access operation record, so as to recover a memory state of the simulator to the state corresponding to the first snapshot point. Compared with the prior art, the data recovery method provided by the embodiment of the invention can recover the memory state of the simulator to the state corresponding to the snapshot point only through the register state information and the memory access record corresponding to the snapshot point without recording the complete state of the memory at the snapshot point, so that the storage space is saved. In addition, the embodiment of the invention directly executes the data recovery operation by the simulator without the need of the operating system to carry out system call, thereby saving the hardware overhead brought by the system call of the operating system.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
With regard to the data recovery apparatus in the above-mentioned embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 3 is a block diagram of an electronic device for data recovery according to an embodiment of the present invention. As shown in fig. 3, the electronic device includes: the system comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete mutual communication through the communication bus; the memory is used for storing executable instructions which enable the processor to execute the data recovery method of the previous embodiment.
The Processor may be a CPU (Central Processing Unit), a general-purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field programmable Gate Array), or other programmable device, transistor logic device, hardware component, or any combination thereof. The processor may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs, and microprocessors, among others.
The communication bus may include a path to transfer information between the memory and the communication interface. The communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one line is shown in FIG. 3, but this does not represent only one bus or one type of bus.
The memory may be a ROM (Read Only memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access memory) or other types of dynamic storage devices that can store information and instructions, and may also be an EEPROM (Electrically Erasable Programmable Read Only memory), a CD-ROM (Compact disc Read Only memory), a magnetic tape, a floppy disk, an optical data storage device, and the like.
Embodiments of the present invention also provide a non-transitory computer-readable storage medium, where instructions in the storage medium, when executed by a processor of an electronic device (server or terminal), enable the processor to execute the data recovery method shown in fig. 1.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one of skill in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a predictive manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "include", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or terminal device including a series of elements includes not only those elements but also other elements not explicitly listed or inherent to such process, method, article, or terminal device. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or terminal apparatus that comprises the element.
The data recovery method, the data recovery device, the electronic device and the readable storage medium provided by the present invention are described in detail above, and a specific example is applied in the text to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A data recovery method, applied to a simulator, the method comprising:
receiving a first recovery instruction, wherein the first recovery instruction carries a first snapshot point;
in response to the first recovery instruction, reading register state information and a memory access operation record corresponding to the first snapshot point from a preset snapshot space, wherein the memory access operation record is used for recording each memory access instruction executed by the simulator from the first snapshot point to the current moment and a timestamp corresponding to each memory access instruction;
restoring the register state of the simulator to the state corresponding to the first snapshot point according to the register state information;
and reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record so as to restore the memory state of the simulator to the state corresponding to the first snapshot point.
2. The method according to claim 1, wherein the first restore instruction further carries a first indication, the first indication is used to indicate the simulator to restore the memory state to a first time, and the first snapshot point is before the first time; the method further comprises the following steps:
and taking the first snapshot point as a starting point, executing each memory access instruction between the first snapshot point and the current moment according to the time stamp sequence, and stopping executing until the time stamp corresponding to the next instruction is smaller than the first moment to obtain the memory state of the simulator at the first moment.
3. The method of claim 1, wherein the access operation record comprises each access instruction executed by the simulator from a starting snapshot point to a current moment and a timestamp corresponding to each access instruction; the reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record to restore the memory state of the simulator to the state corresponding to the first snapshot point comprises the following steps:
and sequentially and reversely executing each instruction in the memory access operation record according to the timestamp by taking the current moment as a starting point, and stopping executing until the timestamp of the next instruction is smaller than the first snapshot point to obtain the memory state of the simulator at the first snapshot point.
4. The method of claim 3, further comprising:
receiving a second recovery instruction, where the second recovery instruction carries a second instruction, and the second instruction is used to instruct the simulator to recover the memory state to a second time, where the second time is any time between a second snapshot point and the first snapshot point, and the second snapshot point is before the first snapshot point;
and sequentially and reversely executing the instructions between the first snapshot point and the second snapshot point in the access operation record according to the time stamps by taking the first snapshot point as a starting point until the time stamp of the next instruction is less than the second moment, stopping executing, and obtaining the memory state of the simulator at the second moment.
5. The method according to any one of claims 1 to 4, wherein the simulator is configured to simulate a running process of a processor under test, and the first snapshot point is configured to synchronize a state of the simulator with a state of an interrupt point of the processor under test.
6. A data recovery apparatus, for use in a simulator, the apparatus comprising:
a first receiving module, configured to receive a first recovery instruction, where the first recovery instruction carries a first snapshot point;
the data acquisition module is used for responding to the first recovery instruction, reading register state information and a memory access operation record corresponding to the first snapshot point from a preset snapshot space, wherein the memory access operation record is used for recording each memory access instruction executed by the simulator from the first snapshot point to the current moment and a timestamp corresponding to each memory access instruction;
the first recovery module is used for recovering the register state of the simulator to the state corresponding to the first snapshot point according to the register state information;
and the second recovery module is used for reversely executing each memory access instruction between the first snapshot point and the current moment according to the memory access operation record so as to recover the memory state of the simulator to the state corresponding to the first snapshot point.
7. The apparatus according to claim 6, wherein the first restore instruction further carries a first indication, where the first indication is used to indicate that the simulator restores the memory state to a first time, and the first snapshot point is before the first time; the device further comprises:
and the third recovery module is used for executing each memory access instruction between the first snapshot point and the current moment according to the time stamp sequence by taking the first snapshot point as a starting point until the time stamp corresponding to the next instruction is smaller than the first moment, and stopping executing to obtain the memory state of the simulator at the first moment.
8. The device of claim 6, wherein the access operation record includes each access instruction executed by the simulator from a starting snapshot point to a current time and a timestamp corresponding to each access instruction; the second recovery module comprising:
and the instruction execution submodule is used for sequentially and reversely executing each instruction in the access operation record according to the timestamp by taking the current moment as a starting point until the timestamp of the next instruction is smaller than the first snapshot point, and stopping executing to obtain the memory state of the simulator at the first snapshot point.
9. An electronic device, comprising a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is for storing executable instructions that cause the processor to perform the data recovery method of any of claims 1 to 5.
10. A readable storage medium, wherein instructions in the readable storage medium, when executed by a processor of an electronic device, enable the processor to perform the data recovery method of any one of claims 1 to 5.
CN202211663534.3A 2022-12-23 2022-12-23 Data recovery method and device, electronic equipment and readable storage medium Active CN115629917B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211663534.3A CN115629917B (en) 2022-12-23 2022-12-23 Data recovery method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211663534.3A CN115629917B (en) 2022-12-23 2022-12-23 Data recovery method and device, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN115629917A true CN115629917A (en) 2023-01-20
CN115629917B CN115629917B (en) 2023-03-21

Family

ID=84909642

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211663534.3A Active CN115629917B (en) 2022-12-23 2022-12-23 Data recovery method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115629917B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105354113A (en) * 2015-11-27 2016-02-24 上海爱数信息技术股份有限公司 Server, and system and method for managing server
EP1151374B1 (en) * 1999-01-28 2017-08-02 Advanced Silicon Technologies, LLC Executing programs for a first computer architecture on a computer of a second architecture
CN107957918A (en) * 2016-10-14 2018-04-24 腾讯科技(深圳)有限公司 Data reconstruction method and device
CN115202931A (en) * 2022-07-18 2022-10-18 曙光信息产业(北京)有限公司 Data recovery method, apparatus, device, storage medium and program product
CN115421856A (en) * 2022-09-01 2022-12-02 阿里巴巴(中国)有限公司 Data recovery method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1151374B1 (en) * 1999-01-28 2017-08-02 Advanced Silicon Technologies, LLC Executing programs for a first computer architecture on a computer of a second architecture
CN105354113A (en) * 2015-11-27 2016-02-24 上海爱数信息技术股份有限公司 Server, and system and method for managing server
CN107957918A (en) * 2016-10-14 2018-04-24 腾讯科技(深圳)有限公司 Data reconstruction method and device
CN115202931A (en) * 2022-07-18 2022-10-18 曙光信息产业(北京)有限公司 Data recovery method, apparatus, device, storage medium and program product
CN115421856A (en) * 2022-09-01 2022-12-02 阿里巴巴(中国)有限公司 Data recovery method and device

Also Published As

Publication number Publication date
CN115629917B (en) 2023-03-21

Similar Documents

Publication Publication Date Title
CN105843741B (en) Information processing method and device for application program
CN110659256B (en) Multi-computer room synchronization method, computing device and computer storage medium
US8250543B2 (en) Software tracing
KR870002504A (en) Fault recovery method and apparatus in the calculation system
CN104246767A (en) Telemetry system for a cloud synchronization system
CN106681862B (en) Data incremental recovery method and device
CN110795287A (en) Data recovery method, system, electronic device and computer storage medium
CN109284331B (en) Certificate making information acquisition method based on service data resources, terminal equipment and medium
CN114896641A (en) Data verification method and device, electronic equipment and computer readable storage medium
CN110955598A (en) Breakpoint processing method and device of kernel mode program
CN115686961A (en) Processor testing method and device and electronic equipment
CN115629968A (en) Test data recording method and device
CN115827636A (en) Method for storing and reading simulation data of logic system design from waveform database
CN105912467B (en) Performance test method and device
CN115629917B (en) Data recovery method and device, electronic equipment and readable storage medium
CN114490543A (en) Transaction log implementation method, device, equipment and medium for memory multidimensional database
CN111413952B (en) Robot fault detection method and device, electronic equipment and readable storage medium
CN108108467B (en) Data deleting method and device
CN114610530A (en) Disaster tolerance switching method and device for business system, electronic equipment and storage medium
CN105138429B (en) A kind of Copy on write Snapshot Method and system
CN114239296A (en) Data processing method and device and electronic equipment
CN113760608A (en) Data recovery method and device, electronic equipment and storage medium
CN108958968B (en) File processing method and device
CN110837433A (en) Performance optimization method and device and electronic equipment
CN103678117A (en) Data transition tracing apparatus and data transition tracing method

Legal Events

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