Abnormal power failure test method of storage device and related device

By simulating the power-down test method, the asynchronous power-down process of the storage device is recorded and verified, which solves the problems of firmware information loss and low test effectiveness in the existing technology, and achieves efficient and accurate abnormal power-down testing.

CN118672831APending Publication Date: 2024-09-20SHANGHAI LONGSYS DIGITAL TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310251902.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

Existing abnormal power-down testing methods for storage devices cannot properly save firmware information during the power-down process, resulting in difficulty in debugging, wasting time, and affecting test effectiveness.

Method used

By obtaining the asynchronous power-down simulated power-down command of the storage device, the firmware simulates the execution of the asynchronous power-down process, records and counts the execution time of each step, generates simulated power-down status information, determines whether the simulated power-down command runs successfully, and passes the real power-down The power-on process verifies the validity of the test.

Benefits of technology

It effectively improves the efficiency and accuracy of abnormal power-down testing of storage devices, simplifies debugging steps, and improves troubleshooting efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118672831A
    Figure CN118672831A
Patent Text Reader

Abstract

The invention discloses an abnormal power failure test method of storage equipment and a related device. The abnormal power failure test method for the storage equipment comprises the following steps: acquiring a power failure simulation instruction of asynchronous power failure of the storage equipment; according to the power failure simulation instruction, firmware of the storage device executes an asynchronous power failure process in a power failure simulation mode; recording whether the asynchronous power-down process is completed or not, counting execution time of each step in the asynchronous power-down process, and generating simulated power-down state information; and according to the simulated power failure state information, judging whether the simulated power failure instruction runs successfully or not. According to the scheme, the abnormal power failure test efficiency of the storage equipment can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage technology, and in particular to an abnormal power-off testing method for a storage device and a related device. Background Art

[0002] The conventional abnormal power-off test method for storage devices is that the script sends a power-off command to power off, which is in line with the real scenario. However, the firmware information during the power-off process cannot be saved normally. When problems occur, it is difficult to troubleshoot and debugging is cumbersome, wasting time and resources. In addition, it is difficult to confirm whether the test scenario designed by the script is achieved, which affects the effectiveness and coverage of the test. Summary of the invention

[0003] The main technical problem solved by the present application is to provide a method and related apparatus for abnormal power-off testing of a storage device, which can improve the efficiency of abnormal power-off testing of the storage device.

[0004] In order to solve the above problems, the first aspect of the present application provides a method for testing abnormal power-off of a storage device, the method comprising: obtaining a simulated power-off instruction for asynchronous power-off of the storage device; according to the simulated power-off instruction, the firmware of the storage device executes the asynchronous power-off process by simulating power-off; recording whether the asynchronous power-off process is completed, and counting the execution time of each step in the asynchronous power-off process to generate simulated power-off status information; judging whether the simulated power-off instruction is successfully executed according to the simulated power-off status information.

[0005] Wherein, the simulated power-off instruction is provided with a delayed power-off time; before the firmware of the storage device executes the asynchronous power-off process by means of a simulated power-off according to the simulated power-off instruction, the method comprises: the firmware sets a timer according to the delayed power-off time, and sets an asynchronous power-off trigger flag after receiving the simulated power-off instruction and reaching the delayed power-off time.

[0006] Among them, according to the simulated power-off instruction, the firmware of the storage device executes an asynchronous power-off process by simulating power-off, including: the firmware processes the target operation command and stores key internal information of the firmware; wherein the target operation command includes the operation command received before the asynchronous power-off trigger flag is set.

[0007] Among them, the recording of whether the asynchronous power-off process is completed, and the statistics of the execution time of each step in the asynchronous power-off process, generate simulated power-off status information, including: in the process of executing the asynchronous power-off process, the firmware records the execution status, execution time and values ​​of key variables of each module; if the asynchronous power-off process is completed, the generated simulated power-off status is completed; if the firmware cannot power off normally, the generated simulated power-off status is incomplete, and the firmware is debugged.

[0008] Among them, judging whether the simulated power-off instruction is successfully executed according to the simulated power-off status information includes: obtaining the simulated power-off status; if the simulated power-off status is incomplete, reporting a script error and debugging the firmware; if the simulated power-off status is completed, judging whether the simulated power-off instruction is successfully executed through the real power-off and power-on process.

[0009] Among them, the debugging of the firmware includes: if the asynchronous power-off process cannot be completed, the execution status of each module and the value of the key variable are checked through the log file, and the failed module is debugged; if the completion time of the asynchronous power-off process exceeds the preset time, the timeout situation of each module is judged by the execution time of each module, and the timed-out module is debugged.

[0010] Among them, the process of judging whether the simulated power-off instruction is successful through the real power-off and power-on process includes: actually powering off and powering on the storage device; judging whether the read and write functions of the storage device are normal; if not, reporting a script error; if normal, checking whether the completed operation command data is correct; if not, reporting a script error; if correct, checking whether the key variables of each module are accurate; if inaccurate, reporting a script error; if accurate, determining that the simulated power-off instruction is successful.

[0011] Among them, the completed operation command data is the user data written in the asynchronous power-off process; before the step of actually powering off and powering on the storage device, the method also includes: marking the user data written in the asynchronous power-off process with corresponding error marks; before the step of checking whether the key variables of each module are accurate, the method also includes: checking whether the user data written in the asynchronous power-off process has the error mark; if it does not have the error mark, a script error is reported; if it has the error mark, the step of checking whether the key variables of each module are accurate is executed.

[0012] In order to solve the above problems, the second aspect of the present application provides an abnormal power-off test device for a storage device, and the abnormal power-off test device for the storage device includes: an acquisition module, the acquisition module is used to obtain a simulated power-off instruction of an asynchronous power-off of the storage device; an execution module, the execution module is used to execute the asynchronous power-off process by simulating power-off according to the simulated power-off instruction; a generation module, the generation module is used to record whether the asynchronous power-off process is completed, and to count the execution time of each step in the asynchronous power-off process to generate simulated power-off status information; a processing module, the processing module is used to determine whether the simulated power-off instruction is successfully executed according to the simulated power-off status information.

[0013] To solve the above problems, the third aspect of the present application provides a storage device, which includes a processor and a memory connected to each other; the memory is used to store program instructions, and the processor is used to execute the program instructions to implement the abnormal power-off testing method of the storage device of the first aspect above.

[0014] To solve the above-mentioned problem, the fourth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, and when the program instructions are executed by a processor, the abnormal power-off testing method of the storage device of the above-mentioned first aspect is implemented.

[0015] The beneficial effects of the present invention are as follows: Different from the prior art, the present application obtains the simulated power-off instruction of the asynchronous power-off of the storage device, and then the firmware of the storage device executes the asynchronous power-off process in a simulated power-off manner according to the simulated power-off instruction, and then records whether the asynchronous power-off process is completed, and counts the execution time of each step in the asynchronous power-off process, and generates simulated power-off status information, so that it can be judged whether the simulated power-off instruction is successfully executed according to the simulated power-off status information. By simulating abnormal power off through firmware, and recording whether the asynchronous power-off process is completed, and counting the execution time of each step in the asynchronous power-off process, and then generating simulated power-off status information, after the firmware simulates power off, the test script can still interact with the firmware, and can query the simulated power-off status information through instructions, and then can judge whether the simulated power-off instruction is successfully executed according to the queried abnormal power-off status, firmware internal information, etc., and then determine whether the abnormal power-off test executed in the simulated power-off manner is effective, which can effectively improve the test efficiency and accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a flowchart of an embodiment of an abnormal power failure test method for a storage device of the present application;

[0017] Figure 2 It is a flowchart of another embodiment of the abnormal power failure test method of the storage device of the present application;

[0018] Figure 3 It is a flowchart of simulating a power-off process in an abnormal power-off test method for a storage device in an application scenario of the present application;

[0019] Figure 4 yes Figure 1 A schematic diagram of a flow chart of an embodiment of step S14;

[0020] Figure 5 It is a flowchart of debugging firmware during a simulated power-off process in an abnormal power-off test method for a storage device in an application scenario of the present application;

[0021] Figure 6 yes Figure 4 A schematic diagram of a flow chart of an embodiment of step S143;

[0022] Figure 7 It is a flowchart of an abnormal power failure test method for a storage device in an application scenario of the present application;

[0023] Figure 8 yes Figure 4 A schematic diagram of another embodiment of step S143;

[0024] Fig. 9 It is a flowchart of an abnormal power failure test method for a storage device in another application scenario of the present application;

[0025] Fig.10 It is a structural schematic diagram of an embodiment of an abnormal power failure test device for a storage device of the present application;

[0026] Fig.11 It is a structural schematic diagram of an embodiment of a storage device of the present application;

[0027] Fig.12 It is a structural diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION

[0028] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.

[0029] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.

[0030] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.

[0031] See also Figure 1 , Figure 1 The abnormal power failure test method of the storage device in this embodiment includes the following steps:

[0032] Step S11: obtaining a simulated power-off instruction for asynchronous power-off of the storage device.

[0033] The abnormal power-off test method of the storage device of the present application can be applied to the development and testing process of different types of storage products, such as user-level SSD (Solid State Drive), UFS (Universal Flash Memory), etc., and can also be adapted to other storage devices using Nand Flash as storage medium.

[0034] Step S12: According to the simulated power-off instruction, the firmware of the storage device executes the asynchronous power-off process by simulating power-off.

[0035] Step S13: record whether the asynchronous power-off process is completed, count the execution time of each step in the asynchronous power-off process, and generate simulated power-off state information.

[0036] Step S14: judging whether the simulated power-off instruction is executed successfully according to the simulated power-off status information.

[0037] Taking the storage device as an example, an enterprise-level SSD uses a capacitor as power storage. When an abnormal power failure occurs, the capacitor starts to supply power to the entire SSD. During the period of time when the capacitor supplies power, the SSD seizes the time to save user data and SSD key information. The abnormal power failure test of the SSD in the existing solution is to create various user scenarios, such as reading and writing, and firmware (firmware, FW) internal processing scenarios, such as error handling (Error Handle, EH), garbage collection (Garbage Collection, GC), wear leveling (WL), etc., through test scripts, and perform abnormal power failure at the same time to test the SSD firmware FW's processing capabilities for various abnormal power failure scenarios; however, after the abnormal power failure test scenario is implemented, if the firmware FW has problems, such as being unable to power on normally, some data recorded during the firmware FW power failure process will also be lost. For example, if you want to test the scenario of abnormal power failure when executing a read or write command, it is very likely that the read or write command execution will not be hit when the power fails during the test, which will affect the effectiveness and coverage of the test. The abnormal power-off test method in the embodiment of the present application mainly generates simulated power-off instructions for asynchronous power-off in various abnormal power-off test scenarios created by the test script. The firmware FW executes the asynchronous power-off process by simulating the power-off method instead of the real power-off method according to the simulated power-off instruction, and records the power-off status, etc., to generate simulated power-off status information, and determines the running status of the test script according to the simulated power-off status information, thereby facilitating the debugging of the solid-state hard disk and the problems encountered by the abnormal power-off, and can effectively solve the problem of loss of test and debugging information after abnormal power-off of enterprise-level SSD.

[0038] The above scheme simulates abnormal power failure through firmware, records whether the asynchronous power failure process is completed, and counts the execution time of each step in the asynchronous power failure process, thereby generating simulated power failure status information. After the firmware simulates power failure, the test script can still interact with the firmware, and can query the simulated power failure status information through instructions, and then determine whether the simulated power failure instruction is successfully executed based on the queried abnormal power failure status, firmware internal information, etc., and then determine whether the abnormal power failure test executed by the simulated power failure method is effective, which can effectively improve the test efficiency and accuracy.

[0039] See also Figure 2 , Figure 2 1 is a flow chart of another embodiment of the abnormal power failure test method for a storage device of the present application. The abnormal power failure test method for a storage device in this embodiment includes the following steps:

[0040] Step S21: Acquire a simulated power-off instruction for asynchronous power-off of the storage device. The simulated power-off instruction is provided with a delayed power-off time.

[0041] Step S22: the firmware sets a timer according to the delayed power-off time, and sets the asynchronous power-off trigger flag after receiving the simulated power-off instruction and reaching the delayed power-off time.

[0042] Step S23: According to the simulated power-off instruction, the firmware of the storage device executes the asynchronous power-off process by simulating power-off.

[0043] Furthermore, the above step S23 may specifically include: the firmware processes the target operation command and stores key internal information of the firmware; wherein the target operation command includes the operation command received before the asynchronous power-off trigger flag is set.

[0044] Step S24: record whether the asynchronous power-off process is completed, count the execution time of each step in the asynchronous power-off process, and generate simulated power-off state information.

[0045] Step S25: judging whether the simulated power-off instruction is executed successfully according to the simulated power-off status information.

[0046] The difference from the previous embodiment is that in this embodiment, a delayed power-off time is set for the execution of the simulated power-off instruction, so that in the scenario where an abnormal power off occurs when testing the execution of read and write commands, the execution time of the read and write commands and the power-off time can be controlled, thereby ensuring that the read and write commands are executed when the power off occurs during the test process, which can effectively improve the test efficiency.

[0047] Please combine Figure 3 , Figure 3 It is a flow chart of simulating a power-off process in an abnormal power-off test method for a storage device in an application scenario of the present application. Specifically, in the abnormal power-off test method for a storage device in the present application, the method of simulating abnormal power-off is mainly to send a simulated power-off instruction to the firmware FW through a test script, telling the firmware FW to delay the power-off for Tms, and the firmware FW sets a timer according to the delayed power-off time specified by the simulated power-off instruction, sets the asynchronous power-off (Async Power Loss, APL) as a simulated power-off, and then can shield the real APL interrupt of the MCU (Microcontroller Unit, microcontroller unit), and set the asynchronous power-off trigger flag; after reaching the delayed power-off time T, the asynchronous power-off trigger flag is set, and the asynchronous power-off process is executed, and the firmware FW will complete the target operation command (for example, read and write command) received before the simulated power-off, and store key internal information; thereafter, the firmware FW can record whether the asynchronous power-off process is completed, and count the completion time of each step in the asynchronous power-off process.

[0048] In one embodiment, the above-mentioned step S13 may specifically include: during the execution of the asynchronous power-off process, the firmware records the execution status, execution time and values ​​of key variables of each module; if the asynchronous power-off process is completed, the generated simulated power-off state is completed; if the firmware cannot power off normally, the generated simulated power-off state is incomplete.

[0049] The abnormal power-off test method of the present application simulates abnormal power-off through firmware FW. During the simulated power-off process, various abnormal power-off-related modules in the firmware FW, such as a write manager module, a data manager module, a GC module, an EH module, a WL Reclaim module, a cache manager module, a Flash Channel Controller (FCC), etc., can also internally add relevant content of processing information during the simulated power-off process, so that the firmware can record the execution status, execution time and values ​​of key variables of each module. After the firmware FW simulates power-off, the test script can still interact with the firmware FW. Therefore, the simulated power-off status information generated can be queried through instructions, the internal information of the firmware FW can be queried to determine whether the test is valid, and error scenarios can be simulated, etc., thereby effectively helping the testing and debugging of abnormal power-off.

[0050] Please combine Figure 4 , Figure 4 yes Figure 1 FIG. 1 is a flow chart of an embodiment of step S14 in FIG. 1. In one embodiment, the above step S14 may specifically include:

[0051] Step S141: Acquire the simulated power-off status. If the simulated power-off status is not completed, execute step S142; if the simulated power-off status is completed, execute step S143.

[0052] Step S142: Report a script error and debug the firmware.

[0053] Step S143: judging whether the simulated power-off instruction is executed successfully through the actual power-off and power-on process.

[0054] It can be understood that after executing the above-mentioned simulated power-off process, it is possible to determine whether the simulated power-off is completed by obtaining and viewing the generated simulated power-off status. If the simulated power-off status is incomplete, it means that there is an error or abnormality, and a script error report is required and the firmware needs to be debugged. If the simulated power-off status is completed, the actual power-off and power-on process can be used to determine whether the simulated power-off instruction is successfully executed and check the validity of the test script.

[0055] In one embodiment, the step of debugging the firmware in the above-mentioned step S142 may specifically include: if the asynchronous power-off process cannot be completed, the execution status of each module and the value of key variables are checked through the log file, and the failed module is debugged; if the completion time of the asynchronous power-off process exceeds the preset time, the timeout situation of each module is judged by the execution time of each module, and the timed-out module is debugged.

[0056] Please combine Figure 5 , Figure 5 It is a flow chart of debugging firmware during a simulated power-off process in an abnormal power-off test method for a storage device in an application scenario of the present application. In an application scenario, regarding the debugging process during the simulated abnormal power-off process, taking the failure of normal power-off when reading and writing APL scripts as an example, during the APL execution process, the firmware FW records the execution status of each module at the front end, middle end, and back end and the values ​​of key variables. If the firmware FW cannot be powered off normally, the firmware needs to be debugged; if the APL process is stuck, the execution status of each module can be viewed by capturing log files such as uart log, and the values ​​of key variables can be checked for debugging; if the APL is not completed within the specified time, the completion time of the execution of each module recorded in the APL process can be used to determine which module has timed out, so that the timed-out module can be debugged.

[0057] Please combine Figure 6 , Figure 6 yes Figure 4 FIG. 1 is a flow chart of an embodiment of step S143 in FIG. 1. In one embodiment, the above step S143 may specifically include:

[0058] Step S1431: Power off and power on the storage device.

[0059] Step S1432: Determine whether the read and write functions of the storage device are normal. If not, execute step S1433; if normal, execute step S1434.

[0060] Step S1433: Report a script error.

[0061] Step S1434: Check whether the completed operation command data is correct. If not, execute step S1433; if correct, execute step S1435.

[0062] Step S1435: Check whether the key variables of each module are accurate. If not, execute step S1433; if accurate, execute step S1436.

[0063] Step S1436: Determine whether the simulated power-off instruction is executed successfully.

[0064] It can be understood that when the simulated power-off status obtained is completed, the storage device can be actually powered off and powered on. After power-on, it can be determined whether the simulated power-off instruction is successful by checking whether the SSD status is normal, checking the data integrity, and checking the accuracy of the key data of the firmware FW, thereby determining the validity of the test script.

[0065] Please combine Figure 7 , Figure 7 It is a flow chart of an abnormal power-off test method for a storage device in an application scenario of the present application. In an application scenario, taking an abnormal power-off during a read-write operation as an example, the abnormal power-off test method is as follows: a test script sends a large number of read-write commands, which are written for a certain period of time, and then another process is started to send a simulated power-off instruction to simulate an abnormal power-off. The simulated power-off instruction specifies information such as an asynchronous power-off mode as a simulated power-off mode, whether instructions are allowed to be sent after the simulated power-off, and a simulated power-off delay time. After the simulated power-off occurs, the read-write operation is interrupted, and then the asynchronous power-off process is waited for to be completed. After waiting for a period of time, a query instruction is sent to query the simulated power-off status. If the simulated power-off status is a power-off completion status, a real power-off is performed. If the simulated power-off status is an incomplete power-off status, a script error is reported. After the actual power failure and power-on, you can check whether the SSD can read and write normally. If it can read and write normally, check whether the completed write command data is correct. If it cannot read and write normally, a script error is reported; in the process of checking whether the completed write command data is correct, if the data is correct, further confirm the accuracy of the key data of the firmware FW. If the data is incorrect, a script error is reported; in the process of checking and confirming the accuracy of the key data of the firmware FW, if the key variables of a module in the firmware FW are inaccurate, a script error is reported. If the key variables of each module in the firmware FW are accurate, it is determined that the script runs successfully. Compared with the existing test schemes, the abnormal power failure test method of the storage device of the present application has higher test efficiency and accuracy, simple debugging steps, high troubleshooting efficiency, and can realize scenarios that are difficult to achieve with conventional abnormal power failure tests.

[0066] Please combine Figure 8 , Figure 8 yes Figure 4 In this embodiment, the completed operation command data in the above embodiment may specifically be user data written in the asynchronous power-off process, and the above step S143 may specifically include:

[0067] Step S1430: marking the user data written in the asynchronous power-off process with a corresponding error mark.

[0068] Step S1431: Power off and power on the storage device.

[0069] Step S1432: Determine whether the read and write functions of the storage device are normal. If not, execute step S1433; if normal, execute step S1437.

[0070] Step S1433: Report a script error.

[0071] Step S1437: Check whether the user data written in the asynchronous power-off process has an error mark. If it does not have an error mark, execute step S1433; if it has an error mark, execute step S1434.

[0072] Step S1434: Check whether the completed operation command data is correct. If not, execute step S1433; if correct, execute step S1435.

[0073] Step S1435: Check whether the key variables of each module are accurate. If not, execute step S1433; if accurate, execute step S1436.

[0074] Step S1436: Determine whether the simulated power-off instruction is executed successfully.

[0075] Please combine Fig. 9 , Fig. 9 It is a flow chart of an abnormal power-off test method for a storage device in another application scenario of the present application. Specifically, the abnormal power-off test method for a storage device of the present application can expand the scenario of the abnormal power-off test. For example, when it is necessary to test the function of processing a read command error during the power-on process of the firmware FW, the user data written during the power-off process can be annotated with an error through the firmware FW after the simulated power-off is completed. Then, the script validity check is performed through the real power-off and power-on process in the manner of the previous embodiment. During the real power-on process of the firmware FW, the part of the data with an error will be read out from the firmware FW dedicated storage area and rewritten to NAND; if a read command error is encountered, the firmware FW will first perform data recovery. If it cannot be recovered, it will report data loss, and perform garbage collection on the data blocks with lost data, and write valid data to other data blocks. It can be understood that if a real abnormal power-off is performed directly, it is difficult to accurately test this part based on the FW function.

[0076] See also Fig.10 , Fig.10It is a structural diagram of an embodiment of an abnormal power-off test device for a storage device of the present application. The abnormal power-off test device 100 for a storage device in this embodiment includes an acquisition module 1000, an execution module 1002, a generation module 1004 and a processing module 1006 that are interconnected; the acquisition module 1000 is used to acquire a simulated power-off instruction for an asynchronous power-off of the storage device; the execution module 1002 is used to execute the asynchronous power-off process by simulating power-off according to the simulated power-off instruction; the generation module 1004 is used to record whether the asynchronous power-off process is completed, and to count the execution time of each step in the asynchronous power-off process, and to generate simulated power-off status information; the processing module 1006 is used to determine whether the simulated power-off instruction is successfully executed according to the simulated power-off status information.

[0077] In one embodiment, the simulated power-off instruction is provided with a delayed power-off time; before the execution module 1002 executes the step in which the firmware of the storage device executes the asynchronous power-off process by simulating power-off according to the simulated power-off instruction, it is also used for: the firmware sets a timer according to the delayed power-off time, and sets the asynchronous power-off trigger flag after receiving the simulated power-off instruction and reaching the delayed power-off time.

[0078] In one embodiment, the execution module 1002 executes the steps of the firmware of the storage device executing the asynchronous power-off process by simulating power-off according to the simulated power-off instruction, specifically including: the firmware processes the target operation command and stores key internal information of the firmware; wherein the target operation command includes the operation command received before the asynchronous power-off trigger flag is set.

[0079] In one embodiment, the generation module 1004 executes the steps of recording whether the asynchronous power-off process is completed, counting the execution time of each step in the asynchronous power-off process, and generating simulated power-off status information, including: during the execution of the asynchronous power-off process, the firmware records the execution status, execution time and values ​​of key variables of each module; if the asynchronous power-off process is completed, the generated simulated power-off status is completed; if the firmware cannot power off normally, the generated simulated power-off status is incomplete.

[0080] In one embodiment, the processing module 1006 executes the steps of determining whether the simulated power-off instruction is successfully executed based on the simulated power-off status information, including: obtaining the simulated power-off status; if the simulated power-off status is incomplete, reporting a script error and debugging the firmware; if the simulated power-off status is completed, determining whether the simulated power-off instruction is successfully executed through a real power-off and power-on process.

[0081] In one embodiment, the processing module 1006 executes the step of debugging the firmware, which may specifically include: if the asynchronous power-off process cannot be completed, the execution status of each module and the value of the key variable are checked through the log file, and the failed module is debugged; if the completion time of the asynchronous power-off process exceeds the preset time, the timeout situation of each module is judged by the execution time of each module, and the timed-out module is debugged.

[0082] In one embodiment, the processing module 1006 executes the step of determining whether the simulated power-off instruction is successfully executed through a real power-off and power-on process, which may specifically include: actually powering off and powering on the storage device; determining whether the read and write functions of the storage device are normal; if not, reporting a script error; if normal, checking whether the completed operation command data is correct; if not, reporting a script error; if correct, checking whether the key variables of each module are accurate; if inaccurate, reporting a script error; if accurate, determining that the simulated power-off instruction is successfully executed.

[0083] In one embodiment, the completed operation command data is the user data written in the asynchronous power-off process; before executing the step of actually powering off and powering on the storage device, the processing module 1006 is also used to mark the user data written in the asynchronous power-off process with a corresponding error mark; before executing the step of checking whether the key variables of each module are accurate, it is also used to: check whether the user data written in the asynchronous power-off process has the error mark; if it does not have the error mark, a script error is reported; if it has the error mark, the step of checking whether the key variables of each module are accurate is executed.

[0084] For specific contents about the abnormal power-off test method for storage devices implemented by the abnormal power-off test device 100 of the present application, please refer to the contents in the above-mentioned abnormal power-off test method embodiment of the storage device, which will not be repeated here.

[0085] See also Fig.11 , Fig.11 1 is a schematic diagram of the structure of an embodiment of a storage device of the present application. The storage device 110 in this embodiment includes a processor 1102 and a memory 1101 connected to each other; the memory 1101 is used to store program instructions, and the processor 1102 is used to execute the program instructions stored in the memory 1101 to implement the steps of any of the above-mentioned abnormal power failure test methods for storage devices. In a specific implementation scenario, the storage device 110 may include but is not limited to: a microcomputer, a server.

[0086] Specifically, the processor 1102 is used to control itself and the memory 1101 to implement the steps of the abnormal power failure test method embodiment of any of the above-mentioned storage devices. The processor 1102 can also be called a CPU (Central Processing Unit). The processor 1102 may be an integrated circuit chip with signal processing capabilities. The processor 1102 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 1102 can be implemented by an integrated circuit chip.

[0087] See also Fig.12 , Fig.12 The computer-readable storage medium 120 of the present application stores program instructions 1200 thereon, which implement the steps in any of the above-mentioned abnormal power failure test methods for storage devices when executed by a processor.

[0088] The computer-readable storage medium 120 may specifically be a medium that can store the program instructions 1200, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or may be a server that stores the program instructions 1200. The server may send the stored program instructions 1200 to other devices for execution, or may execute the stored program instructions 1200 by itself.

[0089] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and apparatuses can be implemented in other ways. For example, the above-described device and apparatus implementation methods are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0090] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0091] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0092] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.

Claims

1. A method for abnormal power failure testing of a storage device, characterized in that: The method comprises: Obtaining a simulated power-off instruction for asynchronous power-off of a storage device; According to the simulated power-off instruction, the firmware of the storage device executes an asynchronous power-off process by simulating power-off; Record whether the asynchronous power-off process is completed, count the execution time of each step in the asynchronous power-off process, and generate simulated power-off state information; Whether the simulated power-off instruction is executed successfully is determined according to the simulated power-off status information.

2. The abnormal power failure test method for a storage device according to claim 1, characterized in that: The simulated power-off instruction is provided with a delayed power-off time; Before the firmware of the storage device executes the asynchronous power-off process by simulating power-off according to the simulated power-off instruction, the method includes: The firmware sets a timer according to the delayed power-off time, and sets an asynchronous power-off trigger flag after receiving the simulated power-off instruction and reaching the delayed power-off time.

3. The abnormal power failure test method for a storage device according to claim 2, characterized in that: According to the simulated power-off instruction, the firmware of the storage device executes an asynchronous power-off process by simulating power-off, including: The firmware processes the target operation command and stores key internal information of the firmware; wherein the target operation command includes the operation command received before the asynchronous power-off trigger flag is set.

4. The abnormal power failure test method for a storage device according to claim 1, characterized in that: The recording whether the asynchronous power-off process is completed, counting the execution time of each step in the asynchronous power-off process, and generating simulated power-off state information includes: During the execution of the asynchronous power-off process, the firmware records the execution status, execution time and values ​​of key variables of each module; If the asynchronous power-off process is completed, the generated simulated power-off state is completed; If the firmware cannot power down normally, the generated simulated power down state is incomplete.

5. The abnormal power failure test method for a storage device according to claim 4, characterized in that: The step of judging whether the simulated power-off instruction is executed successfully according to the simulated power-off state information includes: Acquiring the simulated power-off state; If the simulated power-off state is incomplete, a script error is reported and the firmware is debugged; If the simulated power-off status is completed, it is determined whether the simulated power-off instruction is successfully executed through the actual power-off and power-on process.

6. The abnormal power failure test method for a storage device according to claim 5, characterized in that: The debugging of the firmware includes: If the asynchronous power-off process cannot be completed, the execution status of each module and the value of key variables are checked through the log file, and the module with the failure is debugged; If the completion time of the asynchronous power-off process exceeds the preset time, the timeout situation of each module is judged according to the execution time of each module, and the timed-out module is debugged.

7. The abnormal power failure test method for a storage device according to claim 5, characterized in that: The determining whether the simulated power-off instruction is executed successfully through the actual power-off and power-on process includes: Performing actual power-off and power-on of the storage device; Determining whether the read and write functions of the storage device are normal; If it is abnormal, the script will report an error; If normal, check whether the completed operation command data is correct; If it is incorrect, the script will report an error; If correct, check whether the key variables of each module are accurate; If it is inaccurate, the script will report an error; If accurate, it is determined that the simulated power-off instruction is executed successfully.

8. The abnormal power failure test method for a storage device according to claim 7, characterized in that: The completed operation command data is the user data written in the asynchronous power-off process; Before the step of actually powering off and powering on the storage device, the method further includes: Marking corresponding error marks on user data written in the asynchronous power-off process; Before the step of checking whether the key variables of each module are accurate, the method further includes: Checking whether the user data written in the asynchronous power-off process has the error mark; If the error mark is not present, a script error is reported; If there is the error flag, the step of checking whether the key variables of each module are accurate is performed.

9. An abnormal power failure test device for a storage device, characterized in that: The abnormal power-off testing device of the storage device comprises: An acquisition module, the acquisition module is used to acquire a simulated power-off instruction of an asynchronous power-off of a storage device; An execution module, wherein the execution module is used for causing the firmware of the storage device to execute an asynchronous power-off process by simulating power-off according to the simulated power-off instruction; A generation module, the generation module is used to record whether the asynchronous power-off process is completed, and to count the execution time of each step in the asynchronous power-off process to generate simulated power-off state information; A processing module is used to determine whether the simulated power-off instruction is executed successfully according to the simulated power-off state information.

10. A storage device, characterized in that: The storage device includes a processor and a memory connected to each other; The memory is used to store program instructions, and the processor is used to execute the program instructions to implement the abnormal power-off test method for a storage device according to any one of claims 1 to 8.

11. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the abnormal power-off testing method for a storage device according to any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Method and device for storing firmware debugging information during abnormal power failure of storage equipment

    CN119759624A

  • Method and apparatus for saving firmware debug information when a storage device is abnormally powered down

    CN119759624B