Abnormal power-off detection method, electronic device, and storage medium

CN116069576BActive Publication Date: 2026-10-20INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310033330.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-10
Publication Date
2026-10-20
Estimated Expiration
2043-01-10

AI Technical Summary

Technical Problem

[0002]在SSD开发过程中,ABRUPT SHUTDOWN需要大量的长时间测试以保证SSD异常下电环境下的稳定性,目前异常下电测试往往采用人工插拔,使用热插拔设备(quarch),使用继电器控制电源按钮等方式进行,其中人工插拔无法实现大量,长时间的测试要求;quarch热插拔设备因为需要增加测试设备且价格贵,也无法满足大量测试的要求,且因为其在SSD与host之间连接了热插拔设备,可能对测试引入负面影响;使用继电器控制开关按钮,经过测试,由于操作系统及主机电源的作用,大概率会进入NORMALSHUTDOWN,无法保证异常下电的精准测试

Benefits of technology

[0136]通过响应于接收到异常下电测试任务,配置第一寄存器状态以指示进入异常下电测试模式;响应于接收到关机指令,根据所述关机指令向所述固态硬盘发送下电指令;响应于检测到第二寄存器状态为下电完成,完成关机操作,其中所述第二寄存器状态由所述固态硬盘根据所述第一寄存器状态以及所述下电指令进行伪下电动作并配置;响应于重新上电完成,检测所述固态硬盘并生成所述固态硬盘的异常下电检测结果。解决了使用继电器控制开关按钮,不能保证每一次关机都进入异常下电的问题,提高了异常下电测试的精准控制;相对于使用quarch等热插拔测试设备,降低了测试成本,可以实现大量设备的异常下电测试。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116069576B_ABST
    Figure CN116069576B_ABST
Patent Text Reader

Abstract

The application provides an abnormal power-off detection method, an electronic device and a storage medium, and is applied to a test host, wherein the method comprises the following steps: in response to receiving an abnormal power-off test task, configuring a first register state to indicate entering an abnormal power-off test mode; in response to receiving a shutdown instruction, sending a power-off instruction to the solid state disk according to the shutdown instruction; in response to detecting that a second register state is power-off complete, completing a shutdown operation, wherein the second register state is configured by the solid state disk according to the first register state and the power-off instruction; and in response to completing re-powering on, detecting the solid state disk and generating an abnormal power-off detection result of the solid state disk. The application solves the problem that a relay control switch button cannot guarantee that each shutdown enters abnormal power-off, and improves the accurate control of abnormal power-off test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power-down detection, and in particular to an abnormal power-down detection method, electronic device, and storage medium. Background Technology

[0002] During SSD development, ABRUPT SHUTDOWN requires extensive and prolonged testing to ensure the stability of the SSD under abnormal power-down conditions. Currently, abnormal power-down testing often employs methods such as manual plugging and unplugging, using hot-swappable devices (quarch), or using relays to control the power button. Manual plugging and unplugging cannot meet the requirements for large-scale, long-term testing; quarch hot-swappable devices are expensive and require additional testing equipment, also failing to meet the demands of extensive testing, and the connection between the SSD and the host may negatively impact the testing process; using relays to control the power button, after testing, shows that due to the operating system and host power supply, it is highly likely to enter NORMALSHUTDOWN, making accurate testing of abnormal power-down impossible. For example, if the host is idle when the power-down detection task begins, it will send a normal power-down command and wait for firmware response. If the host is busy, and after completing higher-priority tasks, it lacks the power to send a normal power-down command, thus triggering an abnormal power-down. Summary of the Invention

[0003] Therefore, it is necessary to provide a method, electronic device, and storage medium for detecting abnormal power-down of solid-state drives that can accurately test abnormal power-down conditions, addressing the aforementioned technical problems.

[0004] Firstly, an abnormal power-down detection method is provided, applied to a test host, the method comprising:

[0005] In response to receiving an abnormal power-down test task, configure the state of the first register to indicate entering the abnormal power-down test mode;

[0006] In response to receiving a shutdown command, a power-down command is sent to the solid-state drive according to the shutdown command;

[0007] In response to detecting that the second register status is power-down complete, the power-down operation is completed, wherein the second register status is configured by the solid-state drive based on the first register status and the power-down command to perform a pseudo-power-down action;

[0008] In response to the completion of the power-on process, the solid-state drive is detected and an abnormal power-down detection result for the solid-state drive is generated.

[0009] In one embodiment, in response to receiving a power-off command, sending a power-down command to the solid-state drive according to the power-off command includes:

[0010] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0011] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0012] In one embodiment, responding to the detection that the second register state is power-down complete, the power-off operation includes:

[0013] Detect the second register corresponding to the solid-state drive;

[0014] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0015] If so, continue with the shutdown process;

[0016] If not, then reacquire the state of the second register.

[0017] In one embodiment, in response to a power-on reset, detecting the solid-state drive and generating an abnormal power-down detection result for the solid-state drive includes:

[0018] Attempt to access the file system;

[0019] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0020] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0021] In one embodiment, generating the abnormal power-down detection result based on the second template data and the first template data includes:

[0022] Determine whether the first template data and the second template data are the same;

[0023] If so, a first abnormal power-down detection result is generated and sent to the user;

[0024] If not, a second abnormal power-down detection result is generated and sent to the user.

[0025] In one embodiment, an abnormal power-down detection method is also provided, applied to a solid-state drive, the method comprising:

[0026] Receive the power-down command sent by the test host;

[0027] Acquire the first register state, wherein the first register state is configured by the test host in response to receiving an abnormal power-down test task to indicate entry into the abnormal power-down test mode;

[0028] Perform a pseudo-power-down action based on the state of the first register and the power-down instruction;

[0029] Configure the second register status to indicate that the solid-state drive power-down is complete.

[0030] In one embodiment, the method further includes:

[0031] In response to receiving a formatting command from the test host, the file system of the solid-state drive is formatted;

[0032] The system receives the first template data sent by the test host and writes it to the file system.

[0033] In one embodiment, the method further includes:

[0034] In response to the test data read request sent by the test host after power-on, the second template data is sent to the test host so that the test host can generate the abnormal power-down detection result based on the first template data and the second template data.

[0035] On the other hand, an abnormal power-down detection device is provided for use in a test host, the device comprising:

[0036] The first configuration module, in response to receiving an abnormal power-down test task, is used to configure the state of the first register to indicate entering the abnormal power-down test mode.

[0037] The instruction sending module, in response to receiving a power-off instruction, is used to send a power-down instruction to the solid-state drive according to the power-off instruction;

[0038] The power-off module, in response to detecting that the second register status is power-off complete, is used to complete the power-off operation, wherein the second register status is configured by the solid-state drive based on the first register status and the power-off command to perform a pseudo-power-off action;

[0039] The detection module, in response to a power-on restart, is used to detect the solid-state drive and generate an abnormal power-down detection result for the solid-state drive.

[0040] In one embodiment, in response to receiving a power-off command, the command sending module sends a power-down command to the solid-state drive according to the power-off command, including:

[0041] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0042] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0043] In one embodiment, in response to detecting that the second register state is power-down complete, the power-off module completes the power-off operation by including:

[0044] Detect the second register corresponding to the solid-state drive;

[0045] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0046] If so, continue with the shutdown process;

[0047] If not, then reacquire the state of the second register.

[0048] In one embodiment, in response to a power-on reset, the detection module detects the solid-state drive and generates an abnormal power-down detection result for the solid-state drive, including:

[0049] Attempt to access the file system;

[0050] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0051] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0052] In one embodiment, the detection module generates the abnormal power-down detection result based on the second template data and the first template data by:

[0053] Determine whether the first template data and the second template data are the same;

[0054] If so, a first abnormal power-down detection result is generated and sent to the user;

[0055] If not, a second abnormal power-down detection result is generated and sent to the user.

[0056] In one embodiment, an abnormal power-down detection device is also provided, applied to a solid-state drive, the device comprising:

[0057] The receiving module is used to receive the power-down command sent by the test host;

[0058] An acquisition module is used to acquire the state of a first register, wherein the state of the first register is configured by the test host in response to receiving an abnormal power-down test task to indicate entering the abnormal power-down test mode.

[0059] The action module is used to perform a pseudo power-down action based on the state of the first register and the power-down instruction;

[0060] The second configuration module is used to configure the state of the second register to indicate that the solid-state drive has completed power-down.

[0061] In one embodiment, the device further includes:

[0062] The formatting module, in response to a formatting command received from the test host, is used to format the file system of the solid-state drive;

[0063] The read / write module is used to receive the first template data sent by the test host and write it to the file system.

[0064] In one embodiment, the device further includes:

[0065] The data sending module, in response to the test data read request sent by the test host after power-on, is used to send the second template data to the test host so that the test host can generate the abnormal power-off detection result based on the first template data and the second template data.

[0066] In another aspect, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0067] In response to receiving an abnormal power-down test task, configure the state of the first register to indicate entering the abnormal power-down test mode;

[0068] In response to receiving a shutdown command, a power-down command is sent to the solid-state drive according to the shutdown command;

[0069] In response to detecting that the second register status is power-down complete, the power-down operation is completed, wherein the second register status is configured by the solid-state drive based on the first register status and the power-down command to perform a pseudo-power-down action;

[0070] In response to the completion of the power-on process, the solid-state drive is detected and an abnormal power-down detection result for the solid-state drive is generated.

[0071] In one embodiment, the processor performs the following steps when executing the computer program:

[0072] In response to receiving a shutdown command, sending a power-down command to the solid-state drive according to the shutdown command includes:

[0073] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0074] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0075] In one embodiment, the processor performs the following steps when executing the computer program:

[0076] In response to the detection that the second register status is power-down complete, the power-down operation is completed including:

[0077] Detect the second register corresponding to the solid-state drive;

[0078] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0079] If so, continue with the shutdown process;

[0080] If not, then reacquire the state of the second register.

[0081] In one embodiment, the processor performs the following steps when executing the computer program:

[0082] In response to the completion of a power-on restart, the detection of the solid-state drive and the generation of the abnormal power-down detection result for the solid-state drive include:

[0083] Attempt to access the file system;

[0084] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0085] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0086] In one embodiment, the processor performs the following steps when executing the computer program:

[0087] Generating the abnormal power-down detection result based on the second template data and the first template data includes:

[0088] Determine whether the first template data and the second template data are the same;

[0089] If so, a first abnormal power-down detection result is generated and sent to the user;

[0090] If not, a second abnormal power-down detection result is generated and sent to the user.

[0091] In one embodiment, the processor performs the following steps when executing the computer program:

[0092] Receive the power-down command sent by the test host;

[0093] Acquire the first register state, wherein the first register state is configured by the test host in response to receiving an abnormal power-down test task to indicate entry into the abnormal power-down test mode;

[0094] Perform a pseudo-power-down action based on the state of the first register and the power-down instruction;

[0095] Configure the second register status to indicate that the solid-state drive power-down is complete.

[0096] In one embodiment, the processor performs the following steps when executing the computer program:

[0097] In response to receiving a formatting command from the test host, the file system of the solid-state drive is formatted;

[0098] The system receives the first template data sent by the test host and writes it to the file system.

[0099] In one embodiment, the processor performs the following steps when executing the computer program:

[0100] In response to the test data read request sent by the test host after power-on, the second template data is sent to the test host so that the test host can generate the abnormal power-down detection result based on the first template data and the second template data.

[0101] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0102] In response to receiving an abnormal power-down test task, configure the state of the first register to indicate entering the abnormal power-down test mode;

[0103] In response to receiving a shutdown command, a power-down command is sent to the solid-state drive according to the shutdown command;

[0104] In response to detecting that the second register status is power-down complete, the power-down operation is completed, wherein the second register status is configured by the solid-state drive based on the first register status and the power-down command to perform a pseudo-power-down action;

[0105] In response to the completion of the power-on process, the solid-state drive is detected and an abnormal power-down detection result for the solid-state drive is generated.

[0106] In one embodiment, the computer program performs the following steps when executed by a processor:

[0107] In response to receiving a shutdown command, sending a power-down command to the solid-state drive according to the shutdown command includes:

[0108] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0109] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0110] In one embodiment, the computer program performs the following steps when executed by a processor:

[0111] In response to the detection that the second register status is power-down complete, the power-down operation is completed including:

[0112] Detect the second register corresponding to the solid-state drive;

[0113] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0114] If so, continue with the shutdown process;

[0115] If not, then reacquire the state of the second register.

[0116] In one embodiment, the computer program performs the following steps when executed by a processor:

[0117] In response to the completion of a power-on restart, the detection of the solid-state drive and the generation of the abnormal power-down detection result for the solid-state drive include:

[0118] Attempt to access the file system;

[0119] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0120] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0121] In one embodiment, the computer program performs the following steps when executed by a processor:

[0122] Generating the abnormal power-down detection result based on the second template data and the first template data includes:

[0123] Determine whether the first template data and the second template data are the same;

[0124] If so, a first abnormal power-down detection result is generated and sent to the user;

[0125] If not, a second abnormal power-down detection result is generated and sent to the user.

[0126] In one embodiment, the computer program performs the following steps when executed by a processor:

[0127] Receive the power-down command sent by the test host;

[0128] Acquire the first register state, wherein the first register state is configured by the test host in response to receiving an abnormal power-down test task to indicate entry into the abnormal power-down test mode;

[0129] Perform a pseudo-power-down action based on the state of the first register and the power-down instruction;

[0130] Configure the second register status to indicate that the solid-state drive power-down is complete.

[0131] In one embodiment, the computer program performs the following steps when executed by a processor:

[0132] In response to receiving a formatting command from the test host, the file system of the solid-state drive is formatted;

[0133] The system receives the first template data sent by the test host and writes it to the file system.

[0134] In one embodiment, the computer program performs the following steps when executed by a processor:

[0135] In response to the test data read request sent by the test host after power-on, the second template data is sent to the test host so that the test host can generate the abnormal power-down detection result based on the first template data and the second template data.

[0136] In response to receiving an abnormal power-down test task, the system configures a first register state to indicate entry into the abnormal power-down test mode; in response to receiving a power-off command, it sends a power-down command to the solid-state drive (SSD) according to the power-off command; in response to detecting that the second register state is power-down complete, it completes the power-off operation, wherein the second register state is configured by the SSD through a pseudo-power-down action based on the first register state and the power-down command; in response to power-on completion, it detects the SSD and generates an abnormal power-down detection result for the SSD. This solves the problem that using a relay-controlled switch button cannot guarantee that every power-off will enter an abnormal power-down state, improving the accuracy of abnormal power-down testing; compared to using hot-swap testing equipment such as Quarch, it reduces testing costs and can realize abnormal power-down testing of a large number of devices. Attached Figure Description

[0137] Figure 1 This is a flowchart illustrating the abnormal power-down detection method.

[0138] Figure 2 This is a schematic diagram illustrating the steps of an abnormal power-down detection method applied to a test host.

[0139] Figure 3 This is a schematic diagram illustrating the steps of an abnormal power-down detection method applied to solid-state drives;

[0140] Figure 4 This is a schematic diagram of an abnormal power-down detection device used in a test host.

[0141] Figure 5 This is a schematic diagram of a device used for detecting abnormal power-down of solid-state drives.

[0142] Figure 6 This is an internal structural diagram of the computer device in an embodiment of the present invention; Detailed Implementation

[0143] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description, in conjunction with the accompanying drawings and embodiments, further illustrates this application. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0144] The method provided in this application can be applied to, for example... Figure 1The flowchart of the abnormal power-down detection method shown above first configures the state of the first register to indicate entering the abnormal power-down test mode. Then, a formatting command is sent to the solid-state drive to format the file system of the solid-state drive and write the first template data into the file system. A power-down command is then sent to the solid-state drive. Next, the state of the second register is obtained to determine whether the solid-state drive has completed the power-down. Then, an attempt is made to access the file system. Finally, the second template data is obtained from the file system and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0145] In one embodiment, such as Figure 2 As shown, the present invention provides a method for detecting abnormal power-down, applied to a test host, the method comprising:

[0146] S201. In response to receiving an abnormal power-down test task, configure the state of the first register to indicate entering the abnormal power-down test mode.

[0147] S202. In response to receiving a power-off command, a power-down command is sent to the solid-state drive according to the power-off command;

[0148] S203. In response to detecting that the second register status is power-down complete, the power-down operation is completed, wherein the second register status is configured by the solid-state drive based on the first register status and the power-down command to perform a pseudo-power-down action.

[0149] S204. In response to the completion of power-on, detect the solid-state drive and generate an abnormal power-down detection result for the solid-state drive.

[0150] Specifically, before performing abnormal power-down detection on the SSD, the abnormal power-down test mode can be controlled by configuring the corresponding first register A of the SSD via PCIe. For example, when the host receives the abnormal power-down detection task, writing A=1 to the first register will cause the SSD to enter the abnormal power-down test mode. Writing A=0 to the first register will cause the SSD to exit the abnormal power-down test mode without affecting its use after the test is completed.

[0151] In one embodiment, in response to receiving a power-off command, sending a power-down command to the solid-state drive according to the power-off command includes:

[0152] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0153] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0154] Specifically, when the host receives a shutdown command from the user, it begins to perform the shutdown process. This involves first formatting the ext4 (Fourth extended filesystem) file system of the solid-state drive, then writing a pattern to the solid-state drive using the fio tool, and finally sending a power-down command to the solid-state drive.

[0155] In one embodiment, responding to the detection that the second register state is power-down complete, the power-off operation includes:

[0156] Detect the second register corresponding to the solid-state drive;

[0157] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0158] If so, continue with the shutdown process;

[0159] If not, then reacquire the state of the second register.

[0160] Specifically, as described above, after the test host sends a power-down command to the solid-state drive (SSD), the test host continues to acquire the status of the second register B corresponding to the SSD. If the second register indicates that the SSD has completed power-down, the test host officially completes the shutdown operation, meaning that all other components within the host have also completed power-down. However, if the second register B indicates that the SSD has not yet completed power-down, other components can be powered down first, and then the status of the second register B can be acquired again until the SSD has completed power-down, at which point the host completes the shutdown process.

[0161] In one embodiment, in response to a power-on reset, detecting the solid-state drive and generating an abnormal power-down detection result for the solid-state drive includes:

[0162] Attempt to access the file system;

[0163] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0164] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0165] Specifically, the test host can power on using a relay-controlled power switch. The SSD also powers on successfully at this time. The test host then attempts to access the SSD's file system. If access is unsuccessful or the file system is not detected, it indicates the SSD was not properly mounted after the abnormal power-down test, and an alert should be sent to the user. If the file system is successfully detected and accessed, the test host retrieves the pattern (second template data) from the file system after the abnormal power-down test and generates the final abnormal power-down detection result by comparing the two sets of data.

[0166] In one embodiment, generating the abnormal power-down detection result based on the second template data and the first template data includes:

[0167] Determine whether the first template data and the second template data are the same;

[0168] If so, a first abnormal power-down detection result is generated and sent to the user;

[0169] If not, a second abnormal power-down detection result is generated and sent to the user.

[0170] Specifically, as described above, after successfully obtaining the second template data, the original pattern (first template data) written to the file system before power-on is compared with the second template data. When the error between the two is less than, for example, within 1%, it indicates that the abnormal power-down detection of the solid-state drive is normal (first abnormal power-down detection) and is sent to the user. When the error between the two is greater than or equal to, for example, within 1%, it indicates that the abnormal power-down detection of the solid-state drive is abnormal (second abnormal power-down detection) and is sent to the user. The error coefficient can be set by the user.

[0171] In one embodiment, such as Figure 3 As shown, an abnormal power-down detection method is also provided, applied to solid-state drives, the method comprising:

[0172] S301, Receive the power-down command sent by the test host;

[0173] S302. Obtain the state of the first register, wherein the state of the first register is configured by the test host in response to receiving an abnormal power-down test task to indicate entering the abnormal power-down test mode.

[0174] S303. Perform a pseudo-power-down action based on the state of the first register and the power-down instruction;

[0175] S304. Configure the status of the second register to indicate that the solid-state drive power-down is complete.

[0176] Specifically, when receiving a power-down command from the test host, the state of the first register A is obtained. If A=1, the SSD enters an abnormal power-down test mode. In this mode, a pseudo-power-down action is performed on the received power-down command. This includes modifying the state of the corresponding second register to indicate that the power-down is complete, but not actually powering down its own file system, etc. In other words, when the host is powered off, the SSD does not perform a real power-down action, but only modifies the state of the second register.

[0177] In one embodiment, the method further includes:

[0178] S305. In response to receiving a formatting command from the test host, format the file system of the solid-state drive;

[0179] S306. Receive the first template data sent by the test host and write it into the file system.

[0180] Specifically, as mentioned above, before the host is officially shut down, a formatting command is first received from the host. According to the formatting command, the file system is formatted, that is, the original file data is cleared, and the pattern (first template data) is resent by the host.

[0181] In one embodiment, the method further includes:

[0182] S307. In response to the test data read request sent by the test host after power-on, the second template data is sent to the test host so that the test host can generate the abnormal power-off detection result based on the first template data and the second template data.

[0183] Specifically, as mentioned above, after the solid-state drive is powered on again, when a test data read request is received from the host, the pattern (second template data) in the file system after power-down and power-on is sent to the test host for comparison to generate abnormal power-down detection results.

[0184] The proposed solution has the following beneficial effects:

[0185] 1) Solved the problem that using a relay to control the switch button could not guarantee that the abnormal power-down would occur every time the device was turned off, thus improving the accuracy of abnormal power-down testing;

[0186] 2) Compared to using hot-swap testing equipment such as Quarch, it reduces testing costs and enables abnormal power-down testing of a large number of devices.

[0187] It should be understood that, although Figure 2 and Figure 3The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 2 and Figure 3 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0188] In one embodiment, such as Figure 4 As shown, an abnormal power-down detection device is provided, applied to a test host, the device comprising:

[0189] The first configuration module 401, in response to receiving the abnormal power-down test task, is used to configure the state of the first register to indicate entering the abnormal power-down test mode.

[0190] The instruction sending module 402, in response to receiving a power-off instruction, is used to send a power-down instruction to the solid-state drive according to the power-off instruction;

[0191] The power-off module 403, in response to detecting that the second register status is power-off complete, is used to complete the power-off operation, wherein the second register status is configured by the solid-state drive according to the first register status and the power-off command to perform a pseudo-power-off action;

[0192] The detection module 404, in response to the completion of power-on, is used to detect the solid-state drive and generate an abnormal power-off detection result of the solid-state drive.

[0193] In one embodiment, in response to receiving a power-off command, the command sending module sends a power-down command to the solid-state drive according to the power-off command, including:

[0194] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0195] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0196] In one embodiment, in response to detecting that the second register state is power-down complete, the power-off module completes the power-off operation by including:

[0197] Detect the second register corresponding to the solid-state drive;

[0198] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0199] If so, continue with the shutdown process;

[0200] If not, then reacquire the state of the second register.

[0201] In one embodiment, in response to a power-on reset, the detection module detects the solid-state drive and generates an abnormal power-down detection result for the solid-state drive, including:

[0202] Attempt to access the file system;

[0203] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0204] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0205] In one embodiment, the detection module generates the abnormal power-down detection result based on the second template data and the first template data by:

[0206] Determine whether the first template data and the second template data are the same;

[0207] If so, a first abnormal power-down detection result is generated and sent to the user;

[0208] If not, a second abnormal power-down detection result is generated and sent to the user.

[0209] In one embodiment, such as Figure 5 As shown, an abnormal power-down detection device is also provided, applied to a solid-state drive, the device comprising:

[0210] The receiving module 501 is used to receive the power-down command sent by the test host;

[0211] The acquisition module 502 is used to acquire the state of a first register, wherein the state of the first register is configured by the test host in response to receiving an abnormal power-down test task to indicate entering the abnormal power-down test mode.

[0212] Action module 503 is used to perform a pseudo power-down action based on the state of the first register and the power-down instruction;

[0213] The second configuration module 504 is used to configure the state of the second register to indicate that the solid-state drive has completed power-down.

[0214] In one embodiment, the device further includes:

[0215] The formatting module 505, in response to receiving a formatting command from the test host, is used to format the file system of the solid-state drive;

[0216] The read / write module 506 is used to receive the first template data sent by the test host and write it to the file system.

[0217] In one embodiment, the device further includes:

[0218] The data sending module 507, in response to the test data reading request sent by the test host after power-on, is used to send the second template data to the test host so that the test host can generate the abnormal power-off detection result based on the first template data and the second template data.

[0219] Specific limitations regarding the abnormal power-down detection device can be found in the limitations of the abnormal power-down detection method described above, and will not be repeated here. Each module in the aforementioned abnormal power-down detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0220] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements an alarm information processing method. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0221] Those skilled in the art will understand that Figure 6The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0222] In one embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0223] In response to receiving an abnormal power-down test task, configure the state of the first register to indicate entering the abnormal power-down test mode;

[0224] In response to receiving a shutdown command, a power-down command is sent to the solid-state drive according to the shutdown command;

[0225] In response to detecting that the second register status is power-down complete, the power-down operation is completed, wherein the second register status is configured by the solid-state drive based on the first register status and the power-down command to perform a pseudo-power-down action;

[0226] In response to the completion of the power-on process, the solid-state drive is detected and an abnormal power-down detection result for the solid-state drive is generated.

[0227] In one embodiment, the processor performs the following steps when executing the computer program:

[0228] In response to receiving a shutdown command, sending a power-down command to the solid-state drive according to the shutdown command includes:

[0229] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0230] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0231] In one embodiment, the processor performs the following steps when executing the computer program:

[0232] In response to the detection that the second register status is power-down complete, the power-down operation is completed including:

[0233] Detect the second register corresponding to the solid-state drive;

[0234] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0235] If so, continue with the shutdown process;

[0236] If not, then reacquire the state of the second register.

[0237] In one embodiment, the processor performs the following steps when executing the computer program:

[0238] In response to the completion of a power-on restart, the detection of the solid-state drive and the generation of the abnormal power-down detection result for the solid-state drive include:

[0239] Attempt to access the file system;

[0240] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0241] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0242] In one embodiment, the processor performs the following steps when executing the computer program:

[0243] Generating the abnormal power-down detection result based on the second template data and the first template data includes:

[0244] Determine whether the first template data and the second template data are the same;

[0245] If so, a first abnormal power-down detection result is generated and sent to the user;

[0246] If not, a second abnormal power-down detection result is generated and sent to the user.

[0247] In one embodiment, the processor performs the following steps when executing the computer program:

[0248] Receive the power-down command sent by the test host;

[0249] Acquire the first register state, wherein the first register state is configured by the test host in response to receiving an abnormal power-down test task to indicate entry into the abnormal power-down test mode;

[0250] Perform a pseudo-power-down action based on the state of the first register and the power-down instruction;

[0251] Configure the second register status to indicate that the solid-state drive power-down is complete.

[0252] In one embodiment, the processor performs the following steps when executing the computer program:

[0253] In response to receiving a formatting command from the test host, the file system of the solid-state drive is formatted;

[0254] The system receives the first template data sent by the test host and writes it to the file system.

[0255] In one embodiment, the processor performs the following steps when executing the computer program:

[0256] In response to the test data read request sent by the test host after power-on, the second template data is sent to the test host so that the test host can generate the abnormal power-down detection result based on the first template data and the second template data.

[0257] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0258] In response to receiving an abnormal power-down test task, configure the state of the first register to indicate entering the abnormal power-down test mode;

[0259] In response to receiving a shutdown command, a power-down command is sent to the solid-state drive according to the shutdown command;

[0260] In response to detecting that the second register status is power-down complete, the power-down operation is completed, wherein the second register status is configured by the solid-state drive based on the first register status and the power-down command to perform a pseudo-power-down action;

[0261] In response to the completion of the power-on process, the solid-state drive is detected and an abnormal power-down detection result for the solid-state drive is generated.

[0262] In one embodiment, the computer program performs the following steps when executed by a processor:

[0263] In response to receiving a shutdown command, sending a power-down command to the solid-state drive according to the shutdown command includes:

[0264] Send a formatting command to the solid-state drive to format the file system of the solid-state drive;

[0265] Write the first template data to the file system and send a power-down command to the solid-state drive.

[0266] In one embodiment, the computer program performs the following steps when executed by a processor:

[0267] In response to the detection that the second register status is power-down complete, the power-down operation is completed including:

[0268] Detect the second register corresponding to the solid-state drive;

[0269] Obtain the status of the second register and determine whether the solid-state drive has completed power-down;

[0270] If so, continue with the shutdown process;

[0271] If not, then reacquire the state of the second register.

[0272] In one embodiment, the computer program performs the following steps when executed by a processor:

[0273] In response to the completion of a power-on restart, the detection of the solid-state drive and the generation of the abnormal power-down detection result for the solid-state drive include:

[0274] Attempt to access the file system;

[0275] If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user.

[0276] If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

[0277] In one embodiment, the computer program performs the following steps when executed by a processor:

[0278] Generating the abnormal power-down detection result based on the second template data and the first template data includes:

[0279] Determine whether the first template data and the second template data are the same;

[0280] If so, a first abnormal power-down detection result is generated and sent to the user;

[0281] If not, a second abnormal power-down detection result is generated and sent to the user.

[0282] In one embodiment, the computer program performs the following steps when executed by a processor:

[0283] Receive the power-down command sent by the test host;

[0284] Acquire the first register state, wherein the first register state is configured by the test host in response to receiving an abnormal power-down test task to indicate entry into the abnormal power-down test mode;

[0285] Perform a pseudo-power-down action based on the state of the first register and the power-down instruction;

[0286] Configure the second register status to indicate that the solid-state drive power-down is complete.

[0287] In one embodiment, the computer program performs the following steps when executed by a processor:

[0288] In response to receiving a formatting command from the test host, the file system of the solid-state drive is formatted;

[0289] The system receives the first template data sent by the test host and writes it to the file system.

[0290] In one embodiment, the computer program performs the following steps when executed by a processor:

[0291] In response to the test data read request sent by the test host after power-on, the second template data is sent to the test host so that the test host can generate the abnormal power-down detection result based on the first template data and the second template data.

[0292] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0293] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0294] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for detecting abnormal power-down, applied to a test host, the method comprising: In response to receiving an abnormal power-down test task, configure the state of the first register to indicate entering the abnormal power-down test mode; In response to receiving a shutdown command, a power-down command is sent to the solid-state drive according to the shutdown command; In response to detecting that the second register status is power-down complete, the power-down operation is completed, wherein the second register status is configured by the solid-state drive based on the first register status and the power-down command by performing a pseudo-power-down action; In response to the completion of power-on, the solid-state drive is detected and an abnormal power-down detection result of the solid-state drive is generated; Specifically, in response to receiving a shutdown command, sending a power-down command to the solid-state drive according to the shutdown command includes: Send a formatting command to the solid-state drive to format the file system of the solid-state drive; Write the first template data into the file system and send a power-down command to the solid-state drive; In response to the detection that the second register status is power-down complete, the power-off operation is completed including: Detect the second register corresponding to the solid-state drive; Obtain the status of the second register and determine whether the solid-state drive has completed power-down; If so, continue with the shutdown process; If not, then reacquire the state of the second register; In response to the completion of a power-on restart, the detection of the solid-state drive and the generation of the abnormal power-down detection result for the solid-state drive include: Attempt to access the file system; If the process fails, it will be determined that the solid-state drive is not mounted and an alarm message will be sent to the user. If successful, the second template data is obtained from the file system, and the abnormal power-down detection result is generated based on the second template data and the first template data.

2. The method according to claim 1, characterized in that, Generating the abnormal power-down detection result based on the second template data and the first template data includes: Determine whether the first template data and the second template data are the same; If so, a first abnormal power-down detection result is generated and sent to the user; If not, a second abnormal power-down detection result is generated and sent to the user.

3. An abnormal power-down detection method, applied to a solid-state drive, the method comprising: Receive the power-down command sent by the test host; Acquire the first register state, wherein the first register state is configured by the test host in response to receiving an abnormal power-down test task to indicate entry into the abnormal power-down test mode; Perform a pseudo-power-down action based on the state of the first register and the power-down instruction; Configure the second register status to indicate that the solid-state drive power-down is complete; In response to receiving a formatting command from the test host, the file system of the solid-state drive is formatted; Receive the first template data sent by the test host and write it to the file system; In response to the test data read request sent by the test host after power-on, the second template data is sent to the test host so that the test host can generate an abnormal power-off detection result based on the first template data and the second template data.

4. An electronic device, characterized in that, include: One or more processors; And a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the method as described in any one of claims 1 to 3.

5. A computer storage medium, characterized in that, It stores a computer program, which, when executed by a processor, implements the method as described in any one of claims 1 to 3.

Citation Information

Patent Citations

  • Testing method of NVDIMM_ADR function

    CN106683706A

  • Server powering-off test method and device based on Phytium platform

    CN108614754A