Method for persistent dynamic storage of PMR in SSD during abnormal power failure

By using dynamic priority scheduling and a lightweight convolutional neural network model, the problem of PMR data not being saved in time during abnormal power outages is solved, achieving complete preservation of the PMR region and recovery after power-on, thus improving the system robustness and performance of the SSD.

CN121833337APending Publication Date: 2026-04-10SHANDONG SINOCHIP SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-10
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In the event of an abnormal power outage, existing technologies cannot save PMR data to flash memory in a timely manner, resulting in data loss, affecting the non-volatile function of SSDs, and requiring additional hardware modules that consume capacitors, thus lacking system robustness.

Method used

By employing a dynamic priority scheduling method and a lightweight convolutional neural network model, and utilizing the SSD's own I/O command processing flow, important data is prioritized for saving during abnormal power outages. Furthermore, priority is calculated through dynamic weights to reduce capacitor overhead, thereby achieving complete preservation of the PMR region and recovery after power-on.

Benefits of technology

Effectively preserving PMR area data during abnormal power outages enhances system robustness and performance, reduces capacitor consumption from additional hardware modules, ensures the non-volatile nature of the PMR area, and improves the overall security and reliability of the SSD.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121833337A_ABST
    Figure CN121833337A_ABST
Patent Text Reader

Abstract

The invention relates to the field of storage, in particular to a method for persistent dynamic storage of a PMR in an SSD during abnormal power failure. According to the method, after abnormal power failure occurs and hardware for carrying data between a host and an SSD stops working, the context is checked, and if data carrying of data in the context is completed, the context is released after the data is brushed into a flash memory; if carrying is not completed, whether all the PMR areas are stored or not is checked, and if storing is completed, the context is directly released; and if the PMR region is not completely stored, modifying the information of the context, starting the MOVE DMA to carry the data of the PMR region into the DRAM, and after the data is brushed into the flash memory, releasing the context. According to the method, the context abandoned in the case of different disconnection is fully utilized, a dynamic priority scheduling algorithm is added, and data is brushed as much as possible in the different disconnection protection time, so that the nonvolatile characteristic of a PMR region is ensured, and the overall performance and safety of the SSD are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of storage, in particular to a method for PMR persistent dynamic storage in SSD during abnormal power failure. BACKGROUND

[0002] NVM Express provides a new capability for enterprise NVMe SSD in the new NVM e protocol, that is, PMR (Persistent Memory Region) persistent memory region. At present, SSD uses DRAM as internal memory, and this function creates and controls a PMR storage area on the DRAM storage area, which can be directly accessed by the host or the device. The main feature of PMR is that after power failure, the data written in PMR will also be retained. That is, in addition to the memory area accessed by the logical address LBA, there is also a non-volatile memory area. The memory area accessed by the logical address LBA needs to be accessed by the NVMe transmission IO command, and there is a command queue overhead, which needs to occupy a lot of DRAM memory resources. In the event of abnormal power failure, the data in the memory will be emptied, which belongs to the volatile memory area. For the PMR area, the host system can directly access it without the overhead of the command queue. The read and write of PMR only occur in the fixed PMR area, and no memory other than the PMR capacity is consumed. In addition, enterprise SSD has a special power failure protection capacitor, which can safely flush the data in PMR to the flash memory in the event of accidental power failure. When the SSD is powered off, the content of the PMR will be automatically written to the flash memory. When the host system is powered on again, the host can require the SSD to reload the content of the PMR, which belongs to the non-volatile memory area.

[0003] Enterprise SSD has a power failure protection capacitor, which provides 30ms of time in the event of abnormal power failure. The SSD will quickly flush the user data accumulated in the DRAM to the NAND flash memory within the time range. The existing technology uses other hardware modules to move between the PMR area and the flash memory. In the event of abnormal power failure, the hardware module will stop working, and the data in the PMR may not be saved to the flash memory in time. When powered on again, the data cannot be recovered, and the PMR function loses its meaning. The existing technology uses other hardware modules to move between the PMR area and the flash memory during power on and off. This method is mainly for normal power on and off procedures, and the processing capacity may not be sufficient in the event of abnormal power failure. The content saving algorithm is relatively static, and only the offset address with the top specified bits of the access frequency in a unit of time is identified as active data. This part of data is saved, and there is a possibility of data loss. SUMMARY

[0004] In view of the defects of the prior art, the application provides a method for dynamically storing PMR in an SSD during abnormal power failure, which utilizes the process of the solid state disk itself for processing an io command, saves data completely during abnormal power failure, saves the capacitor overhead, does not need an additional hardware module to consume the capacitor, prolongs the capacitor duration, and improves the system robustness. A dynamic priority scheduling method is adopted, a time factor is introduced, and the PMR area is ensured to be saved to the NAND within a limited time, thereby increasing the reliability.

[0005] To solve the technical problem, the application adopts the technical scheme of a method for dynamically storing PMR in an SSD during abnormal power failure, comprising the following steps: S01, during abnormal power failure, starting an energy detection module, reading the voltage of a power failure protection capacitor, and obtaining the working time T of the power failure protection capacitor; S02, after the UNEX DMA in the SSD stops carrying data, each context for carrying data is checked in sequence, if the context has completed DMA carrying, no processing is performed, and the data is waited to be brushed into the flash memory; if the carrying is not completed, the priority of each context is calculated based on the data throughput efficiency and the time urgency; S03, setting a priority threshold, selecting the context whose priority is greater than or equal to the priority threshold to execute step S04, and discarding other contexts; S04, changing the starting LBA of the write context to the starting LBA of the current PMR area, and keeping the LBA quantity cnt unchanged; S05, triggering the MOVE DMA hardware for carrying data between memories, carrying the data of the PMR area corresponding to the LBA quantity to the DRAM memory pre-allocated by the write context, brushing the data in the DRAM memory into the flash memory after the carrying is completed, and accumulating and increasing PMR_cnt, wherein PMR_cnt represents the quantity of the PMR that has been completed and saved; S06, repeatedly executing steps S04 and S05 until the context whose priority is greater than the priority threshold has been reused and completed; if PMR_cnt is smaller than the size of the PMR area at this time, it is indicated that there is PMR area data that has not been completed and saved, and the step S01 is returned; S07, changing the L2P table corresponding to the PMR to the corresponding PBA.

[0006] Further, the method further comprises a power-on data recovery process, and specifically comprises: S08. Upon power-up, the read context is obtained. The read context is pre-associated with a fixed-size DRAM memory. The starting LBA in the read context is set to LBAmax, and the number of LBAs to be read is set to PMR_total. Data is read according to the L2P table of PMR. LBAmax represents the disk capacity and is also the starting address of the L2P table of PMR. PMR_total represents the total amount of data stored in the PMR area. S09. After the data is read into the DRAM memory under read context management, start the MOVE DMA hardware to move the data to the PMR area.

[0007] Furthermore, the priority of each context is calculated as follows: Pi = a (Si / Smax)+b (T / Tmax); Pi represents the priority of the i-th context, Si represents the data volume of the i-th context, Smax represents the maximum data volume processed in a single DMA operation, T represents the remaining working time of the power-off protection capacitor, Tmax represents the total protection time of the power-off protection capacitor, and a and b are weighting coefficients.

[0008] Furthermore, a and b are set to fixed values ​​or calculated by a CNN model, and the remaining working time correction value of the power failure protection capacitor is calculated by the CNN model; the CNN model is trained based on historical SSD operating data, predicts the decay trend of the remaining protection time T in real time, and outputs the optimized weight coefficients a and b; historical SSD operating data includes voltage, temperature, and load.

[0009] Furthermore, the priority threshold is set to a fixed value or a dynamic threshold θ' = 0.7 + 0.1. (1 - f(T) / Tmax), where f(T) is the correction value of the remaining working time T of the power failure protection capacitor predicted by the CNN model.

[0010] Furthermore, Tmax = 30ms, Smax = 256KB.

[0011] Furthermore, before executing step S04, it is checked whether the PMR region has been completely saved. If it has been completely saved, the context is released directly; if the PMR region has not been completely saved, step S04 is executed again.

[0012] Furthermore, step S10 is included to determine whether all PMR data has been read. If not, step S09 is repeated until all PMR data has been read and the read context is released.

[0013] The beneficial effects of this invention are as follows: In the event of an abnormal power outage, this invention utilizes the SSD's own I / O command processing mechanism to reduce additional capacitor overhead and increase system robustness. Within the effective timeframe, a dynamic priority scheduling algorithm is used, incorporating a time urgency factor to improve storage efficiency, enabling the preservation of the PMR region during an abnormal power outage and its recovery after power-on, ensuring the non-volatile nature of the PMR region, and improving the overall performance and security of the SSD. Attached Figure Description

[0014] Figure 1 This is a flowchart of the PMR power-down data saving process during an abnormal power outage in Example 1; Figure 2 This is a flowchart of the power-on PMR data recovery process in Example 1; Figure 3 This is a flowchart of the method for saving PMR during abnormal power failure in Example 2; Figure 4 This is a diagram of the CNN model training and deployment architecture in Example 2. Detailed Implementation

[0015] The present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0016] Example 1 Normal user data requires NVMe I / O commands. After receiving the I / O command, the SSD first allocates DRAM memory corresponding to the data size, and then uses the UNEX DMA module to move the user data from the host system to the corresponding DRAM. Upon power loss, the SSD will flush all pre-allocated DRAM data to flash memory. If the I / O command queue depth is 32, and each command is associated with a write context, the write context records the starting LBA and the number of LBAs to be written by the write command. The maximum supported write data size (Wmax) is 256KB. After receiving the I / O command, the SSD pre-allocates 256KB of DRAM memory for each command. All commands will occupy the required depth. The memory size of Wmax, in this example it will occupy 32. 256K = 8M of memory. In the event of an abnormal power outage, for contexts that have allocated DRAM memory but have not yet completed data transfer, the SSD will directly abandon the transfer, and these contexts will become discarded. When flushing user data to flash memory, invalid data will be written to DRAM, resulting in additional invalid writes.

[0017] Assuming the PMR region size is 2MB, this method fully utilizes the context discarded during anomalies and incorporates a dynamic priority scheduling algorithm to flush as much data as possible within the anomaly protection time. When the SSD detects an abnormal power outage, after the UNEX DMA data transfer between the host and SSD stops working, the SSD checks the context. If the data transfer in the context is complete, the context is released after the data is flushed to flash memory; if the transfer is not complete, it checks whether the PMR region has been completely saved. If it has been saved, the context is released directly; if the PMR region has not been saved, the context information is modified, and MOVE DMA is started to transfer the PMR region data to DRAM memory. After the data is flushed to flash memory, the context is released. Figure 1 As shown, the specific steps are as follows: 1. When accessing data via Logical Address (LBA), the SSD maintains a table mapping LBAs to Physical Addresses (PBAs), referred to as the L2P table. The normal number of LBAs is equal to the disk capacity, with a maximum record size of LBAmax. When PMR functionality is supported, an additional PMR L2P table is added. Here, the LBAs start from the normal disk capacity (LBAmax), and their number is equal to the PMR region size, denoted as PMR - LBAmax. PMR_cnt records the number of records that have been successfully saved in the PMR, and PMR_total represents the total amount of data to be saved in the PMR.

[0018] 2. In the event of an abnormal power outage, the energy detection module is activated to obtain the remaining time T that can be supported by reading the voltage of the power outage protection capacitor in real time.

[0019] 3. In the event of an abnormal power outage, after UNEX DMA in the SSD has stopped transferring data, each context is checked in sequence. If the context has completed DMA transfer, no processing is required, and the data is waited for to be flushed to the flash memory. If the transfer has not been completed, the contexts are sorted according to priority.

[0020] 4. According to the priority calculation formula: Pi=a (Si / Smax)+b (T / Tmax), Where Pi represents the priority of the i-th context, Si represents the data size of the i-th context (unit: KB), Smax represents the maximum data size that can be processed in a single DMA operation (fixed at 256KB, limited by hardware), T represents the remaining working time of the power-off protection capacitor, Tmax represents the total protection time of the power-off protection capacitor (30ms), and a and b are weighting coefficients.

[0021] In this formula, Si / Smax is the data volume factor, used to measure the "processing efficiency" of the current data block. A larger value indicates that the data volume is close to the hardware processing limit, and the efficiency of a single DMA transfer is higher. T / Tmax represents the time urgency factor, reflecting the urgency of the system's remaining time. This factor decreases non-linearly over time (because the denominator is fixed). When allocating weights, a biases towards data throughput efficiency, while b emphasizes time urgency; both are determined through experimental optimization. A priority threshold θ = 0.8 is set, selecting contexts where Pi ≥ θ, and discarding other contexts.

[0022] 5. Change the starting LBA of the write context to the starting LBA of the current PMR region, i.e., LBAmax + PMR_cnt, while keeping the number of LBAs cnt unchanged.

[0023] 6. Trigger the MOVE DMA hardware to move data between memory regions, transferring the corresponding number of LBAs of data from the PMR region to the pre-allocated DRAM memory in the write context. After the transfer is complete, continue with the subsequent operations of the normal write process, flushing the memory data to flash memory. PMR_cnt is updated by an accumulated increment of cnt.

[0024] 7. Repeat steps 5-6 until all discarded contexts have been reused. If PMR_cnt is less than the size of the PMR region at this point, it means there is still unsaved PMR region data. Reread the voltage of the power-off protection capacitor, calculate the priority, and repeat the subsequent steps. The L2P table of the corresponding PMR is then updated to the corresponding PBA.

[0025] Using the above steps, the PMR region can be saved to flash memory during an abnormal power outage. Upon power-up, the data needs to be read from flash memory and placed into the PMR region. After the SSD receives the power-up notification, it acquires the read context, configures the read context information, reads the data from flash memory to DRAM, initiates MOVE DMA to move the data from DRAM to the PMR region, and releases the context once the data transfer is complete. Figure 2 As shown, the specific steps are as follows: 1. Upon power-up, the read context is acquired. The read context is pre-associated with a fixed-size DRAM memory, the starting LBA in the read context is set to LBAmax, the number of LBAs to be read is set to PMR_total, and data is read according to the L2P table of PMR.

[0026] 2. After the data is read into the DRAM memory managed by the read context, the MOVE DMA hardware is started to move the data to the PMR area.

[0027] This invention enables the preservation of the PMR region during abnormal power outages and its recovery after power-on within the effective timeframe of an abnormal power outage, ensuring the non-volatile nature of the PMR region and improving the overall performance and security of the SSD.

[0028] Example 2 In this embodiment, a lightweight convolutional neural network (CNN) model is embedded during abnormal power outages. This model is trained on historical SSD operating data (such as voltage curves, temperature, and IO command depth) to predict the decay trend of the remaining protection time T in real time and output optimized weight coefficients a' and b'. Through the weight coefficients, the importance of the data and the urgency of the time are calculated respectively, and the data is quickly judged, with the data of higher importance being processed first.

[0029] In this scheme, the CNN model is first deployed on the SSD firmware layer. Inputs include real-time sampled capacitor voltage values, ambient temperature sensor data, and command queue depth. Outputs are dynamic weights a' and b'. Priority is calculated based on these dynamic weights: Pi' = a'(Si / Smax) + b'(f(T) / Tmax), where f(T) is the remaining time correction value for the CNN prediction (a non-linear function). For example, f(T) = T exp(-k Δt), where k is the attenuation coefficient.

[0030] In this embodiment, the dynamic threshold θ' is set to 0.7 + 0.1. (1 - f(T) / Tmax), when Pi' ≥ θ', the higher priority context is selected.

[0031] Figure 3 This is a flowchart illustrating the method for saving PMR (Power-Down Context) during abnormal power outages in this patent. When the SSD detects an abnormal power outage, the DMA (Data Transfer Machine) that transfers data between the host and the SSD stops working. The energy detection module is then activated, and capacitor voltage, temperature, and queue depth data are input into the CNN model. The model dynamically calculates weights a' and b', uses the formula Pi to calculate the context priority, identifies the high-priority context, saves the PMR information into the context, and then releases the context after writing it to the flash memory via a write command.

[0032] Figure 4 A diagram of the CNN model training and deployment architecture, including: a) Training phase: Collect historical SSD data (voltage, temperature, load), input it into the CNN trainer, and output the weights to optimize the model; b) Deployment phase: The model is embedded in SSD firmware, and real-time sampled data is inferred through hardware accelerators; c) Applications experiencing abnormal power outages: Model output is used for priority scheduling. The architecture ensures low latency (<1ms), suitable for enterprise-grade SSD resource constraints.

[0033] a) The workflow of the CNN model prediction stage is as follows: Input: capacitor voltage sampling sequence, temperature sensor data, and current IO command queue depth.

[0034] b) Model: Lightweight CNN (3 convolutional layers, 1 fully connected layer), training data from SSD historical logs, loss function is mean squared error (MSE).

[0035] c) Output: Dynamic weighting coefficients a' and b', and time correction factor f(T) (e.g., f(T) = T) exp(-k Δt), where k is the attenuation coefficient.

[0036] d) Execution: Inference via the SSD's built-in FPGA accelerator takes <1ms.

[0037] The above description is merely the basic principle and preferred embodiment of the present invention. Improvements and substitutions made by those skilled in the art based on the present invention are within the scope of protection of the present invention.

Claims

1. A method for persistent dynamic storage of PMR in an SSD during abnormal power failure, characterized in that: Includes the following steps: S01. In the event of an abnormal power outage, the energy detection module is activated to read the voltage of the power outage protection capacitor and obtain the remaining working time T of the power outage protection capacitor. S02. After UNEX DMA in the SSD stops transferring data, check each context that has been transferring data in turn. If the context has completed DMA transfer, do not process it and wait for the data to be flushed to the flash memory. If the data transfer is not completed, the priority of each context is calculated based on data throughput efficiency and time urgency. S03. Set a priority threshold, select contexts with a priority greater than or equal to the priority threshold to execute step S04, and discard other contexts; S04. Change the starting LBA of the write context to the starting LBA of the current PMR region, and keep the number of LBAs cnt unchanged. S05. Trigger the MOVE DMA hardware to transfer data between memory regions, move the data of the corresponding LBA quantity in the PMR region to the DRAM memory pre-allocated in the write context, and after the transfer is completed, flush the DRAM memory data to the flash memory; PMR_cnt is incremented by cnt, where PMR_cnt represents the number of PMR regions that have been saved. S06. Repeat steps S04 and S05 until all contexts with a priority threshold have been reused. If PMR_cnt is less than the size of the PMR region at this time, it means that there is still PMR region data that has not been completely saved, and return to step S01; S07. Change the L2P table corresponding to PMR to the corresponding PBA.

2. The method for persistent dynamic storage of PMR in SSD during abnormal power failure according to claim 1, characterized in that: It also includes the power-on data recovery process, specifically: S08. Upon power-up, the read context is obtained. The read context is pre-associated with a fixed-size DRAM memory. The starting LBA in the read context is set to LBAmax, and the number of LBAs to be read is set to PMR_total. Data is read according to the L2P table of PMR. LBAmax represents the disk capacity and is also the starting address of the L2P table of PMR. PMR_total represents the total amount of data stored in the PMR area. S09. After the data is read into the DRAM memory under read context management, start the MOVE DMA hardware to move the data to the PMR area.

3. The method for persistent dynamic storage of PMR in SSD during abnormal power failure according to claim 1, characterized in that: The priority of each context is calculated as follows: Pi = a (Si / Smax)+b (T / Tmax); Pi represents the priority of the i-th context, Si represents the data volume of the i-th context, Smax represents the maximum data volume processed in a single DMA operation, T represents the remaining working time of the power-off protection capacitor, Tmax represents the total protection time of the power-off protection capacitor, and a and b are weighting coefficients.

4. The method for persistent dynamic storage of PMR in SSD during abnormal power failure according to claim 3, characterized in that: a and b are set to fixed values ​​or calculated by a CNN model, and the remaining working time correction value of the power failure protection capacitor is calculated by the CNN model. The CNN model is trained based on historical SSD operating data, predicts the decay trend of the remaining protection time T in real time, and outputs the optimized weight coefficients a and b. Historical SSD operating data includes voltage, temperature, and load.

5. The method for persistent dynamic storage of PMR in SSD during abnormal power failure according to claim 4, characterized in that: The priority threshold is set to a fixed value or a dynamic threshold θ' = 0.7 + 0.

1. (1 - f(T) / Tmax), where f(T) is the correction value of the remaining working time T of the power failure protection capacitor predicted by the CNN model.

6. The method for persistent dynamic storage of PMR in SSD during abnormal power failure according to claim 3, characterized in that: Tmax=30ms, Smax=256KB.

7. The method for persistent dynamic storage of PMR in SSD during abnormal power failure according to claim 1, characterized in that: Before executing step S04, check whether the PMR region has been completely saved. If it has been completely saved, the context is released directly. If the PMR region has not been completely saved, then execute step S04.

8. The method for persistent dynamic storage of PMR in SSD during abnormal power failure according to claim 2, characterized in that: It also includes step S10, which determines whether all PMR data has been read. If not, step S09 is repeated until all PMR data has been read and the read context is released.