WO2022267812A1 - Software recovery method, electronic device, and storage medium - Google Patents

Software recovery method, electronic device, and storage medium Download PDF

Info

Publication number
WO2022267812A1
WO2022267812A1 PCT/CN2022/095332 CN2022095332W WO2022267812A1 WO 2022267812 A1 WO2022267812 A1 WO 2022267812A1 CN 2022095332 W CN2022095332 W CN 2022095332W WO 2022267812 A1 WO2022267812 A1 WO 2022267812A1
Authority
WO
WIPO (PCT)
Prior art keywords
software
self
healing
target operating
healing position
Prior art date
Application number
PCT/CN2022/095332
Other languages
French (fr)
Chinese (zh)
Inventor
苏勇刚
雒主纲
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2022267812A1 publication Critical patent/WO2022267812A1/en

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/1415Saving, restoring, recovering or retrying at system level
    • G06F11/142Reconfiguring to eliminate the error
    • G06F11/1425Reconfiguring to eliminate the error by reconfiguration of node membership
    • 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
    • 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/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating

Definitions

  • the embodiments of the present application relate to the field of embedded systems, and in particular to a software restoration method, electronic equipment and storage media.
  • Embedded system is a computer system embedded in a mechanical or electrical system with specific functions and real-time computing performance.
  • Embedded System is a computer system embedded in a mechanical or electrical system with specific functions and real-time computing performance.
  • Embedded System is a computer system embedded in a mechanical or electrical system with specific functions and real-time computing performance.
  • the embedded system has high requirements for comprehensive adaptation of hardware and software, and it is prone to software and hardware abnormalities.
  • the software has abnormal memory stampede due to irregular codes
  • the hardware has abnormalities due to external temperature and voltage problems. Wait.
  • the embodiment of the present application provides a software recovery method, including: when the software runs to a preset self-healing position point, acquire and save the target operating variable of the software, the self-healing position point is at least one; if detected If the software runs abnormally, restore the software according to the target running variable.
  • the embodiment of the present application also provides a software recovery method, including: when the software is running, detecting whether the software is running abnormally; if it is detected that the software is running abnormally, calling the self-healing module to restore the software, so
  • the self-healing module obtains and saves the target operating variable of the software when the software runs to the preset self-healing position, and when called, restores the software according to the target operating variable, so There is at least one self-healing location point.
  • the embodiment of the present application also provides an electronic device, including: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores information that can be executed by the at least one processor. instructions, the instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned software recovery method.
  • the embodiment of the present application also provides a computer-readable storage medium storing a computer program, and implementing the above-mentioned software recovery method when the computer program is executed by a processor.
  • FIG. 1 is a schematic diagram of the principle of a software recovery method provided in an embodiment of the present application
  • Fig. 2 is a schematic flow chart of the software restoration method provided by the embodiment of the present application.
  • FIG. 3 is a schematic flow chart of the refinement steps of S102 in the software restoration method provided in the embodiment of the present application;
  • FIG. 4 is an example flow diagram of a software recovery method provided in an embodiment of the present application.
  • FIG. 5 is an example diagram of a recovery process in a software recovery method provided in an embodiment of the present application.
  • FIG. 6 is another schematic diagram of the principle of the software recovery method provided by the embodiment of the present application.
  • Fig. 7 is another schematic flowchart of the software restoration method provided by the embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • it relates to a software recovery method, by presetting the self-healing position point in the software, when the software runs to the self-healing position point, the target operating variable of the software is acquired and saved; when the abnormality of the software is detected The software is restored according to the target operating variables. Since the self-healing position point can be preset according to the different running progress of the software, the software can be recovered according to the target operating variable of the self-healing position point, so that the software can be recovered from the position nearer before the abnormal operation, thereby shortening the time for software recovery The required time is improved, the real-time performance of recovery is improved, and the impact on the business progress of the software is reduced at the same time.
  • the software recovery method of the embodiment of the present application can be applied to an embedded system, and the specific execution subject can be a certain module of the embedded system, such as a self-healing module as shown in Figure 1, wherein Figure 1 is provided by the embodiment of the present application Schematic diagram of the software recovery method.
  • the self-healing module presets the self-healing position point in the software, and when it detects that the software is running abnormally (after the abnormality is triggered by the hardware device in Figure 1, the self-healing module obtains the abnormal information for detection), Perform business recovery on the software based on the self-healing location point.
  • the self-healing module is used as the execution subject for illustration.
  • the granularity can be set larger, for example, a self-healing position point is preset for a function of the software, so that the number of preset self-healing position points can be reduced and the storage
  • the storage space required by the target operating variables of the software but it will reduce the accuracy of software recovery, and the deviation from the execution progress of the software before business recovery is large; the granularity can also be set smaller, such as a function preset for the software
  • a self-healing position point which can improve the accuracy of software recovery and reduce the deviation from the execution progress of the software before business recovery, but it will increase the preset number of self-healing position points and increase the target operating variables of the saved software required storage space.
  • the preset of the self-healing position point can be set according to factors such as the storage space of the embedded system itself, the complexity of the software itself, the recovery time requirement, and the recovery accuracy requirement, which are not limited in this embodiment of the present application.
  • the target operating variable of the self-healing position point obtain and save the increase of the target operating variable of the current self-healing position point relative to the target operating variable of the previous self-healing position point quantity.
  • the target operating variable of the current self-healing position is acquired and saved. Since the memory of an embedded system is generally limited, saving in incremental form can reduce the occupation of the storage space of the embedded system by the target running variable.
  • the granularity of self-healing position points can be set smaller, which improves the accuracy of software recovery and reduces the Deviations in the execution progress of the software before business recovery.
  • the target operating variable refers to the corresponding operating variable when the software is at the current self-healing position.
  • the specific target operating variable can be set according to actual needs, as long as the software can resume operation according to the target operating variable.
  • all the running variables of the software can be used as the target running variables.
  • the target operating variable is a key variable that affects the secondary operation of the software, such as key information such as memory, PC pointer and register information, which can reduce the storage space of the embedded system for the saved target operating variable. It can also shorten the time required for software recovery and improve the efficiency of software recovery.
  • the hardware device Since the hardware device will have abnormal state information when the software is running abnormally, when detecting whether the software is running abnormally, it can be triggered by the hardware device in the embedded system, and then detected by the self-healing module. For example, when a hardware device interrupts an instruction, it triggers an exception, and the self-healing module captures the corresponding exception information. When an exception is triggered by a hardware device, the hardware device is required to support reporting the status information of the hardware exception to the self-healing module.
  • the specific detection method for abnormal software operation can be set according to the actual situation. For example, it can also be implemented by other monitoring software or scripts. There is no limitation here, as long as information about abnormal software operation can be detected.
  • S102 may include: if the abnormality of the software is detected, analyzing the type of the abnormality; if the type of the abnormality is self-healing, restoring the software according to the target operating variable, otherwise restarting the software.
  • the type of abnormal operation is self-healing, it indicates that self-healing can be achieved by restoring the target operating variable at the self-healing position point, then restore the software according to the target operating variable; if the type of abnormal operation is non-self-healing , it indicates that the self-healing cannot be achieved by restoring the target operating variable of the self-healing position point, and the software is restarted directly to recover, avoiding an invalid recovery process.
  • the type of abnormal operation is self-healing or non-self-healing, it can be pre-configured in the self-healing module.
  • after recovering the software according to the target operating variables it also includes: obtaining and saving the abnormal information and self-healing time of the software recovery this time, so that statistics and evaluation of the effect of the software recovery can be conveniently performed, and Further analyze and improve the setting of self-healing position points, so as to further improve the effect of software recovery.
  • restoring the software according to the target operating variable may include the following steps:
  • S1021 Restore the target operating variables of the self-healing position points one by one according to the order in which the self-healing position points are saved.
  • the self-healing position points are saved in increments, if the restoration of the previous self-healing position point fails, the restoration of the following self-healing position points will fail, and the self-healing position points will be restored one by one according to the order in which the self-healing position points are saved , the software can be restored to the last self-healing point where the restoration was successful, and the self-healing of the software can be realized.
  • an integrity check of the target operating variable may be performed. Specifically, after S101, that is, after acquiring and saving the target operating variables of the software, calculate and save the first integrity characteristic value of the target operating variables; then, before restoring the target operating variables of each self-healing position point, Calculate the second integrity eigenvalue of the target operating variable corresponding to the self-healing position point that needs to be restored currently. If the second integrity eigenvalue is equal to the first integrity eigenvalue, it indicates that the backup of the target operating variable is complete, then restore The target operating variable of the current self-healing position point, otherwise it is judged that the restoration of the current self-healing position point fails.
  • the first integrity characteristic value and the second integrity characteristic value are used to verify the integrity of the backup of the target operating variable, and the specific selected value can be selected according to actual needs, for example, it can be CRC (Cyclic Redundancy Check, Cyclic redundancy check) value or MD5 (MD5Message-Digest Algorithm, MD5 message digest algorithm) value, etc., there is no limitation here.
  • the integrity check of the target operating variable can be performed to ensure that the restoration of the self-healing point is successful;
  • the backup of the target operating variable is incomplete, it is determined that the restoration of the current self-healing position fails, and the incomplete self-healing position point can be automatically identified as an invalid self-healing position point.
  • the self-healing position points store target operating variables in incremental form
  • the current self-healing position is not the first self-healing position point, it indicates that at least one self-healing position point is a valid self-healing position point, and the PC pointer points to the previous self-healing position point (also the last restored position point) successful self-healing point) from which to resume software operation.
  • the self-healing position points save the target operating variables in the form of increments. If the target operating variables are saved in the form of full quantities, the software can be restored from the last self-healing position point. If the last If one self-healing point is successfully restored, it is not necessary to restore other self-healing points, and the software can be restored directly; One self-healing location point restored successfully; if all self-healing location points fail to restore, restart the software.
  • the software may also be composed of several modules with little correlation. Therefore, when presetting the self-healing position points, it is necessary to set different self-healing position points for these modules separately. At this time, the The self-healing points are independent of each other; when the software is restored according to the target operating variables, the self-healing points of all modules must be successfully restored to realize the self-healing of the software.
  • multiple self-healing points can still be set, such as the same function or function at different time points, when the target running variable of the self-healing point in the module is saved, it can still be set as Save in incremental form to reduce storage space usage.
  • FIG. 4 is an example diagram of a software restoration method according to an embodiment of the present application.
  • the specific process is as follows:
  • the software searches for the self-healing location according to the logic of the business.
  • the self-healing module obtains key information that affects the secondary operation of the business, such as the memory of the software, PC pointers, and register information, as the target operation variable and save, and calculate the CRC value of the saved target running variable to verify the integrity of the target running variable backup;
  • the self-healing module first judges whether the current number of self-healing exceeds the threshold (this value can be built-in or issued by the network management); if it exceeds the threshold, it indicates that the number of self-healing is too large, and there may be a large software failure, which needs to be restarted software, enter 8; if the threshold is not exceeded, enter 3;
  • the self-healing module obtains the abnormal information of software operation (here is the abnormal information reported by the hardware device), analyzes the abnormal type, and saves the abnormal information;
  • the self-healing module judges whether self-healing is currently possible according to the abnormal type, and if so, enter 5, otherwise enter 9;
  • the self-healing module clears the abnormal state bit, abnormal interrupt, abnormal register and other information of the hardware device according to the analyzed abnormal type, so that the hardware device can normally trigger the abnormal state when it recognizes the abnormal state next time;
  • the software recovery method by presetting the self-healing position point in the software, when the software runs to the self-healing position point, the target operating variable of the software is obtained and saved; Variables are restored by the software. Since the self-healing position point can be preset according to the different running progress of the software, the software can be recovered according to the target operating variable of the self-healing position point, so that the software can be recovered from the position nearer before the abnormal operation, thereby shortening the time for software recovery It improves the real-time performance of embedded system software recovery, and at the same time reduces the impact on the execution progress of embedded system software business.
  • it relates to a software recovery method.
  • the software When the software is running, it is detected whether the software is running abnormally; When the preset self-healing position point is reached, the target operating variable of the software is obtained and saved, and when called, the software is restored according to the target operating variable, and there is at least one self-healing position point.
  • the self-healing module By calling the self-healing module actively by the software itself, the software can achieve the effect of active self-healing.
  • the execution subject of the software restoration method provided by the embodiment of the present application is the software of the embedded system itself, such as the software shown in Figure 6, where Figure 6 is a principle example of the software restoration method provided by the embodiment of the present application picture.
  • the software detects whether an abnormality occurs at its own software level during operation, and actively calls the self-healing module to restore the software when an abnormality occurs. Since it is the software itself that detects whether the software level is abnormal, it is necessary for the software to support the abnormality detection function at the software level.
  • the self-healing module is called to recover the software.
  • the self-healing module acquires and saves the target running variable of the software, and when called, The software is restored according to the target operating variables, and there is at least one self-healing position point.
  • the software recovery method provided by the embodiment of the present application detects whether the operation is abnormal through the software itself, and actively invokes the self-healing module to realize the self-healing of the software when the operation is abnormal, which can achieve the effect of active self-healing of the software and improve the recovery time of the embedded system recovery software. Diversity in concrete implementations.
  • this embodiment is an embodiment applied to the software side corresponding to the foregoing method embodiments, and this embodiment can be implemented in cooperation with the foregoing method embodiments.
  • the relevant technical details mentioned in the foregoing method embodiments are still valid in this embodiment, and will not be repeated here in order to reduce repetition.
  • the relevant technical details mentioned in this embodiment may also be applied to the foregoing method embodiments.
  • FIG. 8 it relates to an electronic device, as shown in FIG. 8 , including: at least one processor 301; and a memory 302 communicatively connected to at least one processor 301; Instructions executed by the processor 301, the instructions are executed by at least one processor 301, so that the at least one processor 301 can execute the above software restoration method.
  • the memory and the processor are connected by a bus
  • the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors and various circuits of the memory together.
  • the bus may also connect together various other circuits such as peripherals, voltage regulators, and power management circuits, all of which are well known in the art and therefore will not be further described herein.
  • the bus interface provides an interface between the bus and the transceivers.
  • a transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing means for communicating with various other devices over a transmission medium.
  • the data processed by the processor is transmitted on the wireless medium through the antenna, further, the antenna also receives the data and transmits the data to the processor.
  • the processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. Instead, memory may be used to store data that the processor uses when performing operations.
  • it relates to a computer readable storage medium storing a computer program.
  • the above method embodiments are implemented when the computer program is executed by the processor.
  • a storage medium includes several instructions to make a device ( It may be a single-chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The embodiments of the present application relate to the field of embedded systems. Disclosed is a software recovery method, comprising: when software runs to a preset self-healing position point, acquiring and storing a target running variable of the software, wherein there is at least one self-healing position point; and if it is detected that the software runs abnormally, recovering the software according to the target running variable. Further disclosed in the embodiments of the present application are an electronic device and a storage medium.

Description

软件恢复方法、电子设备及存储介质Software recovery method, electronic device and storage medium
交叉引用cross reference
本申请基于申请号为“202110700003.6”、申请日为2021年06月23日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。This application is based on the Chinese patent application with the application number "202110700003.6" and the filing date is June 23, 2021, and claims the priority of the Chinese patent application. The entire content of the Chinese patent application is hereby incorporated by reference. Application.
技术领域technical field
本申请实施例涉及嵌入式系统领域,特别涉及一种软件恢复方法、电子设备及存储介质。The embodiments of the present application relate to the field of embedded systems, and in particular to a software restoration method, electronic equipment and storage media.
背景技术Background technique
嵌入式系统(Embedded System),是一种嵌入机械或电气系统内部、具有专一功能和实时计算性能的计算机系统。当前应用于各行各业的嵌入式系统越来越多,在嵌入应用的过程中,由于嵌入式系统中各种嵌入式设备适配的要求不同,例如有的适配高温,有的适配低温,使得嵌入式系统对于硬件和软件层面综合适配的要求较高,容易出现软件和硬件异常的问题,例如软件由于代码不规范导致内存踩踏出现异常,硬件由于外界的温度、电压等问题出现异常等。Embedded system (Embedded System) is a computer system embedded in a mechanical or electrical system with specific functions and real-time computing performance. At present, there are more and more embedded systems used in various industries. In the process of embedded applications, due to the different requirements for the adaptation of various embedded devices in embedded systems, for example, some are suitable for high temperature, and some are suitable for low temperature. , so that the embedded system has high requirements for comprehensive adaptation of hardware and software, and it is prone to software and hardware abnormalities. For example, the software has abnormal memory stampede due to irregular codes, and the hardware has abnormalities due to external temperature and voltage problems. Wait.
目前,当嵌入式系统出现以上问题时,主要通过以下两种方式解决:一是通过系统关机后重启的方式,一是通过初始化配置方式进行恢复。然而,通过关机重启的方式恢复周期较长,恢复的实时性较差,特别对于恢复实时性要求较强的嵌入式系统而言更是不能适用;而通过初始化配置方式进行恢复的方式,需要软件对应的业务重新运行,对业务的执行进度造成较大影响。At present, when the above problems occur in the embedded system, there are mainly two ways to solve them: one is to restart the system after shutting down the system, and the other is to recover by initializing the configuration. However, the recovery cycle through shutdown and restart is long, and the real-time performance of recovery is poor, especially for embedded systems with strong real-time recovery requirements; and the recovery method through initialization configuration requires software. The re-running of the corresponding business has a great impact on the execution progress of the business.
发明内容Contents of the invention
本申请实施例提供了一种软件恢复方法,包括:在软件运行至预设的自愈 位置点时,获取并保存所述软件的目标运行变量,所述自愈位置点至少为一个;若检测到所述软件运行异常,则根据所述目标运行变量对所述软件进行恢复。The embodiment of the present application provides a software recovery method, including: when the software runs to a preset self-healing position point, acquire and save the target operating variable of the software, the self-healing position point is at least one; if detected If the software runs abnormally, restore the software according to the target running variable.
本申请实施例还提供了一种软件恢复方法,包括:在软件运行时,检测所述软件是否运行异常;若检测到所述软件运行异常,则调用自愈模块对所述软件进行恢复,所述自愈模块在所述软件运行至预设的自愈位置点时,获取并保存所述软件的目标运行变量,并在被调用时,根据所述目标运行变量对所述软件进行恢复,所述自愈位置点至少为一个。The embodiment of the present application also provides a software recovery method, including: when the software is running, detecting whether the software is running abnormally; if it is detected that the software is running abnormally, calling the self-healing module to restore the software, so The self-healing module obtains and saves the target operating variable of the software when the software runs to the preset self-healing position, and when called, restores the software according to the target operating variable, so There is at least one self-healing location point.
本申请实施例还提供了一种电子设备,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够上述的软件恢复方法。The embodiment of the present application also provides an electronic device, including: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores information that can be executed by the at least one processor. instructions, the instructions are executed by the at least one processor to enable the at least one processor to perform the above-mentioned software recovery method.
本申请实施例还提供了一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现上述的软件恢复方法。The embodiment of the present application also provides a computer-readable storage medium storing a computer program, and implementing the above-mentioned software recovery method when the computer program is executed by a processor.
附图说明Description of drawings
一个或多个实施例通过与之对应的附图中的图片进行示例性说明,这些示例性说明并不构成对实施例的限定。One or more embodiments are exemplified by pictures in the accompanying drawings, and these exemplifications are not intended to limit the embodiments.
图1是本申请实施例提供的软件恢复方法的原理示意图;FIG. 1 is a schematic diagram of the principle of a software recovery method provided in an embodiment of the present application;
图2是本申请实施例提供的软件恢复方法的流程示意图;Fig. 2 is a schematic flow chart of the software restoration method provided by the embodiment of the present application;
图3是本申请实施例提供的软件恢复方法中S102细化步骤的流程示意图;FIG. 3 is a schematic flow chart of the refinement steps of S102 in the software restoration method provided in the embodiment of the present application;
图4是本申请实施例提供的软件恢复方法的流程示例图;FIG. 4 is an example flow diagram of a software recovery method provided in an embodiment of the present application;
图5是本申请实施例提供的软件恢复方法中恢复流程的流程示例图;FIG. 5 is an example diagram of a recovery process in a software recovery method provided in an embodiment of the present application;
图6是本申请实施例提供的软件恢复方法的另一原理示意图;FIG. 6 is another schematic diagram of the principle of the software recovery method provided by the embodiment of the present application;
图7是本申请实施例提供的软件恢复方法的另一流程示意图;Fig. 7 is another schematic flowchart of the software restoration method provided by the embodiment of the present application;
图8是本申请实施例提供的电子设备的结构示意图。FIG. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
具体实施方式detailed description
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请的各实施例进行详细的阐述。然而,本领域的普通技术人员可以理解, 在本申请各实施例中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施例的种种变化和修改,也可以实现本申请所要求保护的技术方案。以下各个实施例的划分是为了描述方便,不应对本申请的具体实现方式构成任何限定,各个实施例在不矛盾的前提下可以相互结合相互引用。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below with reference to the accompanying drawings. However, those of ordinary skill in the art can understand that in each embodiment of the application, many technical details are provided for readers to better understand the application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed in this application can also be realized. The division of the following embodiments is for the convenience of description, and should not constitute any limitation to the specific implementation of the present application, and the embodiments can be combined and referred to each other on the premise of no contradiction.
在一个实施例中,涉及一种软件恢复方法,通过在软件中预设自愈位置点,在软件运行至自愈位置点时,获取并保存软件的目标运行变量;在检测到软件运行异常时根据目标运行变量对软件进行恢复。由于自愈位置点可以根据软件不同的运行进度进行预设,因此根据自愈位置点的目标运行变量对软件进行恢复,可以使软件从运行异常前较近的位置进行恢复,从而缩短软件恢复所需的时间,提高恢复的实时性,同时降低对软件的业务进度造成的影响。In one embodiment, it relates to a software recovery method, by presetting the self-healing position point in the software, when the software runs to the self-healing position point, the target operating variable of the software is acquired and saved; when the abnormality of the software is detected The software is restored according to the target operating variables. Since the self-healing position point can be preset according to the different running progress of the software, the software can be recovered according to the target operating variable of the self-healing position point, so that the software can be recovered from the position nearer before the abnormal operation, thereby shortening the time for software recovery The required time is improved, the real-time performance of recovery is improved, and the impact on the business progress of the software is reduced at the same time.
本申请实施例的软件恢复方法可以应用于嵌入式系统中,具体的执行主体可以为嵌入式系统的某一模块,例如如图1所示的自愈模块,其中图1为本申请实施例提供的软件恢复方法的原理示意图。如图1所示,自愈模块在软件中预设自愈位置点,在检测到软件运行异常时(在图1中由硬件设备进行异常触发后,由自愈模块获取异常信息进行检测),根据自愈位置点对软件进行业务恢复。为了方便说明,下面具体的示例中以自愈模块作为执行主体为例进行说明。The software recovery method of the embodiment of the present application can be applied to an embedded system, and the specific execution subject can be a certain module of the embedded system, such as a self-healing module as shown in Figure 1, wherein Figure 1 is provided by the embodiment of the present application Schematic diagram of the software recovery method. As shown in Figure 1, the self-healing module presets the self-healing position point in the software, and when it detects that the software is running abnormally (after the abnormality is triggered by the hardware device in Figure 1, the self-healing module obtains the abnormal information for detection), Perform business recovery on the software based on the self-healing location point. For the convenience of description, in the following specific examples, the self-healing module is used as the execution subject for illustration.
本申请实施例提供的软件恢复方法的具体流程如图2所示,包括以下步骤:The specific flow of the software recovery method provided in the embodiment of the present application is shown in Figure 2, including the following steps:
S101:在软件运行至预设的自愈位置点时,获取并保存软件的目标运行变量,自愈位置点至少为一个。S101: When the software runs to a preset self-healing position point, acquire and save the target running variable of the software, and there is at least one self-healing position point.
在预设软件的自愈位置点时,可以将粒度设置得较大,例如针对软件的一个功能预设一个自愈位置点,这样可以使自愈位置点预设的个数较少,减少保存软件的目标运行变量所需的存储空间,但会使软件恢复的精度降低,与软件的业务恢复前的执行进度偏差较大;也可以将粒度设置得较小,例如针对软件的一个函数预设一个自愈位置点,这样可以使软件恢复的精度提高,减少与软件的业务恢复前的执行进度的偏差,但会使自愈位置点预设的个数较多,增加保存软件的目标运行变量所需的存储空间。自愈位置点的预设可以根据嵌入式系统本身的存储空间、软件本身的复杂程度、恢复的时间要求和恢复的精度要求等因素进行设置,本申请实施例对此不做限制。When presetting the self-healing position points of the software, the granularity can be set larger, for example, a self-healing position point is preset for a function of the software, so that the number of preset self-healing position points can be reduced and the storage The storage space required by the target operating variables of the software, but it will reduce the accuracy of software recovery, and the deviation from the execution progress of the software before business recovery is large; the granularity can also be set smaller, such as a function preset for the software A self-healing position point, which can improve the accuracy of software recovery and reduce the deviation from the execution progress of the software before business recovery, but it will increase the preset number of self-healing position points and increase the target operating variables of the saved software required storage space. The preset of the self-healing position point can be set according to factors such as the storage space of the embedded system itself, the complexity of the software itself, the recovery time requirement, and the recovery accuracy requirement, which are not limited in this embodiment of the present application.
若自愈位置点为多个,则在获取并保存自愈位置点的目标运行变量时,获取并保存当前自愈位置点的目标运行变量相对于前一自愈位置点的目标运行变量的增量。特别地,在当前自愈位置点为第一个自愈位置点时,获取并保存当前自愈位置点的目标运行变量。由于嵌入式系统的内存一般比较有限,因此以增量的形式保存可以减少目标运行变量对嵌入式系统的存储空间的占用。由于以增量的形式保存可以减少对嵌入式系统的存储空间的占用,因此相对于全量保存的形式而言,可以将自愈位置点的粒度设置得更小,提高软件恢复的精度,减少与软件的业务恢复前的执行进度的偏差。If there are multiple self-healing position points, when obtaining and saving the target operating variable of the self-healing position point, obtain and save the increase of the target operating variable of the current self-healing position point relative to the target operating variable of the previous self-healing position point quantity. In particular, when the current self-healing position is the first self-healing position, the target operating variable of the current self-healing position is acquired and saved. Since the memory of an embedded system is generally limited, saving in incremental form can reduce the occupation of the storage space of the embedded system by the target running variable. Since saving in incremental form can reduce the storage space occupied by the embedded system, compared with the form of full saving, the granularity of self-healing position points can be set smaller, which improves the accuracy of software recovery and reduces the Deviations in the execution progress of the software before business recovery.
目标运行变量是指软件在当前的自愈位置点时对应的运行变量,具体的目标运行变量可以根据实际需要进行设置,只要使软件可以根据目标运行变量恢复运行即可。在嵌入式系统的存储空间比较充足的情况下,可以将软件所有的运行变量作为目标运行变量。在一个具体的例子中,目标运行变量为影响软件二次运行的关键变量,如内存、PC指针和寄存器信息等关键信息,这样可以减少保存的目标运行变量对嵌入式系统的存储空间的占用,也可以缩短软件恢复所需的时间,提高软件恢复的效率。The target operating variable refers to the corresponding operating variable when the software is at the current self-healing position. The specific target operating variable can be set according to actual needs, as long as the software can resume operation according to the target operating variable. When the storage space of the embedded system is relatively sufficient, all the running variables of the software can be used as the target running variables. In a specific example, the target operating variable is a key variable that affects the secondary operation of the software, such as key information such as memory, PC pointer and register information, which can reduce the storage space of the embedded system for the saved target operating variable. It can also shorten the time required for software recovery and improve the efficiency of software recovery.
S102:若检测到软件运行异常,则根据目标运行变量对软件进行恢复。S102: If it is detected that the software is running abnormally, restore the software according to the target running variable.
由于在软件运行异常时,硬件设备会存在异常的状态信息,因此在检测软件是否运行异常时,可以由嵌入式系统中的硬件设备进行异常触发,再由自愈模块捕获的方式进行检测。例如,硬件设备在发生指令中断时进行异常触发,再由自愈模块捕获相应的异常信息。在由硬件设备进行异常触发时,需要硬件设备支持将硬件异常的状态信息上报给自愈模块。软件运行异常的具体检测方式可以根据实际情况进行设置,例如还可以由其它监测软件或脚本实现,此处不做限制,只要能检测到软件运行异常的信息即可。Since the hardware device will have abnormal state information when the software is running abnormally, when detecting whether the software is running abnormally, it can be triggered by the hardware device in the embedded system, and then detected by the self-healing module. For example, when a hardware device interrupts an instruction, it triggers an exception, and the self-healing module captures the corresponding exception information. When an exception is triggered by a hardware device, the hardware device is required to support reporting the status information of the hardware exception to the self-healing module. The specific detection method for abnormal software operation can be set according to the actual situation. For example, it can also be implemented by other monitoring software or scripts. There is no limitation here, as long as information about abnormal software operation can be detected.
在一个具体的例子中,S102可以包括:若检测到软件运行异常,则解析运行异常的类型;若运行异常的类型为可自愈类型,则根据目标运行变量对软件进行恢复,否则重启软件。在运行异常的类型为可自愈类型时,表明可以通过还原自愈位置点的目标运行变量的方式实现自愈,则根据目标运行变量对软件进行恢复;若运行异常的类型为不可自愈类型时,表明无法通过还原自愈位置点的目标运行变量的方式实现自愈,则直接重启软件进行恢复,避免无效的恢 复过程。至于运行异常的类型具体属于可自愈类型还是不可自愈类型,可以预先在自愈模块中进行配置。In a specific example, S102 may include: if the abnormality of the software is detected, analyzing the type of the abnormality; if the type of the abnormality is self-healing, restoring the software according to the target operating variable, otherwise restarting the software. When the type of abnormal operation is self-healing, it indicates that self-healing can be achieved by restoring the target operating variable at the self-healing position point, then restore the software according to the target operating variable; if the type of abnormal operation is non-self-healing , it indicates that the self-healing cannot be achieved by restoring the target operating variable of the self-healing position point, and the software is restarted directly to recover, avoiding an invalid recovery process. As for whether the type of abnormal operation is self-healing or non-self-healing, it can be pre-configured in the self-healing module.
在一个具体的例子中,在根据目标运行变量对软件进行恢复之后,还包括:获取并保存软件本次恢复的异常信息和自愈时间,这样可以方便对于软件恢复的效果进行统计和评估,以进一步分析和改善自愈位置点的设置,从而进一步提高软件恢复的效果。In a specific example, after recovering the software according to the target operating variables, it also includes: obtaining and saving the abnormal information and self-healing time of the software recovery this time, so that statistics and evaluation of the effect of the software recovery can be conveniently performed, and Further analyze and improve the setting of self-healing position points, so as to further improve the effect of software recovery.
在自愈位置点为多个且目标运行变量以增量的形式保存时,如图3所示,根据目标运行变量对软件进行恢复可以包括以下步骤:When there are multiple self-healing position points and the target operating variable is saved in incremental form, as shown in Figure 3, restoring the software according to the target operating variable may include the following steps:
S1021:按照自愈位置点的保存顺序逐一还原自愈位置点的目标运行变量。S1021: Restore the target operating variables of the self-healing position points one by one according to the order in which the self-healing position points are saved.
由于自愈位置点以增量的形式保存,因此若前一个自愈位置点还原失败,则会导致后面的自愈位置点还原失败,而按照自愈位置点的保存顺序逐一还原自愈位置点,可以使软件恢复至最后一个还原成功的自愈位置点,实现软件的自愈。Since the self-healing position points are saved in increments, if the restoration of the previous self-healing position point fails, the restoration of the following self-healing position points will fail, and the self-healing position points will be restored one by one according to the order in which the self-healing position points are saved , the software can be restored to the last self-healing point where the restoration was successful, and the self-healing of the software can be realized.
在还原自愈位置点的目标运行变量之前,可选地,可以进行目标运行变量的完整性校验。具体地,可以在S101之后,即在获取并保存软件的目标运行变量之后,计算并保存目标运行变量的第一完整性特征值;然后,在还原每一自愈位置点的目标运行变量之前,计算当前需要还原的自愈位置点对应的目标运行变量的第二完整性特征值,若第二完整性特征值与第一完整性特征值相等,表明目标运行变量的备份是完整的,则还原当前自愈位置点的目标运行变量,否则判定当前自愈位置点还原失败。其中,第一完整性特征值和第二完整性特征值是用于校验目标运行变量的备份的完整性的,具体选用的值可以根据实际需要进行选用,例如可以为CRC(Cyclic Redundancy Check,循环冗余校验)值或MD5(MD5Message-Digest Algorithm,MD5訊息摘要演算法)值等,此处不做限制。由于目标运行变量可能会由于出现内存踩踏等原因导致备份不完整,因此在还原自愈位置点的目标运行变量之前先进行目标运行变量的完整性校验,可以保证自愈位置点的还原成功;而在目标运行变量备份不完整时,判定当前自愈位置还原失败,可以自动识别不完整的自愈位置点为无效的自愈位置点。Before restoring the target operating variable at the self-healing point, optionally, an integrity check of the target operating variable may be performed. Specifically, after S101, that is, after acquiring and saving the target operating variables of the software, calculate and save the first integrity characteristic value of the target operating variables; then, before restoring the target operating variables of each self-healing position point, Calculate the second integrity eigenvalue of the target operating variable corresponding to the self-healing position point that needs to be restored currently. If the second integrity eigenvalue is equal to the first integrity eigenvalue, it indicates that the backup of the target operating variable is complete, then restore The target operating variable of the current self-healing position point, otherwise it is judged that the restoration of the current self-healing position point fails. Wherein, the first integrity characteristic value and the second integrity characteristic value are used to verify the integrity of the backup of the target operating variable, and the specific selected value can be selected according to actual needs, for example, it can be CRC (Cyclic Redundancy Check, Cyclic redundancy check) value or MD5 (MD5Message-Digest Algorithm, MD5 message digest algorithm) value, etc., there is no limitation here. Since the backup of the target operating variable may be incomplete due to memory stampede, etc., before restoring the target operating variable of the self-healing point, the integrity check of the target operating variable can be performed to ensure that the restoration of the self-healing point is successful; When the backup of the target operating variable is incomplete, it is determined that the restoration of the current self-healing position fails, and the incomplete self-healing position point can be automatically identified as an invalid self-healing position point.
S1022:若当前自愈位置点还原成功,则继续还原下一自愈位置点。S1022: If the current self-healing position point is successfully restored, continue to restore the next self-healing position point.
S1023:若当前自愈位置点还原失败,则判断当前自愈位置点是否为第一个自愈位置点。S1023: If the restoration of the current self-healing position point fails, determine whether the current self-healing position point is the first self-healing position point.
S1024:若当前自愈位置点为第一个自愈位置点,则重启软件,否则将PC指针指向前一个还原成功的自愈位置点,完成对软件的恢复。S1024: If the current self-healing position point is the first self-healing position point, restart the software; otherwise, point the PC pointer to the previous self-healing position point that was restored successfully, and complete the recovery of the software.
在自愈位置点以增量的形式存储目标运行变量时,若当前自愈位置点为第一个自愈位置点,则表明所有的自愈位置点均为无效的自愈位置点,则无法达到恢复软件的效果,直接重启软件。若当前自愈位置不是第一个自愈位置点,则表明至少有一个自愈位置点是有效的自愈位置点,则将PC指针指向前一个还原成功的自愈位置点(也是最后一个还原成功的自愈位置点),从该自愈位置点恢复软件的运行。When the self-healing position points store target operating variables in incremental form, if the current self-healing position point is the first self-healing position point, it means that all self-healing position points are invalid self-healing position points, and cannot To achieve the effect of restoring the software, restart the software directly. If the current self-healing position is not the first self-healing position point, it indicates that at least one self-healing position point is a valid self-healing position point, and the PC pointer points to the previous self-healing position point (also the last restored position point) successful self-healing point) from which to resume software operation.
特别地,若所有的自愈位置点均还原成功,则将PC指针指向最后一个还原成功的自愈位置点,完成对软件的恢复。In particular, if all the self-healing points are restored successfully, the PC pointer is pointed to the last self-healing point restored successfully, and the restoration of the software is completed.
以上图3所示的例子中,自愈位置点以增量的形式保存目标运行变量,若以全量的形式保存目标运行变量,则可以从最后一个自愈位置点开始对软件进行还原,若最后一个自愈位置点还原成功,则不必再还原其它自愈位置点,直接完成对软件的恢复;若最后一个自愈位置点还原失败,则再往前一个自愈位置点进行还原,直至最先一个还原成功的自愈位置点;若所有的自愈位置点均还原失败,则重启软件。In the above example shown in Figure 3, the self-healing position points save the target operating variables in the form of increments. If the target operating variables are saved in the form of full quantities, the software can be restored from the last self-healing position point. If the last If one self-healing point is successfully restored, it is not necessary to restore other self-healing points, and the software can be restored directly; One self-healing location point restored successfully; if all self-healing location points fail to restore, restart the software.
可以理解的是,软件也可能由几个关联性不大的模块进行组成,因此在预设自愈位置点时,需要对这几个模块单独设置不同的自愈位置点,此时不同模块的自愈位置点是相互独立的;在根据目标运行变量对软件进行恢复时,需要所有模块的自愈位置点均还原成功才能实现软件的自愈。当然,对于软件中的同一模块而言,依然可以设置多个自愈位置点,例如不同时间点相同功能或函数的位置点,模块内的自愈位置点的目标运行变量保存时,依然可以以增量的形式保存,以减少存储空间的占用。It is understandable that the software may also be composed of several modules with little correlation. Therefore, when presetting the self-healing position points, it is necessary to set different self-healing position points for these modules separately. At this time, the The self-healing points are independent of each other; when the software is restored according to the target operating variables, the self-healing points of all modules must be successfully restored to realize the self-healing of the software. Of course, for the same module in the software, multiple self-healing points can still be set, such as the same function or function at different time points, when the target running variable of the self-healing point in the module is saved, it can still be set as Save in incremental form to reduce storage space usage.
为了更好地说明本申请实施例的软件恢复方法,下面以一个具体的示例进行说明。请参考图4,其为本申请实施例的软件恢复方法的一个示例图。其具体的流程如下:In order to better illustrate the software recovery method in the embodiment of the present application, a specific example is used below for illustration. Please refer to FIG. 4 , which is an example diagram of a software restoration method according to an embodiment of the present application. The specific process is as follows:
1、软件启动运行;1. Start the software;
2、软件根据业务的逻辑寻找自愈位置点,当到达第一个自愈位置点时,自愈模块获取软件的内存,PC指针,寄存器信息等影响业务二次运行的关键信息作为目标运行变量并保存,并将保存的目标运行变量计算CRC值,以用于校验目标运行变量备份的完整性;2. The software searches for the self-healing location according to the logic of the business. When the first self-healing location is reached, the self-healing module obtains key information that affects the secondary operation of the business, such as the memory of the software, PC pointers, and register information, as the target operation variable and save, and calculate the CRC value of the saved target running variable to verify the integrity of the target running variable backup;
3、第一个自愈位置点保存之后,软件继续运行;3. After saving the first self-healing position point, the software continues to run;
4、根据软件的运行机制,继续设置软件下一自愈位置点,并存储下一自愈位置点的目标运行变量,此处可根据实际需要重复,存储多个自愈位置点的目标运行变量;4. According to the operating mechanism of the software, continue to set the next self-healing position point of the software, and store the target operating variable of the next self-healing position point, here can be repeated according to actual needs, and store the target operating variables of multiple self-healing position points ;
5、软件继续运行;5. The software continues to run;
6、软件运行发生异常;6. The software runs abnormally;
7、判断是否可以进行恢复,若可以进行恢复,则进入恢复流程,恢复之后再返回5;若不可以进行恢复,则进入8;7. Determine whether recovery can be performed. If recovery can be performed, enter the recovery process, and then return to 5 after recovery; if recovery cannot be performed, enter 8;
8、重启软件;8. Restart the software;
9、结束流程。9. End the process.
其中,恢复流程具体包括的流程示例可以如图5所示,具体包括以下步骤:Wherein, the process example specifically included in the recovery process may be shown in Figure 5, specifically including the following steps:
1、恢复流程开始;1. The recovery process starts;
2、自愈模块首先判断当前自愈的次数是否超过阈值(该值可以内置,也可以由网管下发);若超过阈值,表明自愈次数过多,可能存在较大的软件故障,需要重启软件,则进入8;若未超过阈值,则进入3;2. The self-healing module first judges whether the current number of self-healing exceeds the threshold (this value can be built-in or issued by the network management); if it exceeds the threshold, it indicates that the number of self-healing is too large, and there may be a large software failure, which needs to be restarted software, enter 8; if the threshold is not exceeded, enter 3;
3、自愈模块获取软件运行的异常信息(此处为硬件设备上报的异常信息),并解析异常类型,并将异常信息进行保存;3. The self-healing module obtains the abnormal information of software operation (here is the abnormal information reported by the hardware device), analyzes the abnormal type, and saves the abnormal information;
4、自愈模块根据异常类型判断当前是否可以进行自愈,如果可以则进入5,否则进入9;4. The self-healing module judges whether self-healing is currently possible according to the abnormal type, and if so, enter 5, otherwise enter 9;
5、自愈模块根据解析的异常类型,清除硬件设备的异常状态位、异常中断、异常寄存器等信息,方便硬件设备下一次在识别到异常状态时正常进行异常触发;5. The self-healing module clears the abnormal state bit, abnormal interrupt, abnormal register and other information of the hardware device according to the analyzed abnormal type, so that the hardware device can normally trigger the abnormal state when it recognizes the abnormal state next time;
6、第一个自愈位置点进行恢复;6. The first self-healing point is restored;
7、其它自愈位置点进行恢复;其中,6和7以A、B和C三个自愈位置点为例,A为第一个自愈位置点,先恢复A自愈位置点,将A自愈位置点的目标 运行变量的备份数据重新计算CRC值,若当前的CRC值和之前保存的CRC值一致,则将A自愈位置点保存的目标运行变量进行还原,并记录本次为有效自愈,并继续恢复B自愈位置点;若A自愈位置点还原失败,则进入9;在A自愈位置点还原成功时,继续还原B自愈位置点,先重新计算B自愈位置点的目标运行变量的备份数据的CRC值,如果当前计算的CRC值和之前保存的CRC值一致,则将B自愈位置点保存的目标运行变量进行还原,并记录本次为有效自愈,继续恢复C自愈位置点;若B自愈位置点还原失败,则进入8;在B自愈位置点还原成功时,继续还原C自愈位置点,先重新计算C自愈位置点的目标运行变量的备份数据的CRC值,如果当前计算的CRC值和之前保存的CRC值一致,则将C自愈位置点保存的目标运行变量进行还原,并记录本次为有效自愈,进入7;若C自愈位置点还原失败,则进入8;7. Restoring other self-healing points; among them, 6 and 7 take three self-healing points A, B and C as an example, A is the first self-healing point, restore A self-healing point first, and set A Recalculate the CRC value from the backup data of the target operating variable at the self-healing position point. If the current CRC value is consistent with the previously saved CRC value, restore the target operating variable saved at the self-healing position point and record this time as valid Self-healing, and continue to restore the self-healing point of B; if the restoration of the self-healing point of A fails, go to 9; when the restoration of the self-healing point of A is successful, continue to restore the self-healing point of B, and recalculate the self-healing position of B first The CRC value of the backup data of the target operating variable of the point, if the currently calculated CRC value is consistent with the previously saved CRC value, restore the target operating variable saved at the B self-healing position point, and record this time as an effective self-healing, Continue to restore the self-healing point C; if the restoration of the self-healing point B fails, go to 8; when the restoration of the self-healing point B succeeds, continue to restore the self-healing point C, first recalculate the target operation of the self-healing point C The CRC value of the backup data of the variable, if the currently calculated CRC value is consistent with the previously saved CRC value, restore the target running variable saved at the C self-healing position point, and record that this time is effective self-healing, and enter 7; if C self-healing point restore fails, then enter 8;
8、保存本次软件恢复触发异常的原因(跑死位置,异常原因),以及本次恢复的自愈位置点,并记录本次自愈位置点的自愈次数和自愈时间,以便于通过统计的数据做自愈位置点的粒度分析;最后,将pc指向最后有效恢复记录的自愈位置点,继续软件的业务运行;8. Save the cause of the abnormality triggered by this software recovery (running dead position, abnormal cause), and the self-healing position point of this recovery, and record the self-healing times and self-healing time of this self-healing position point, so as to pass The statistical data is used for granular analysis of the self-healing location point; finally, the PC is pointed to the self-healing location point of the last effective recovery record, and the business operation of the software is continued;
9、保存异常信息和异常位置,并记录自愈次数以及自愈的原因;9. Save the abnormal information and abnormal location, and record the number of times of self-healing and the reason for self-healing;
10、触发重启操作;10. Trigger restart operation;
11、软件启动运行。11. The software starts running.
本申请实施例提供的软件恢复方法,通过在软件中预设自愈位置点,在软件运行至自愈位置点时,获取并保存软件的目标运行变量;在检测到软件运行异常时根据目标运行变量对软件进行恢复。由于自愈位置点可以根据软件不同的运行进度进行预设,因此根据自愈位置点的目标运行变量对软件进行恢复,可以使软件从运行异常前较近的位置进行恢复,从而缩短软件恢复所需的时间,提高嵌入式系统软件恢复的实时性,同时降低对嵌入式系统软件业务的执行进度造成的影响。In the software recovery method provided in the embodiment of the present application, by presetting the self-healing position point in the software, when the software runs to the self-healing position point, the target operating variable of the software is obtained and saved; Variables are restored by the software. Since the self-healing position point can be preset according to the different running progress of the software, the software can be recovered according to the target operating variable of the self-healing position point, so that the software can be recovered from the position nearer before the abnormal operation, thereby shortening the time for software recovery It improves the real-time performance of embedded system software recovery, and at the same time reduces the impact on the execution progress of embedded system software business.
在一个实施例中,涉及一种软件恢复方法,通过在软件运行时,检测软件是否运行异常;若检测到软件运行异常,则调用自愈模块对软件进行恢复,其中,自愈模块在软件运行至预设的自愈位置点时,获取并保存软件的目标运行 变量,并在被调用时,根据目标运行变量对软件进行恢复,自愈位置点至少为一个。通过软件自身主动调用自愈模块,可以使软件达到主动自愈的效果。In one embodiment, it relates to a software recovery method. When the software is running, it is detected whether the software is running abnormally; When the preset self-healing position point is reached, the target operating variable of the software is obtained and saved, and when called, the software is restored according to the target operating variable, and there is at least one self-healing position point. By calling the self-healing module actively by the software itself, the software can achieve the effect of active self-healing.
应当说明的是,本申请实施例提供的软件恢复方法的执行主体为嵌入式系统的软件自身,例如如图6所示的软件,其中图6为本申请实施例提供的软件恢复方法的原理示例图。如图6所示,软件在运行的过程中检测自身的软件层面是否发生异常,在发生异常时主动调用自愈模块对软件进行恢复。由于是软件自身检测软件层面是否异常,因此需要软件支持软件层面的异常检测功能。It should be noted that the execution subject of the software restoration method provided by the embodiment of the present application is the software of the embedded system itself, such as the software shown in Figure 6, where Figure 6 is a principle example of the software restoration method provided by the embodiment of the present application picture. As shown in Figure 6, the software detects whether an abnormality occurs at its own software level during operation, and actively calls the self-healing module to restore the software when an abnormality occurs. Since it is the software itself that detects whether the software level is abnormal, it is necessary for the software to support the abnormality detection function at the software level.
本申请实施例提供的软件恢复方法的具体流程如图7所示,包括以下步骤:The specific flow of the software recovery method provided in the embodiment of the present application is shown in Figure 7, including the following steps:
S201:在软件运行时,检测软件是否运行异常。S201: When the software is running, detect whether the software runs abnormally.
S202:若检测到软件运行异常,则调用自愈模块对软件进行恢复,自愈模块在软件运行至预设的自愈位置点时,获取并保存软件的目标运行变量,并在被调用时,根据目标运行变量对软件进行恢复,自愈位置点至少为一个。S202: If the abnormal operation of the software is detected, the self-healing module is called to recover the software. When the software runs to the preset self-healing position, the self-healing module acquires and saves the target running variable of the software, and when called, The software is restored according to the target operating variables, and there is at least one self-healing position point.
本申请实施例提供的软件恢复方法,通过软件自身检测是否运行异常,在运行异常时,主动调用自愈模块实现软件的自愈,可以达到软件主动自愈的效果,提高嵌入式系统恢复软件在具体实现中的多样性。The software recovery method provided by the embodiment of the present application detects whether the operation is abnormal through the software itself, and actively invokes the self-healing module to realize the self-healing of the software when the operation is abnormal, which can achieve the effect of active self-healing of the software and improve the recovery time of the embedded system recovery software. Diversity in concrete implementations.
不难发现,本实施例为与前述方法的实施例相对应的应用于软件侧的实施例,本实施例可与前述方法的实施例互相配合实施。前述方法的实施例中提到的相关技术细节在本实施例中依然有效,为了减少重复,这里不再赘述。相应地,本实施例中提到的相关技术细节也可应用在前述方法的实施例中。It is not difficult to find that this embodiment is an embodiment applied to the software side corresponding to the foregoing method embodiments, and this embodiment can be implemented in cooperation with the foregoing method embodiments. The relevant technical details mentioned in the foregoing method embodiments are still valid in this embodiment, and will not be repeated here in order to reduce repetition. Correspondingly, the relevant technical details mentioned in this embodiment may also be applied to the foregoing method embodiments.
此外,本领域技术人员可以理解,上面各种方法的步骤划分,只是为了描述清楚,实现时可以合并为一个步骤或者对某些步骤进行拆分,分解为多个步骤,只要包括相同的逻辑关系,都在本专利的保护范围内;对算法中或者流程中添加无关紧要的修改或者引入无关紧要的设计,但不改变其算法和流程的核心设计都在该专利的保护范围内。In addition, those skilled in the art can understand that the division of the steps of the various methods above is only for the sake of clarity of description, and can be combined into one step or split into multiple steps during implementation, as long as the same logical relationship is included , are all within the protection scope of this patent; adding insignificant modifications or introducing insignificant designs to the algorithm or process, but not changing the core design of its algorithm and process are all within the protection scope of this patent.
在一个实施例中,涉及一种电子设备,如图8所示,包括:至少一个处理器301;以及,与至少一个处理器301通信连接的存储器302;其中,存储器302存储有可被至少一个处理器301执行的指令,指令被至少一个处理器301执行,以使至少一个处理器301能够执行上述的软件恢复方法。In one embodiment, it relates to an electronic device, as shown in FIG. 8 , including: at least one processor 301; and a memory 302 communicatively connected to at least one processor 301; Instructions executed by the processor 301, the instructions are executed by at least one processor 301, so that the at least one processor 301 can execute the above software restoration method.
其中,存储器和处理器采用总线方式连接,总线可以包括任意数量的互联的总线和桥,总线将一个或多个处理器和存储器的各种电路连接在一起。总线还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路连接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口在总线和收发机之间提供接口。收发机可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器处理的数据通过天线在无线介质上进行传输,进一步,天线还接收数据并将数据传送给处理器。Wherein, the memory and the processor are connected by a bus, and the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors and various circuits of the memory together. The bus may also connect together various other circuits such as peripherals, voltage regulators, and power management circuits, all of which are well known in the art and therefore will not be further described herein. The bus interface provides an interface between the bus and the transceivers. A transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing means for communicating with various other devices over a transmission medium. The data processed by the processor is transmitted on the wireless medium through the antenna, further, the antenna also receives the data and transmits the data to the processor.
处理器负责管理总线和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器可以被用于存储处理器在执行操作时所使用的数据。The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. Instead, memory may be used to store data that the processor uses when performing operations.
在一个实施例中,涉及一种计算机可读存储介质,存储有计算机程序。计算机程序被处理器执行时实现上述方法实施例。In one embodiment, it relates to a computer readable storage medium storing a computer program. The above method embodiments are implemented when the computer program is executed by the processor.
即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。That is, those skilled in the art can understand that all or part of the steps in the method of the above-mentioned embodiments can be completed by instructing related hardware through a program, the program is stored in a storage medium, and includes several instructions to make a device ( It may be a single-chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .
本领域的普通技术人员可以理解,上述各实施例是实现本申请的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。Those of ordinary skill in the art can understand that the above-mentioned embodiments are specific embodiments for realizing the present application, and in practical applications, various changes can be made to it in form and details without departing from the spirit and spirit of the present application. scope.

Claims (10)

  1. 一种软件恢复方法,包括:A software recovery method comprising:
    在软件运行至预设的自愈位置点时,获取并保存所述软件的目标运行变量,所述自愈位置点至少为一个;When the software runs to a preset self-healing position point, acquire and save the target operating variable of the software, and the self-healing position point is at least one;
    若检测到所述软件运行异常,则根据所述目标运行变量对所述软件进行恢复。If it is detected that the software is running abnormally, the software is restored according to the target running variable.
  2. 根据权利要求1所述的软件恢复方法,其中,所述目标运行变量为影响所述软件二次运行的关键变量,所述关键变量包括以下信息:内存、PC指针和寄存器信息。The software recovery method according to claim 1, wherein the target running variable is a key variable that affects the secondary running of the software, and the key variable includes the following information: memory, PC pointer and register information.
  3. 根据权利要求1或2所述的软件恢复方法,其中,所述自愈位置点为多个,所述获取并保存所述软件的目标运行变量,包括:The software recovery method according to claim 1 or 2, wherein there are multiple self-healing locations, and the acquiring and saving the target operating variables of the software includes:
    在获取并保存自愈位置点的目标运行变量时,获取并保存当前自愈位置点的目标运行变量相对于前一自愈位置点的目标运行变量的增量。When acquiring and saving the target operating variable of the self-healing position point, the increment of the target operating variable of the current self-healing position point relative to the target operating variable of the previous self-healing position point is acquired and saved.
  4. 根据权利要求3所述的软件恢复方法,其中,所述根据所述目标运行变量对所述软件进行恢复,包括:The software restoration method according to claim 3, wherein said restoration of said software according to said target operating variable comprises:
    按照所述自愈位置点的保存顺序逐一还原所述自愈位置点的目标运行变量;Restore the target operating variables of the self-healing position points one by one according to the order in which the self-healing position points are saved;
    若当前自愈位置点还原成功,则继续还原下一自愈位置点;If the current self-healing position is successfully restored, continue to restore the next self-healing position;
    若当前自愈位置点还原失败,则判断当前自愈位置点是否为第一个自愈位置点;If the restoration of the current self-healing position point fails, it is judged whether the current self-healing position point is the first self-healing position point;
    若当前自愈位置点为第一个自愈位置点,则重启所述软件,否则将PC指针指向前一个还原成功的自愈位置点,完成对所述软件的恢复。If the current self-healing position point is the first self-healing position point, then restart the software, otherwise point the PC pointer to the previous self-healing position point that was successfully restored, and complete the recovery of the software.
  5. 根据权利要求4所述的软件恢复方法,其中,在所述获取并保存所述软件的目标运行变量之后,还包括:The software recovery method according to claim 4, wherein, after said acquiring and saving the target operating variables of said software, further comprising:
    计算并保存所述目标运行变量的第一完整性特征值;calculating and saving the first integrity characteristic value of the target operating variable;
    所述按照所述自愈位置点的保存顺序逐一还原所述自愈位置点的目标运行变量,包括:The step of restoring the target operating variables of the self-healing position points one by one according to the order in which the self-healing position points are saved includes:
    按照所述自愈位置点的保存顺序、逐一计算每一自愈位置点对应目标运行变量的第二完整性特征值;According to the order of saving the self-healing position points, calculate the second integrity characteristic value of each self-healing position point corresponding to the target operating variable one by one;
    若所述第二完整性特征值与所述第一完整性特征值相等,则还原当前自愈 位置点的目标运行变量,否则判定当前自愈位置点还原失败。If the second integrity characteristic value is equal to the first integrity characteristic value, the target operating variable of the current self-healing position is restored, otherwise it is determined that the restoration of the current self-healing position fails.
  6. 根据权利要求1至5中任一项所述的软件恢复方法,其中,所述若检测到所述软件运行异常,则根据所述目标运行变量对所述软件进行恢复,包括:The software restoration method according to any one of claims 1 to 5, wherein, if it is detected that the software is running abnormally, restoring the software according to the target operation variable includes:
    若检测到所述软件运行异常,则解析运行异常的类型;If the abnormal operation of the software is detected, the type of abnormal operation is analyzed;
    若所述类型为可自愈类型,则根据所述目标运行变量对所述软件进行恢复,否则重启所述软件。If the type is a self-healing type, restore the software according to the target operating variable, otherwise restart the software.
  7. 根据权利要求1至6中任一项所述的软件恢复方法,其中,在所述根据所述目标运行变量对所述软件进行恢复之后,还包括:The software restoration method according to any one of claims 1 to 6, wherein, after restoring the software according to the target operating variable, further comprising:
    获取并保存所述软件本次恢复的异常信息和自愈时间。Obtain and save the abnormal information and self-healing time of the software recovery this time.
  8. 一种软件恢复方法,包括:A software recovery method comprising:
    在软件运行时,检测所述软件是否运行异常;When the software is running, detect whether the software is running abnormally;
    若检测到所述软件运行异常,则调用自愈模块对所述软件进行恢复,所述自愈模块在所述软件运行至预设的自愈位置点时,获取并保存所述软件的目标运行变量,并在被调用时,根据所述目标运行变量对所述软件进行恢复,所述自愈位置点至少为一个。If it is detected that the software is running abnormally, the self-healing module is called to restore the software, and the self-healing module obtains and saves the target running of the software when the software runs to the preset self-healing position variable, and when called, restore the software according to the target running variable, and the self-healing position is at least one.
  9. 一种电子设备,包括:An electronic device comprising:
    至少一个处理器;以及,at least one processor; and,
    与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至7任一项所述的软件恢复方法或如权利要求8所述的软件恢复方法。The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can perform the operation described in any one of claims 1 to 7. The software recovery method or the software recovery method as claimed in claim 8.
  10. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的软件恢复方法或如权利要求8所述的软件恢复方法。A computer-readable storage medium storing a computer program, which implements the software recovery method according to any one of claims 1 to 7 or the software recovery method according to claim 8 when the computer program is executed by a processor.
PCT/CN2022/095332 2021-06-23 2022-05-26 Software recovery method, electronic device, and storage medium WO2022267812A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110700003.6A CN115509803A (en) 2021-06-23 2021-06-23 Software recovery method, electronic device and storage medium
CN202110700003.6 2021-06-23

Publications (1)

Publication Number Publication Date
WO2022267812A1 true WO2022267812A1 (en) 2022-12-29

Family

ID=84499426

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/095332 WO2022267812A1 (en) 2021-06-23 2022-05-26 Software recovery method, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN115509803A (en)
WO (1) WO2022267812A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931532B (en) * 2024-03-25 2024-05-31 山东科技大学 Multi-granularity recovery method for embedded system program supported by on-chip hardware

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080307255A1 (en) * 2007-06-07 2008-12-11 Ying Chen Failure recovery and error correction techniques for data loading in information warehouses
CN105550056A (en) * 2015-12-11 2016-05-04 中国航空工业集团公司西安航空计算技术研究所 System reconfiguration based fault self-recovery system and realization method therefor
CN109189607A (en) * 2018-08-13 2019-01-11 南京翼辉信息技术有限公司 A kind of method that application program breakpoint restores
CN109391481A (en) * 2017-08-02 2019-02-26 中国电信股份有限公司 Virtualize network element failure self-healing method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080307255A1 (en) * 2007-06-07 2008-12-11 Ying Chen Failure recovery and error correction techniques for data loading in information warehouses
CN105550056A (en) * 2015-12-11 2016-05-04 中国航空工业集团公司西安航空计算技术研究所 System reconfiguration based fault self-recovery system and realization method therefor
CN109391481A (en) * 2017-08-02 2019-02-26 中国电信股份有限公司 Virtualize network element failure self-healing method and device
CN109189607A (en) * 2018-08-13 2019-01-11 南京翼辉信息技术有限公司 A kind of method that application program breakpoint restores

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931532B (en) * 2024-03-25 2024-05-31 山东科技大学 Multi-granularity recovery method for embedded system program supported by on-chip hardware

Also Published As

Publication number Publication date
CN115509803A (en) 2022-12-23

Similar Documents

Publication Publication Date Title
WO2020239060A1 (en) Error recovery method and apparatus
CN111488233A (en) Method and system for processing bandwidth loss problem of PCIe device
US7886181B2 (en) Failure recovery method in cluster system
WO2023109880A1 (en) Service recovery method, data processing unit and related device
CN113360347A (en) Server and control method thereof
CN111737064A (en) BMC system control method and device, storage medium and computer equipment
US7437599B2 (en) System and method for effectively implementing an immunity mode in an electronic device
CN114064234B (en) Method and device for repairing WMI service
US7840853B2 (en) CPU suppression system and CPU suppression method using service processor
WO2022267812A1 (en) Software recovery method, electronic device, and storage medium
US20200285520A1 (en) Information processor, information processing system, and method of processing information
CN108984377B (en) Method, system and medium for counting BIOS log
US20130318310A1 (en) Processor processing method and processor system
US20130091304A1 (en) Communication device, method of controlling communication device, and information processing system
CN107179911A (en) A kind of method and apparatus for restarting management engine
CN109032835B (en) Software regeneration method and device
CN113590416B (en) CPU system firmware assertion processing method, device, equipment and storage medium
CN117234787B (en) Method and system for monitoring running state of system-level chip
KR102438148B1 (en) Abnormality detection apparatus, system and method for detecting abnormality of embedded computing module
US11797368B2 (en) Attributing errors to input/output peripheral drivers
US11995436B2 (en) Out-of-band updating method and system of expander
CN114090309B (en) Method and device for repairing WMI service
US11099838B1 (en) Method and system for recovery for custom integrated circuit
CN117608893A (en) Method, device and related equipment for adjusting correctable error reporting threshold
CN107451035B (en) Error state data providing method for computer device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22827309

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE