SSD normal power failure test method, device, computer equipment and storage medium
By waiting for N seconds to read the shutdown status of the main control configuration register and performing data verification after power-on during the normal power-down test of the SSD, the problem in the existing technology that cannot ensure that the SSD completes the power-down notification and data integrity is solved. problems, improving the accuracy and reliability of the test.
Patent Information
- Application Number
- CN202010613260.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-30
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2040-06-30
AI Technical Summary
The existing technology cannot ensure whether the SSD completes the power-down notification command within the specified time during the normal power-down test of the SSD, and cannot verify the integrity of the written data during the last power-on cycle, which may lead to the leakage of product defects.
By randomly writing data to the SSD, a normal power-down notification command is issued to the main control configuration register, and waiting for N seconds to read the shutdown status to determine whether the power-down is completed; initialization and data verification are performed after power-on to ensure that the data Matchability.
It can effectively determine whether the SSD has completed the power-down notification command within the specified time, and verify the data integrity during the power-on cycle to avoid missing possible defects and improve the accuracy of the test.
Smart Images

Figure CN111782446B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of SSD normal power-off testing, and more specifically to a method, device, computer equipment and storage medium for testing a normal power-off of an SSD. Background Art
[0002] In the early stage of PCIe NVMe SSD (hereinafter referred to as SSD) product development, it is usually necessary to quickly evaluate some of its key features or functions to check whether the corresponding design has defects. Among them, it is very important to perform a normal power-off test on the SSD. The so-called normal power-off is relative to the abnormal power-off, that is, before the SSD is powered off, the host first sends a normal power-off notification command to the SSD, and then powers off the SSD. At present, in the method of performing a normal power-off test on consumer-grade SSDs, third-party power-off test software (for example, sleeper) and read-write test software (for example, BurnIn Test) are usually used under Windows to read and write the SSD for a period of time, and then the entire machine is hibernated or cold-started to achieve normal power-off of the SSD. The advantage of this test method is that it is simple and convenient to operate. However, this method has the following two disadvantages:
[0003] 1. The third-party power-off test software used in the above method does not wait for the SSD to complete the normal power-off notification command after sending it to the SSD (according to the NVMe 1.3 protocol, the host must wait for at least 1s or more before performing other operations after sending the normal power-off notification command). As a result, it is impossible to determine whether the SSD has completed the command, and the SSD is directly powered off. If this happens, for the SSD, this is sometimes an abnormal power-off test, which is contrary to the intention of performing a normal power-off test on the SSD, and may miss some SSD product defects that only appear under normal power-off tests (such as timeout in processing the normal power-off notification command);
[0004] 2. The third-party read / write test software used in the above method will not verify the data written in the previous power-on cycle in the next power-on cycle of the SSD. This may miss defects related to data inconsistency that may still occur after the SSD is powered off normally. Summary of the invention
[0005] The purpose of the present invention is to overcome the defects of the prior art and provide a method, device, computer equipment and storage medium for testing normal power failure of an SSD.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] The test method for normal power failure of SSD includes the following steps:
[0008] Perform random data write operations on the SSD;
[0009] Send a normal power-off notification command to the SSD master control configuration register, and set the shutdown notification value of the SSD master control configuration register to 01b;
[0010] Wait for N seconds and read the shutdown status value of the SSD master control configuration register;
[0011] Determine whether the value of the shutdown state of the SSD master control configuration register is 10b;
[0012] If not, the script will report an error and stop the test;
[0013] If yes, the SSD is powered off and kept powered off for X seconds;
[0014] Power on the SSD and initialize it;
[0015] Determine whether the SSD power-on initialization is successful;
[0016] If it fails, the script will report an error and stop the test;
[0017] If successful, the data written to the SSD is verified;
[0018] Determine whether the data checksum matches;
[0019] If they do not match, the script will report an error and the test will stop;
[0020] If they match, the process returns to step “performing a random data write operation on the SSD”.
[0021] A further technical solution is: in the step of "performing random data write operation on the SSD", the data mode of the write operation is 0x5a.
[0022] Its further technical solution is: in the step of "waiting N seconds and reading the value of the shutdown state of the SSD master control configuration register", N is greater than or equal to 1.
[0023] A further technical solution is: in the step of "if yes, power off the SSD and keep the power off state for X seconds", X is 3-10.
[0024] The test device for normal power failure of SSD includes: a writing unit, a setting sending unit, a waiting reading unit, a first judging unit, a power failure unit, a power-on initialization unit, a second judging unit, a verification unit, a third judging unit, a return unit, and an error reporting stop unit;
[0025] The write unit is used to perform random data write operations on the SSD;
[0026] The sending setting unit is used to send a normal power-off notification command to the SSD master control configuration register, and set the value of the shutdown notification of the SSD master control configuration register to 01b;
[0027] The waiting reading unit is used to wait for N seconds and read the value of the shutdown state of the SSD master control configuration register;
[0028] The first determination unit is used to determine whether the value of the shutdown state of the SSD master control configuration register is 10b;
[0029] The power-off unit is used to power off the SSD and keep the power-off state for X seconds;
[0030] The power-on initialization unit is used to power on the SSD and perform initialization;
[0031] The second determination unit is used to determine whether the SSD power-on initialization is successful;
[0032] The verification unit is used to perform data verification on the data written to the SSD;
[0033] The third judgment unit is used to judge whether the data verification matches;
[0034] The returning unit is used to return to execute the "random data write operation on the SSD";
[0035] The error reporting and stopping unit is used to report a script error and stop the test.
[0036] A further technical solution is: in the write unit, the data mode of the write operation is 0x5a.
[0037] A further technical solution is: in the waiting reading unit, N is greater than or equal to 1.
[0038] A further technical solution is: in the power-off unit, X is 3-10.
[0039] A computer device includes a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the method for testing the normal power-off of an SSD as described above is implemented.
[0040] A storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the above-mentioned SSD normal power-off test method can be implemented.
[0041] Compared with the prior art, the beneficial effects of the present invention are: it makes up for the defects that the third-party testing software cannot determine whether the SSD correctly completes the normal power-off notification command issued by the host within the specified time (N seconds), and cannot verify the data written in the previous power-on cycle of the SSD, and can better meet the needs.
[0042] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0044] Figure 1 A flow chart of a method for testing a normal power-off of an SSD provided in an embodiment of the present invention;
[0045] Figure 2 A schematic block diagram of a test device for normal power-off of an SSD provided by an embodiment of the present invention;
[0046] Figure 3 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0049] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0050] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0051] See also Figures 1 to 3 The specific embodiment shown, wherein please refer to Figure 1 As shown, the present invention discloses a method for testing a normal power-off of an SSD, comprising the following steps:
[0052] S1, random data write operation to SSD;
[0053] In this embodiment, data random write operation is performed on the SSD for M seconds, M≥1, for example: M=3, 5, or 7, etc. The value of M can be set according to actual conditions to meet different requirements.
[0054] The data mode of the write operation is 0x5a, in hexadecimal.
[0055] S2, send a normal power-off notification command to the SSD master control configuration register, and set the shutdown notification value of the SSD master control configuration register to 01b;
[0056] S3, wait N seconds, and read the shutdown status value of the SSD master control configuration register;
[0057] Wherein, N is greater than or equal to 1, for example: N=2, 3, 5, or 7, etc. The value of N can be set according to actual conditions to meet different requirements.
[0058] S4, determine whether the value of the shutdown state of the SSD master control configuration register is 10b; if not, enter S10, report a script error, and stop the test;
[0059] S5: If yes, the SSD is powered off and kept powered off for X seconds;
[0060] Wherein, X is 3-10, for example: X=3, 5, or 7, etc. In other embodiments, the value of X may also be 1, 2, or greater than 10. The value of X may be set according to actual conditions to meet different requirements.
[0061] S6, power on the SSD and initialize it;
[0062] S7, determine whether the SSD power-on initialization is successful; if not, enter S10, the script reports an error and stops the test;
[0063] S8, if successful, performing data verification on the data written to the SSD;
[0064] S9, determine whether the data verification matches; if not, enter S10, report a script error, and stop testing; if it matches, return to the execution step of "randomly write data to the SSD", and repeat steps S1-S10, Y cycles (the value of Y can be determined according to actual conditions).
[0065] The present invention uses the DriveMaster 2015 test software of Ulink Company and writes a test script according to the relevant rules of the NVMe1.3 protocol. The script mainly sends a normal power-off notification command to the SSD by setting the value of the SSD master control configuration register (Controller Configuration Register, hereinafter referred to as CC) bit 15:14 (the "Shutdown Notification (shutdown notification)" field of the register, hereinafter referred to as CC.SHN (SSD master control configuration register shutdown notification)) to 01b, and after waiting for N seconds, by reading the value of the SSD master control status register (Controller Status, hereinafter referred to as CSTS) bit 03:02 (the "Shutdown Status (shutdown status)" field of the register, hereinafter referred to as CSTS.SHST (SSD master control configuration register shutdown status)) to 10b to determine whether the SSD has completed the normal power-off notification command; and in the next power-on cycle, the data written in the previous power-on cycle is verified.
[0066] The present invention makes up for the defects that the third-party test software cannot determine whether the SSD correctly completes the normal power-off notification command issued by the host within the specified time (N seconds), and cannot verify the data written in the previous power-on cycle of the SSD, and can better meet the needs.
[0067] See also Figure 2 As shown, the present invention also discloses a test device for normal power-off of an SSD, comprising: a writing unit 10, a setting unit 20, a waiting reading unit 30, a first judging unit 40, a power-off unit 50, a power-on initialization unit 60, a second judging unit 70, a verification unit 80, a third judging unit 90, a return unit 100, and an error reporting stop unit 110;
[0068] The writing unit 10 is used to perform random data writing operation on the SSD;
[0069] The sending setting unit 20 is used to send a normal power-off notification command to the SSD master control configuration register, and set the value of the shutdown notification of the SSD master control configuration register to 01b;
[0070] The waiting reading unit 30 is used to wait for N seconds and read the value of the shutdown state of the SSD master control configuration register;
[0071] The first determination unit 40 is used to determine whether the value of the shutdown state of the SSD master control configuration register is 10b;
[0072] The power-off unit 50 is used to power off the SSD and keep the power-off state for X seconds;
[0073] The power-on initialization unit 60 is used to power on the SSD and perform initialization;
[0074] The second determination unit 70 is used to determine whether the SSD power-on initialization is successful;
[0075] The verification unit 80 is used to perform data verification on the data written into the SSD;
[0076] The third judgment unit 90 is used to judge whether the data verification matches;
[0077] The returning unit 100 is used to return to execute the "random data write operation on the SSD";
[0078] The error reporting and stopping unit 110 is used to report a script error and stop the test.
[0079] Wherein, in the write unit 10, the data mode of the write operation is 0x5a.
[0080] Wherein, in the waiting reading unit 30, N is greater than or equal to 1.
[0081] Wherein, in the power-off unit 50, X is 3-10.
[0082] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned SSD normal power-off test device and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.
[0083] The above-mentioned SSD normal power-off test device can be implemented in the form of a computer program. The computer program can be used in Figure 3 Runs on the computer device shown.
[0084] See also Figure 3 , Figure 3is a schematic block diagram of a computer device provided in an embodiment of the present application; the computer device 500 may be a terminal or a server, wherein the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device. The server may be an independent server or a server cluster composed of multiple servers.
[0085] See also Figure 3 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0086] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, and when the program instructions are executed, the processor 502 can execute a test method for normal power-off of an SSD.
[0087] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0088] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a test method for normal power-off of the SSD.
[0089] The network interface 505 is used to communicate with other devices over the network. Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0090] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0091] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0092] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the above-mentioned SSD normal power-off test method can be implemented.
[0093] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0094] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0095] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0096] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0097] 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 storage medium. Based on this understanding, the technical solution of the present invention 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 for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0098] The above examples are only used to further illustrate the technical content of the present invention, so that readers can understand it more easily, but they do not mean that the implementation of the present invention is limited to this. Any technical extension or re-creation made according to the present invention is protected by the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. The test method of normal power failure of SSD is characterized by: The following steps are involved: Perform random data write operations on the SSD; Send a normal power-off notification command to the SSD master control configuration register, and set the shutdown notification value of the SSD master control configuration register to 01b; Wait for N seconds and read the shutdown status value of the SSD master control configuration register; Determine whether the value of the shutdown state of the SSD master control configuration register is 10b; If not, the script will report an error and stop the test; If yes, the SSD is powered off and kept powered off for X seconds; Power on the SSD and initialize it; Determine whether the SSD power-on initialization is successful; If it fails, the script will report an error and stop the test; If successful, the data written to the SSD is verified; Determine whether the data checksum matches; If they do not match, the script will report an error and the test will stop; If they match, return to the step "perform random data write operation on SSD"; The random data write operation is performed on the SSD for M seconds, where M≥1.
2. The SSD normal power-off testing method according to claim 1, characterized in that: In the step of "performing random data write operation on the SSD", the data mode of the write operation is 0x5a.
3. The SSD normal power-off testing method according to claim 1, characterized in that: In the step "wait N seconds and read the value of the shutdown state of the SSD master control configuration register", N is greater than or equal to 1.
4. The SSD normal power-off testing method according to claim 1, characterized in that: In the step "if yes, power off the SSD and keep it in the power-off state for X seconds", X is 3-10.
5. The SSD normal power-off test device is characterized by: include: A writing unit, a setting sending unit, a waiting reading unit, a first judging unit, a power-off unit, a power-on initialization unit, a second judging unit, a verification unit, a third judging unit, a return unit, and an error reporting stop unit; The write unit is used to perform random data write operations on the SSD; The sending setting unit is used to send a normal power-off notification command to the SSD master control configuration register, and set the value of the shutdown notification of the SSD master control configuration register to 01b; The waiting reading unit is used to wait for N seconds and read the value of the shutdown state of the SSD master control configuration register; The first determination unit is used to determine whether the value of the shutdown state of the SSD master control configuration register is 10b; The power-off unit is used to power off the SSD and keep the power-off state for X seconds; The power-on initialization unit is used to power on the SSD and perform initialization; The second determination unit is used to determine whether the SSD power-on initialization is successful; The verification unit is used to perform data verification on the data written to the SSD; The third judgment unit is used to judge whether the data verification matches; The returning unit is used to return to execute "randomly write data to the SSD"; The error reporting and stopping unit is used to report a script error and stop the test; The random data write operation is performed on the SSD for M seconds, where M≥1.
6. The SSD normal power-off test device according to claim 5, characterized in that: In the write unit, the data mode of the write operation is 0x5a.
7. The SSD normal power-off test device according to claim 5, characterized in that: In the waiting reading unit, N is greater than or equal to 1.
8. The SSD normal power-off testing device according to claim 5, characterized in that: In the power-off unit, X is 3-10.
9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the SSD normal power-off test method according to any one of claims 1 to 4 when executing the computer program.
10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method for testing normal power-off of an SSD as claimed in any one of claims 1 to 4 can be implemented.
