A solid state disk data recording method, device, equipment and medium
By introducing a soft interrupt module and a logging module into the solid-state drive and registering callback functions, a method for efficiently caching and persisting data during abnormal power-off is implemented, solving the data loss problem in traditional methods and improving the efficiency of fault diagnosis.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
- Filing Date
- 2022-10-19
- Publication Date
- 2026-06-26
AI Technical Summary
Traditional solid-state drives (SSDs) have a lengthy logging process when experiencing abnormal power-downs, leading to a high probability of critical data loss and failing to meet the needs of efficient management and fault diagnosis.
A soft interrupt module and a log module are added to the main core, a callback function is registered, abnormal power-down is detected through the soft interrupt module, and the data of the slave core functional module is cached and persisted in the log module. Data storage is implemented using pure software logic.
It effectively reduces the risk of data loss, ensures that critical data is saved quickly and efficiently in abnormal situations, and makes it easier for staff to locate the cause of the problem and solve it.
Smart Images

Figure CN115617556B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage, and more particularly to a method, apparatus, device, and medium for recording data on a solid-state drive. Background Technology
[0002] Early solid-state drives (SSDs) mostly used the SATA interface, which was sufficient for system performance requirements at the time. However, the development of big data-related industries also drove the development of SSD technology. The storage and read speeds of older SATA hard drives could no longer meet the needs of these industries. This led to the emergence of SSDs using the NVMe protocol and PCIe interface. NVMe SSDs feature low latency, high performance, and low power consumption, making them increasingly popular in server applications due to their faster and more efficient performance. Simultaneously, with the significant increase in storage and read speeds of NVMe SSDs, the amount of data processed per unit of time has also increased dramatically, naturally increasing the probability of device failure. To ensure safe and stable operation, an efficient and comprehensive log management module is needed to facilitate system diagnosis and maintenance by administrators in the event of an NVMe SSD failure. The log module, as an independent software module, is responsible for recording system log information and recording and saving critical information in the event of system anomalies.
[0003] Traditional solid-state drive (SSD) data logging methods involve each Cortex R8 core independently undergoing its own power-down process when the device malfunctions, saving data during this process. However, this logging method is too lengthy, and in the event of an abnormal power-down, there is a high probability that the process cannot be completed, leading to the loss of a large amount of critical data. Therefore, improvements are urgently needed. Summary of the Invention
[0004] In view of this, it is necessary to provide a solid-state drive data recording method, device, equipment, and medium to address the above technical problems.
[0005] According to a first aspect of the present invention, a solid-state drive (SSD) data recording method is provided, applied to an SSD including a master core and multiple slave cores, the method comprising:
[0006] A soft interrupt module and a log module are added to the main core, and the first callback function of the log module is registered to the soft interrupt module. Each functional module of the slave core requests storage space corresponding to its respective functional module in the log module, and the second callback function of each functional module of the slave core is registered to the log module. The soft interrupt module is used to detect abnormal power-down of the solid-state drive.
[0007] In response to an abnormal power-down event that triggers the soft interrupt module, the soft interrupt module calls the log module to perform data saving through the first callback function registered therein;
[0008] When the log module performs data saving, it calls the second callback function registered therein to cache the data in the corresponding storage space in the log module through each functional module of the kernel. After caching is completed, the data is persisted.
[0009] In some embodiments, a soft interrupt module and a logging module are added to the main core, and the first callback function of the logging module is registered to the soft interrupt module. Storage space corresponding to each functional module of the slave core is allocated in the logging module for each functional module, and the second callback function of each functional module of the slave core is registered to the logging module, including:
[0010] After the solid-state drive system is powered on, the BOOT code embedded in the ROM is executed to parse the firmware package to find the FSBL code, and then the FSBL code is loaded into RAM;
[0011] The FSBL code is executed to initialize the clock, DRAM and some peripheral hardware modules, initialize the log module, initialize the soft interrupt module, and register the first callback function of the log module to the soft interrupt module.
[0012] Scan and traverse the remaining firmware packages. If the firmware identifier belongs to a slave core, write the entry address of the slave core into the corresponding entry register and set the status register of the slave core to valid.
[0013] The master core opens the power domain of each slave core that has finished loading the firmware and executes a wake-up command to wake up the other slave cores;
[0014] During the startup process, the main core initializes the soft interrupt module, log module, NVMe module, and PCIe module.
[0015] After startup, each slave core initializes its own internal control mgr module, admin module, nandflash mgr module, thermal module, and efuse module. During initialization, each module running within the slave core registers a portion of memory in the log module to store important data for each module. At the same time, the second callback function corresponding to each module running within the slave core is also registered in the log module.
[0016] In some embodiments, in response to an abnormal power-down event and triggering the soft interrupt module, the soft interrupt module invokes the log module to perform data saving through the first callback function registered therein, including:
[0017] Abnormal power-down triggers the soft interrupt module;
[0018] The soft interrupt module calls the first callback function registered in the log module to trigger the log module's functionality.
[0019] In some embodiments, when the log module performs data saving, it calls the second callback function registered therein to cache the data in the corresponding storage space of the kernel's functional modules. After caching is completed, the data is persisted, including:
[0020] The logging module calls the second callback function registered by the control mgr module, admin module, nand flash mgr module, thermal module, and efuse module running inside the kernel to save their respective data.
[0021] After the data is saved in the log module, the NAND flash mgr module performs the data persistence operation to save the data to the NAND flash.
[0022] In some embodiments, the method further includes:
[0023] Use the command `nvme diag_print_ras_info -f 0` to retrieve all data saved by the log module;
[0024] The command `nvme diag_print_ras_info –f 1` outputs the data saved by the pre-formatted log module.
[0025] In some embodiments, the method further includes:
[0026] In response to the input of the commands nvme diag_print_ras_info –f 0 and / or nvme diag_print_ras_info –f1, the host and the solid-state drive communicate.
[0027] The kernel calls the NAND flash mgr module to read data from the NAND flash and store it in the main kernel's log module;
[0028] The main core transmits the data from the log module to the host, and the host outputs the data through the terminal.
[0029] In some embodiments, the solid-state drive includes one master core and three slave cores.
[0030] According to a second aspect of the present invention, a solid-state drive (SSD) data recording device is provided, applied to an SSD including a master core and multiple slave cores, the device comprising:
[0031] The registration unit is configured to add a soft interrupt module and a log module to the main core, and register the first callback function of the log module to the soft interrupt module. It also requests storage space corresponding to each functional module of the slave core in the log module and registers the second callback function of each functional module of the slave core to the log module. The soft interrupt module is used to detect abnormal power-down of the solid-state drive.
[0032] The first callback unit is configured to respond to an abnormal power-down event and trigger the soft interrupt module. The soft interrupt module then calls the log module to perform data saving through the first callback function registered therein.
[0033] The second callback unit is configured to call the second callback function registered therein when the log module performs data saving to cache the data in the corresponding storage space of the log module through each functional module of the kernel, and then persist the data after caching.
[0034] According to a third aspect of the present invention, a computer device is also provided, the computer device comprising:
[0035] At least one processor; and
[0036] The memory stores a computer program that can run on a processor, and when the processor executes the program, it performs the aforementioned solid-state drive data recording method.
[0037] According to a fourth aspect of the present invention, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, performs the aforementioned solid-state hard disk data recording method.
[0038] The aforementioned solid-state drive (SSD) data recording method employs a multi-core system within the SSD, with each core responsible for its own functional module. During initialization, each functional module registers a portion of memory in the log module to store its own data, along with its callback functions. When an exception occurs, a soft interrupt is triggered. During the execution of the soft interrupt, the log module unit begins working, calling the callback functions registered during the initialization of each functional module. Each functional module's callback function is responsible for saving important data within that module. By implementing the corresponding functions using pure software logic, this method can efficiently store and persist important data, significantly reducing the risk of data loss. It also ensures that after a device malfunctions, staff can quickly and efficiently locate and resolve the problem in the shortest possible time.
[0039] In addition, the present invention also provides a solid-state drive data recording device, a computer device, and a computer-readable storage medium, which can achieve the above-mentioned technical effects, and will not be described in detail here. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.
[0041] Figure 1 A flowchart illustrating a solid-state drive data recording method according to an embodiment of the present invention;
[0042] Figure 2 This is a schematic diagram of a multi-core boot process provided in one embodiment of the present invention;
[0043] Figure 3 Other schematic diagrams of kernel initialization provided for one embodiment of the present invention
[0044] Figure 4 This is a schematic diagram of the log storage process when a solid-state drive experiences an abnormal power-off, provided in another embodiment of the present invention.
[0045] Figure 5 A schematic diagram of a solid-state drive data recording device provided in another embodiment of the present invention;
[0046] Figure 6 This is an internal structural diagram of a computer device according to another embodiment of the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.
[0048] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities or parameters with the same name but different names. It is clear that "first" and "second" are only for the convenience of expression and should not be construed as limiting the embodiments of the present invention. Subsequent embodiments will not explain this in detail.
[0049] In one embodiment, please refer to Figure 1 As shown, the present invention provides a solid-state drive (SSD) data recording method 100, applied to an SSD including one master core and multiple slave cores. Specifically, the method includes the following steps:
[0050] Step 101: Add a soft interrupt module and a log module to the main core, and register the first callback function of the log module to the soft interrupt module. Allocate storage space corresponding to each functional module of the slave core in the log module, and register the second callback function of each functional module of the slave core to the log module. The soft interrupt module is used to detect abnormal power-down of the solid-state drive.
[0051] Step 102: In response to an abnormal power-down event that triggers the soft interrupt module, the soft interrupt module calls the log module to perform data saving through the first callback function registered therein.
[0052] Step 103: When the log module performs data saving, it calls the second callback function registered therein to cache the data in the corresponding storage space in the log module through each functional module of the kernel. After caching is completed, the data is persisted.
[0053] The aforementioned solid-state drive (SSD) data recording method employs a multi-core system within the SSD, with each core responsible for its own functional module. During initialization, each functional module registers a portion of memory in the log module to store its own data, along with its callback functions. When an exception occurs, a soft interrupt is triggered. During the execution of the soft interrupt, the log module unit begins working, calling the callback functions registered during the initialization of each functional module. Each functional module's callback function is responsible for saving important data. By implementing the corresponding functions using pure software logic, this method can efficiently store and persist important data, significantly reducing the risk of data loss. It ensures that after a device malfunctions, staff can quickly and efficiently locate and resolve the problem in the shortest possible time.
[0054] In some embodiments, step 101 involves adding a soft interrupt module and a logging module to the main core, registering the first callback function of the logging module to the soft interrupt module, requesting storage space corresponding to each functional module in the logging module for each functional module of the slave core, and registering the second callback function of each functional module of the slave core to the logging module, including:
[0055] After the solid-state drive system is powered on, the BOOT code embedded in the ROM is executed to parse the firmware package to find the FSBL code and load the FSBL code into RAM;
[0056] The FSBL code is executed to initialize the clock, DRAM and some peripheral hardware modules, initialize the log module, initialize the soft interrupt module, and register the first callback function of the log module to the soft interrupt module.
[0057] Scan and traverse the remaining firmware packages. If the firmware identifier belongs to a slave core, write the entry address of the slave core into the corresponding entry register and set the status register of the slave core to valid.
[0058] The master core opens the power domain of each slave core that has finished loading the firmware and executes a wake-up command to wake up the other slave cores;
[0059] During the startup process, the main core initializes the soft interrupt module, log module, NVMe module, and PCIe module.
[0060] After startup, each slave core initializes its own internal control mgr module, admin module, nandflash mgr module, thermal module, and efuse module. During initialization, each module running within the slave core registers a portion of memory in the log module to store important data for each module. At the same time, the second callback function corresponding to each module running within the slave core is also registered in the log module.
[0061] In some embodiments, in step 102, in response to an abnormal power-down event and triggering the soft interrupt module, the soft interrupt module calls the log module to perform data saving through the first callback function registered therein, including:
[0062] Abnormal power-down triggers the soft interrupt module;
[0063] The soft interrupt module calls the first callback function registered in the log module to trigger the log module's functionality.
[0064] In some embodiments, step 103, when the log module performs data saving, calls the second callback function registered therein to cache the data from each core functional module into the corresponding storage space in the log module, and after caching is completed, persists the data, including:
[0065] The logging module calls the second callback function registered by the control mgr module, admin module, nand flash mgr module, thermal module, and efuse module running inside the kernel to save their respective data.
[0066] After the data is saved in the log module, the NAND flash mgr module performs the data persistence operation to save the data to the NAND flash.
[0067] In some embodiments, the method further includes:
[0068] Use the command `nvme diag_print_ras_info -f 0` to retrieve all data saved by the log module;
[0069] The command `nvme diag_print_ras_info –f 1` outputs the data saved by the pre-formatted log module.
[0070] In some embodiments, the method further includes:
[0071] In response to the input of the commands nvme diag_print_ras_info –f 0 and / or nvme diag_print_ras_info –f 1, the host and the solid-state drive communicate.
[0072] The kernel calls the NAND flash mgr module to read data from the NAND flash and store it in the main kernel's log module;
[0073] The main core transmits the data from the log module to the host, and the host outputs the data through the terminal.
[0074] In some embodiments, the solid-state drive includes one master core and three slave cores.
[0075] In another embodiment, to facilitate understanding of the present invention, a solid-state drive (SSD) of a multi-core system composed of four Cortex R8 cores will be used as an example for illustration. Please refer to... Figure 2 , Figure 3 and Figure 4 As shown in the figure, this embodiment provides another method for recording data on a solid-state drive. The specific implementation process is as follows:
[0076] Step one: After the SSD hard drive system powers on, the Cortex R8_0 power domain powers on. After the Cortex R8_0 boots up, it executes the BOOT code embedded in ROM and parses the firmware package stored in NAND or SPI flash. The Cortex R8_0 finds the FSBL (first boot loader) code in the firmware package and loads it into RAM. The Cortex R8_0 executes the FSBL (First boot loader) code to initialize the clock, DRAM, and some peripheral hardware modules, initialize the log module, and initialize the soft interrupt module.
[0077] Step 2: Scan and traverse the remaining firmware packages. If the CPU firmware identifier is a Cortex R8 series CPU, write the entry address of the CPU into the corresponding entry register of the CPU and set the status register of the CPU to valid.
[0078] Step 3: Cortex R8_0 opens the power domain of the Cortex R8 series CPUs that have been loaded with firmware and executes the wake-up command to wake up other R8 CPUs in the same CLUSTER, including Cortex R8_1, Cortex R8_2, and Cortex R8_3.
[0079] Step four: During the startup process, the Cortex R8_0 core initializes modules such as the soft interrupt module, log module, NVMe module, and PCIe module.
[0080] Step five: After startup, Cortex R8_1, Cortex R8_2, and Cortex R8_3 will initialize the modules running within each core, such as the control mgr module, admin module, NAND flash mgr module, thermal module, efuse module, and other important modules running in the system. During initialization, these modules will register a portion of memory in the log module to store important data such as logs. Callback functions will also be registered in the log module.
[0081] Step six: Once the system has fully booted up, the host can communicate normally with the device. At this point, the device is in normal operating condition.
[0082] Step 7: When a device malfunctions and causes an abnormal power-off, the log module needs to immediately store important log information from each module after the abnormal power-off occurs.
[0083] Step 8: An abnormal power outage will trigger the soft interrupt module. The soft interrupt module will call the callback function registered in the log module, thereby triggering the log module's function. The log module will call the callback functions registered by each module to the log module to save their respective data.
[0084] Step nine: After the data in the log module is saved, the NAND flash mgr module performs data persistence operations to ensure that the data is not lost when the device is powered off.
[0085] Step 10: To facilitate quick analysis of SSD failure causes, staff can use the command `nvmediag_print_ras_info –f 0` to retrieve all data saved in the log module. The command `nvme diag_print_ras_info –f 1` can format the output of the log module data for easier analysis. When these commands are entered, the host communicates with the SSD device. The Cortex R8_3 core then calls the NAND flash mgr module to read data from the NAND flash and store it in the log module. The Cortex R8_0 core then transfers the data from the log module to the host, which then outputs the data via the terminal.
[0086] The aforementioned solid-state drive (SSD) data recording method, compared to traditional solutions, does not increase the communication workload between the SSD and the host, nor does it increase the data processing burden on the individual cores of the SSD. It implements a logic based on soft interrupts to trigger the saving of important data. During initialization, each module requests content in the log module for data storage. During startup, the soft interrupt module is initialized first, followed by the log module, and finally other modules. This ensures that the log module can register with the soft interrupt module, and other modules can register with the log module, significantly shortening log storage time. Furthermore, the modular code implementation facilitates unified management and function portability. By storing all data that each module needs to save in the log module through modular design, it ensures that important data or logs can be efficiently stored and persisted when the device malfunctions. This ensures that after a device malfunction, staff can quickly and efficiently locate and resolve the problem. In addition, to facilitate analysis of the SSD device, the `nvme diag_print_ras_info` command was designed, adding formatted output functionality and improving readability.
[0087] In yet another embodiment, please refer to Figure 5 As shown, the present invention also provides a solid-state drive data recording device 200, applied to a solid-state drive including a master core and multiple slave cores, the device comprising:
[0088] Registration unit 201 is configured to add a soft interrupt module and a log module to the main core, and register the first callback function of the log module to the soft interrupt module, apply for storage space corresponding to each functional module in the log module for each functional module of the slave core, and register the second callback function of each functional module of the slave core to the log module, wherein the soft interrupt module is used to detect abnormal power-down of the solid-state drive;
[0089] The first callback unit 202 is configured to respond to an abnormal power-down event and trigger the soft interrupt module, in which case the soft interrupt module calls the log module to perform data saving through the first callback function registered therein;
[0090] The second callback unit 203 is configured to call the second callback function registered therein to cache the data in the corresponding storage space in the log module when the log module performs data saving, and then persist the data after caching.
[0091] The aforementioned solid-state drive (SSD) data recording device employs a multi-core system within the SSD, with each core responsible for its own functional module. During initialization, each functional module registers a portion of memory in the log module to store its own data, along with its callback functions. When an exception occurs, a soft interrupt is triggered. During the execution of the soft interrupt, the log module unit begins working, calling the callback functions registered during the initialization of each functional module. Each functional module's callback function is responsible for saving important data. By implementing the corresponding functions using pure software logic, important data can be efficiently stored and persistently stored, greatly reducing the risk of data loss. This ensures that after a device malfunctions, staff can quickly and efficiently locate and resolve the problem in the shortest possible time.
[0092] In some embodiments, the registration unit 201 is further configured to:
[0093] After the solid-state drive system is powered on, the BOOT code embedded in the ROM is executed to parse the firmware package to find the FSBL code, and then the FSBL code is loaded into RAM;
[0094] The FSBL code is executed to initialize the clock, DRAM and some peripheral hardware modules, initialize the log module, initialize the soft interrupt module, and register the first callback function of the log module to the soft interrupt module.
[0095] Scan and traverse the remaining firmware packages. If the firmware identifier belongs to a slave core, write the entry address of the slave core into the corresponding entry register and set the status register of the slave core to valid.
[0096] The master core opens the power domain of each slave core that has finished loading the firmware and executes a wake-up command to wake up the other slave cores;
[0097] During the startup process, the main core initializes the soft interrupt module, log module, NVMe module, and PCIe module.
[0098] After startup, each slave core initializes its own internal control mgr module, admin module, nandflash mgr module, thermal module, and efuse module. During initialization, each module running within the slave core registers a portion of memory in the log module to store important data for each module. At the same time, the second callback function corresponding to each module running within the slave core is also registered in the log module.
[0099] In some embodiments, the first callback unit is further configured to:
[0100] Abnormal power-down triggers the soft interrupt module;
[0101] The soft interrupt module calls the first callback function registered in the log module to trigger the log module's functionality.
[0102] In some embodiments, the second callback unit is further configured to:
[0103] The logging module calls the second callback function registered by the control mgr module, admin module, nand flash mgr module, thermal module, and efuse module running inside the kernel to save their respective data.
[0104] After the data is saved in the log module, the NAND flash mgr module performs the data persistence operation to save the data to the NAND flash.
[0105] In some embodiments, the device further comprises:
[0106] The read unit is configured to retrieve all data saved by the log module using the nvme diag_print_ras_info –f 0 command;
[0107] The output unit is configured to store data in the log module using the preset formatting of the nvme diag_print_ras_info –f 1 command.
[0108] In some embodiments, the apparatus further includes a module configured to perform the following steps:
[0109] In response to the input of the commands nvme diag_print_ras_info –f 0 and / or nvme diag_print_ras_info –f 1, the host and the solid-state drive communicate.
[0110] The kernel calls the NAND flash mgr module to read data from the NAND flash and store it in the main kernel's log module;
[0111] The main core transmits the data from the log module to the host, and the host outputs the data through the terminal.
[0112] In some embodiments, the solid-state drive includes one master core and three slave cores.
[0113] It should be noted that the specific limitations regarding the solid-state drive (SSD) data recording device can be found in the limitations of the SSD data recording method described above, and will not be repeated here. Each unit in the aforementioned SSD data recording device can be implemented entirely or partially through software, hardware, or a combination thereof. These units can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each unit.
[0114] According to another aspect of the present invention, a computer device is provided, which may be a server, and its internal structure diagram is shown below. Figure 6 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements the solid-state drive data recording method described above, applied to a solid-state drive including one master core and multiple slave cores. Specifically, the method includes the following steps:
[0115] A soft interrupt module and a log module are added to the main core, and the first callback function of the log module is registered to the soft interrupt module. Each functional module of the slave core requests storage space corresponding to its respective functional module in the log module, and the second callback function of each functional module of the slave core is registered to the log module. The soft interrupt module is used to detect abnormal power-down of the solid-state drive.
[0116] In response to an abnormal power-down event that triggers the soft interrupt module, the soft interrupt module calls the log module to perform data saving through the first callback function registered therein;
[0117] When the log module performs data saving, it calls the second callback function registered therein to cache the data in the corresponding storage space in the log module through each functional module of the kernel. After caching is completed, the data is persisted.
[0118] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program implements the above-described solid-state drive data recording method, applicable to a solid-state drive including one master core and multiple slave cores. Specifically, it includes performing the following steps:
[0119] A soft interrupt module and a log module are added to the main core, and the first callback function of the log module is registered to the soft interrupt module. Each functional module of the slave core requests storage space corresponding to its respective functional module in the log module, and the second callback function of each functional module of the slave core is registered to the log module. The soft interrupt module is used to detect abnormal power-down of the solid-state drive.
[0120] In response to an abnormal power-down event that triggers the soft interrupt module, the soft interrupt module calls the log module to perform data saving through the first callback function registered therein;
[0121] When the log module performs data saving, it calls the second callback function registered therein to cache the data in the corresponding storage space in the log module through each functional module of the kernel. After caching is completed, the data is persisted.
[0122] 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.
[0123] 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 are 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.
[0124] 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 recording data on a solid-state drive, characterized in that, Applied to solid-state drives comprising one master core and multiple slave cores, the method includes: A soft interrupt module and a log module are added to the main core, and the first callback function of the log module is registered to the soft interrupt module. Each functional module of the slave core requests storage space corresponding to its respective functional module in the log module, and the second callback function of each functional module of the slave core is registered to the log module. The soft interrupt module is used to detect abnormal power-down of the solid-state drive. In response to an abnormal power-down event that triggers the soft interrupt module, the soft interrupt module calls the log module to perform data saving through the first callback function registered therein; When the log module performs data saving, it calls the second callback function registered therein to call the functional modules of the kernel to cache the data into the corresponding storage space in the log module. This includes the log module calling the second callback function registered to the log module by the controlmgr module, admin module, nand flash mgr module, thermal module, and efuse module running inside the kernel to save their respective important data. After caching is completed, the data is persisted.
2. The solid-state drive data recording method according to claim 1, characterized in that, A soft interrupt module and a logging module are added to the main core. The first callback function of the logging module is registered to the soft interrupt module. Storage space corresponding to each functional module of the slave core is allocated in the logging module, and the second callback functions of each functional module of the slave core are registered to the logging module. This includes: After the solid-state drive system is powered on, the BOOT code embedded in the ROM is executed to parse the firmware package to find the FSBL code, and then the FSBL code is loaded into RAM; The FSBL code is executed to initialize the clock, DRAM and some peripheral hardware modules, initialize the log module, initialize the soft interrupt module, and register the first callback function of the log module to the soft interrupt module. Scan and traverse the remaining firmware packages. If the firmware identifier belongs to a slave core, write the entry address of the slave core into the corresponding entry register and set the status register of the slave core to valid. The master core opens the power domain of each slave core that has finished loading the firmware and executes a wake-up command to wake up the other slave cores; During the startup process, the main core initializes the soft interrupt module, log module, NVMe module, and PCIe module. After startup, each slave core initializes its own control mgr module, admin module, nandflash mgr module, thermal module, and efuse module. During initialization, each module running within the slave core registers a portion of memory in the log module to store important data for each module. At the same time, the second callback function corresponding to each module running within the slave core is also registered in the log module.
3. The solid-state drive data recording method according to claim 2, characterized in that, In response to an abnormal power-down event that triggers the soft interrupt module, the soft interrupt module invokes the log module to perform data saving through the first callback function registered therein, including: Abnormal power-down triggers the soft interrupt module; The soft interrupt module calls the first callback function registered in the log module to trigger the log module's functionality.
4. The solid-state drive data recording method according to claim 2, characterized in that, When the log module performs data saving, it calls the second callback function registered within it to cache the data in the corresponding storage space of the log module from the various functional modules of the kernel. After caching, the data is persisted. This also includes: After the data is saved in the log module, the NAND flash mgr module performs data persistence operations to save the data to the NAND flash.
5. The solid-state drive data recording method according to claim 2, characterized in that, The method further includes: Use the command `nvme diag_print_ras_info -f 0` to retrieve all data saved by the log module; The command `nvme diag_print_ras_info -f 1` outputs the data saved by the pre-formatted log module.
6. The solid-state drive data recording method according to claim 5, characterized in that, The method further includes: In response to the input of the commands nvme diag_print_ras_info –f 0 and / or nvme diag_print_ras_info –f 1, the host and the solid-state drive communicate. The kernel calls the NAND flash mgr module to read data from the NAND flash and store it in the main kernel's log module; The main core transmits the data from the log module to the host, and the host outputs the data through the terminal.
7. The solid-state drive data recording method according to any one of claims 1-6, characterized in that, The solid-state drive includes one master core and three slave cores.
8. A solid-state drive data recording device, characterized in that, A solid-state drive comprising one master core and multiple slave cores, the device comprising: The registration unit is configured to add a soft interrupt module and a log module to the main core, and register the first callback function of the log module to the soft interrupt module. It also requests storage space corresponding to each functional module of the slave core in the log module and registers the second callback function of each functional module of the slave core to the log module. The soft interrupt module is used to detect abnormal power-down of the solid-state drive. The first callback unit is configured to respond to an abnormal power-down event and trigger the soft interrupt module. The soft interrupt module then calls the log module to perform data saving through the first callback function registered therein. The second callback unit is configured to call the second callback function registered therein when the log module performs data saving, so that the data is first cached in the corresponding storage space of the kernel by each functional module. This includes the log module calling the second callback function registered to the log module by the control mgr module, admin module, nand flash mgr module, thermal module, and efuse module running inside the kernel to save their respective important data, and then persisting the data after caching.
9. A computer device, characterized in that, include: At least one processor; as well as A memory storing a computer program executable in the processor, wherein the processor executes the program to perform the method according to any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it performs the method described in any one of claims 1-7.