MPU-based SSD firmware error detection method, device, computer equipment and storage medium
By configuring the memory domain and stack top sub-domain of the SSD firmware, saving exception information and transmitting it to the host side, the problem of low error detection efficiency of SSD firmware is solved, and effective handling and positioning of address access exceptions and stack overflow is achieved.
Patent Information
- Application Number
- CN202110475447.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-29
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-04-29
AI Technical Summary
When configuring the MPU, the existing SSD firmware cannot effectively detect error detection processors access non-configured memory domains and stack overflow errors, resulting in low error detection efficiency and inaccurately identifying the cause of errors.
By configuring TCM, ISRAM and Device memory as related attribute domains, setting the background domain and stack top sub-domain, and saving time, address and stack information to AON SRAM under abnormal conditions, obtaining the host-side Nvme command, and transmitting data to the host-side end And save, output exception data as log file.
It effectively covers the error scenarios of address access exceptions and stack overflow, improves the efficiency of SSD firmware error detection, and provides developers with analysis information.
Smart Images

Figure CN113176964B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of SSD firmware error detection, and in particular to an SSD firmware error detection method, device, computer equipment and storage medium based on an MPU. Background Art
[0002] At present, the main control chip of mainstream SSD generally uses ARM as the core, and MPU (Memory Protection Unit) is a memory protection unit integrated in the ARM core, which can customize the properties and access rights of memory. Generally, when configuring MPU, the firmware only configures the domains of commonly used memory such as TCM, ISRAM, and Device; when MPU is enabled, if the processor accesses the domain outside the configuration, it will trigger a background error; in addition, when the firmware is running, if there are too many function calls, it will cause a stack overflow error; for the above two errors, the host side will think that the issued command execution is abnormal, and it is impossible to accurately detect the error; as a result, for SSD developers, it is necessary to reproduce and locate the cause, and the error detection efficiency is low. Summary of the invention
[0003] The purpose of the present invention is to overcome the deficiencies of the prior art and provide an SSD firmware error detection method, device, computer equipment and storage medium based on MPU.
[0004] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0005] The SSD firmware error detection method based on MPU includes the following steps:
[0006] Configure TCM, ISRAM, and Device memory as domains with related attributes;
[0007] The background domain is configured according to the domain of the relevant attribute, the stack is configured as the domain of the relevant attribute, that is, the stack domain, and the top of the stack is configured as the subdomain of the stack domain, that is, the stack top subdomain;
[0008] When the firmware is running, if it is detected that the processor has accessed the background domain or the top subdomain of the stack, it will enter the exception processing and save the relevant time, address and stack information to the agreed space of the AON SRAM;
[0009] Reset and obtain the Nvme command sent by the host;
[0010] According to the Nvme command, the data in the agreed space is transferred to the host and saved.
[0011] A further technical solution is as follows: the range of the background domain is 4KB.
[0012] A further technical solution is: configuring the background domain according to the domain of relevant attributes, configuring the stack as the domain of relevant attributes, i.e. the stack domain, and configuring the top of the stack as the subdomain of the stack domain, i.e. the stack top subdomain step, also includes: configuring the attribute to enable.
[0013] Its further technical solution is: according to the Nvme command, the data in the agreed space is transmitted to the host side, and after the saving step, it also includes: detecting whether there is abnormal data in the data saved by the host side, and if so, outputting the data as a log file.
[0014] An SSD firmware error detection device based on an MPU includes: a first configuration unit, a second configuration unit, a running detection and saving unit, a reset acquisition unit, and a transmission and saving unit;
[0015] The first configuration unit is used to configure TCM, ISRAM, and Device memory as domains of related attributes;
[0016] The second configuration unit is used to configure the background domain according to the domain of the relevant attribute, configure the stack as the domain of the relevant attribute, that is, the stack domain, and configure the top of the stack as a subdomain of the stack domain, that is, the stack top subdomain;
[0017] The operation detection and storage unit is used for firmware operation. If it is detected that the processor has accessed the background domain or the top subdomain of the stack, the exception processing is entered to save the relevant time, address and stack information to the agreed space of the AON SRAM;
[0018] The reset acquisition unit is used to perform a reset and obtain an Nvme command issued by the host end;
[0019] The transmission and storage unit is used to transmit and store the data in the agreed space to the host side according to the Nvme command.
[0020] A further technical solution is as follows: the range of the background domain is 4KB.
[0021] A further technical solution is: the second configuration unit further includes: configuring the attribute to enable.
[0022] Its further technical solution is: it also includes: a detection output unit, which is used to detect whether there is abnormal data in the data saved by the host end. If so, the data is output as a log file.
[0023] A computer device includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the MPU-based SSD firmware error detection method as described above is implemented.
[0024] A storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the MPU-based SSD firmware error detection method as described above can be implemented.
[0025] Compared with the prior art, the beneficial effect of the present invention is that by configuring the domain of the relevant attributes of the memory, the error scenarios of address access exception and stack overflow are covered, and the efficiency of SSD firmware error detection is effectively improved.
[0026] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0028] Figure 1 A flowchart of an MPU-based SSD firmware error detection method provided in an embodiment of the present invention;
[0029] Figure 2 A schematic block diagram of an MPU-based SSD firmware error detection device provided in an embodiment of the present invention;
[0030] Figure 3 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0033] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0034] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0035] See also Figures 1 to 3 In the specific embodiment shown, the existing SSD firmware error detection for access address exception and stack overflow is as follows:
[0036] After the SSD is powered on, the firmware first configures the MPU domain attributes of TCM, ISRAM, Device and other memories to ensure that these memory spaces are correctly accessed. After the firmware is running, if the processor accesses an unconfigured domain, a background error will be triggered and the firmware will enter the exception handling process. Generally, it will directly assert and no other processing will be done. When a stack overflow occurs during the firmware operation, the overflow part will modify the code of the occupied space, resulting in unpredictable errors and causing the firmware to run away. The host sends a command to the SSD and finds that the SSD has no response. It will send a get log command, but there is still no response. The command and time information sent will be recorded and saved as a log. If the SSD has no response, a blue screen will appear. Finally, the SSD developer will combine the host log to troubleshoot and analyze the problem. In most cases, the scenario needs to be reproduced. The above processing cannot accurately locate the location of the firmware error, and the log provided by the host is of little reference significance, which reduces the efficiency of SSD firmware error detection and development.
[0037] Among them, the English explanations that need to be applied in the present invention are as follows:
[0038] SSD: solid state drive; MPU: memory protection unit; TCM: tightly coupled memory; ISRAM: internal static random access memory; Device: device, peripheral; AON SRAM: always-on static random access memory; Nvme: non-volatile memory host controller interface specification; Log: log.
[0039] See also Figure 1 As shown, the present invention discloses an SSD firmware error detection method based on MPU, comprising the following steps:
[0040] S1, configure TCM, ISRAM, and Device memory as domains of related attributes;
[0041] In this embodiment, the firmware configures TCM, ISRAM, and Device memory as domains of related attributes through the MPU.
[0042] S2, configuring the background domain according to the domain of the relevant attribute, configuring the stack as the domain of the relevant attribute, i.e., the stack domain, and configuring the top of the stack as the subdomain of the stack domain, i.e., the stack top subdomain;
[0043] Among them, the MPU configures the background domain according to the domain of the relevant attribute, and the range of the background domain is 4KB to ensure that all address spaces are covered. In addition, according to the size of the stack space, the stack is separately configured as a domain of the relevant attribute, and the top of the stack is configured as a subdomain of the stack domain, and the attribute is configured to be enabled.
[0044] S3, firmware runs. If it is detected that the processor accesses the background domain or the top subdomain of the stack, it enters the exception processing and saves the relevant time, address and stack information to the agreed space of AON SRAM;
[0045] The agreed space is an agreed storage address, and the saved data will not be reset.
[0046] S4, reset and obtain the Nvme command sent by the host;
[0047] In order to ensure normal communication with the host, software reset will be started to exit the exception handling. Software reset refers to using a series of instructions to imitate the hardware reset function.
[0048] S5, according to the Nvme command, transmits the data in the agreed space to the host and saves it.
[0049] After step S5, the process also includes: detecting whether the data saved on the host side contains abnormal data. If so, the data is output as a log file for reference by the developer. The developer locates the cause of the problem based on the log file. The cause may include multiple recursive function calls, wild pointers, memory trampling, etc. The developer takes specific measures based on the specific cause.
[0050] The present invention configures the background domain and the stack top subdomain through the MPU to ensure that the firmware can be abnormally handled when abnormal access and stack overflow occur, and can record the abnormal address, time and data information in the stack, and save them in the AON SRAM. The data will not be reset. After saving the data, the software is reset to ensure that the host side communicates normally with the SSD, and then obtains the Nvme command issued by the host side, transmits the data in the agreed space to the host side, and saves it. If abnormal data is found, it is output as a log file to provide a reference for developers. It covers the error scenarios of address access exceptions and stack overflows, effectively improves the efficiency of SSD firmware error detection, and provides analysis information for SSD firmware developers.
[0051] See also Figure 2 As shown, the present invention also discloses an SSD firmware error detection device based on MPU, comprising: a first configuration unit 10, a second configuration unit 20, a running detection and saving unit 30, a reset acquisition unit 40, and a transmission and saving unit 50;
[0052] The first configuration unit 10 is used to configure TCM, ISRAM, and Device memory as domains of related attributes;
[0053] The second configuration unit 20 is used to configure the background domain according to the domain of the relevant attribute, configure the stack as the domain of the relevant attribute, that is, the stack domain, and configure the top of the stack as a subdomain of the stack domain, that is, the stack top subdomain;
[0054] The operation detection and saving unit 30 is used for firmware operation. If it is detected that the processor has accessed the background domain or the top subdomain of the stack, the exception processing is entered to save the relevant time, address and stack information to the agreed space of the AON SRAM;
[0055] The reset acquisition unit 40 is used to perform a reset and obtain an Nvme command issued by the host end;
[0056] The transmission and storage unit 50 is used to transmit and store the data in the agreed space to the host side according to the Nvme command.
[0057] The range of the background domain is 4KB, ensuring that all address spaces are covered.
[0058] The second configuration unit 20 further includes: configuring the attribute to be enabled.
[0059] The device further includes: a detection output unit 60, which is used to detect whether abnormal data appears in the data stored in the host end, and if so, output the data as a log file.
[0060] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned MPU-based SSD firmware error detection device and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and conciseness of the description, it will not be repeated here.
[0061] The above-mentioned SSD firmware error detection device based on MPU can be implemented in the form of a computer program. The computer program can be used in Figure 3 Runs on the computer device shown.
[0062] See also Figure 3 , Figure 3is a schematic block diagram of a computer device provided in an embodiment of the present application; the computer device 500 may be a terminal or a server, wherein the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device. The server may be an independent server or a server cluster composed of multiple servers.
[0063] See also Figure 3 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0064] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, and when the program instructions are executed, the processor 502 can execute an MPU-based SSD firmware error detection method.
[0065] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0066] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute an MPU-based SSD firmware error detection method.
[0067] The network interface 505 is used to communicate with other devices over the network. Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0068] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0069] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0070] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the above-mentioned MPU-based SSD firmware error detection method can be implemented.
[0071] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0072] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0073] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0074] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0075] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0076] The above embodiments are preferred implementation schemes of the present invention. In addition, the present invention may also be implemented in other ways. Any obvious replacement without departing from the concept of the present technical solution is within the protection scope of the present invention.
Claims
1. The SSD firmware error detection method based on MPU is characterized in that: The following steps are involved: Configure TCM, ISRAM, and Device memory as domains with related attributes; The background domain is configured according to the domain of the relevant attribute, the stack is configured as the domain of the relevant attribute, that is, the stack domain, and the top of the stack is configured as the subdomain of the stack domain, that is, the stack top subdomain; When the firmware is running, if it is detected that the processor has accessed the background domain or the top subdomain of the stack, it will enter the exception processing and save the relevant time, address and stack information to the agreed space of the AON SRAM; Reset and obtain the Nvme command sent by the host; According to the Nvme command, the data in the agreed space is transferred to the host and saved; Among them, the range of the background domain is 4KB; after the data in the agreed space is transmitted to the host side and saved, it also includes: detecting whether there is abnormal data in the data saved by the host side; if so, the data is output as a log file to provide reference for developers.
2. The SSD firmware error detection method based on MPU according to claim 1, characterized in that: The step of configuring the background domain according to the domain of the relevant attribute, configuring the stack as the domain of the relevant attribute, namely the stack domain, and configuring the stack top as the subdomain of the stack domain, namely the stack top subdomain, also includes: configuring the attribute to enable.
3. An SSD firmware error detection device based on MPU, characterized in that: include: a first configuration unit, a second configuration unit, an operation detection and storage unit, a reset acquisition unit, and a transmission and storage unit; The first configuration unit is used to configure TCM, ISRAM, and Device memory as domains of related attributes; The second configuration unit is used to configure the background domain according to the domain of the relevant attribute, configure the stack as the domain of the relevant attribute, that is, the stack domain, and configure the top of the stack as a subdomain of the stack domain, that is, the stack top subdomain; The operation detection and storage unit is used for firmware operation. If it is detected that the processor has accessed the background domain or the top subdomain of the stack, the exception processing is entered to save the relevant time, address and stack information to the agreed space of the AON SRAM; The reset acquisition unit is used to perform a reset and obtain an Nvme command issued by the host end; The transmission and storage unit is used to transmit and store the data in the agreed space to the host side according to the Nvme command; Among them, the range of the background domain is 4KB; the device also includes: a detection output unit, which is used to detect whether there is abnormal data in the data saved by the host side; if so, the data is output as a log file to provide reference for developers.
4. The MPU-based SSD firmware error detection device according to claim 3, characterized in that: The second configuration unit further includes: configuring the attribute to be enabled.
5. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the MPU-based SSD firmware error detection method as described in any one of claims 1-2 when executing the computer program.
6. A storage medium, characterized in that: The storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the MPU-based SSD firmware error detection method according to any one of claims 1 to 2 can be implemented.
