A read-write command processing method and device, electronic equipment and readable medium

By configuring high and low priority context objects in the solid-state drive firmware, determining the priority based on the type of read and write commands, and directly using the target context object to process requests, the problem of low efficiency in read and write command processing is solved, achieving more efficient command processing.

CN116225325BActive Publication Date: 2025-11-28INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310136658.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-20
Publication Date
2025-11-28
Estimated Expiration
2043-02-20

AI Technical Summary

Technical Problem

In existing technologies, solid-state drives (SSDs) have low read and write command processing efficiency, mainly because each context object applies to all read and write commands, resulting in a long acquisition and release process.

Method used

In the firmware of solid-state drives, the priority level of read and write commands is determined according to the type of read and write commands and the preset correspondence, and high and low priority context objects are configured. The target context object is directly obtained and used to generate message processing requests, reducing the number of acquisition and release steps.

Benefits of technology

It improves the processing efficiency of read and write commands, reduces the time-consuming steps of allocating and releasing context objects in existing technologies, and optimizes the processing flow in multi-core mode.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116225325B_ABST
    Figure CN116225325B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a read-write command processing method and device, electronic equipment and readable medium. The firmware of a solid state disk receives a read-write command sent by a CPU, determines a priority level of the read-write command according to a command type and a preset correspondence relationship, determines a target context object as a context object having the same priority level as the read-write command according to the priority level of the read-write command, acquires the target context object, generates a message processing request using the read-write command and the target context object, and sends the message processing request to a functional unit of a NAND to enable the functional unit to process the read-write command in the message processing request. Through the method, a new context object does not need to be applied after the read-write command is acquired, and the context object does not need to be released after the read-write command processing is completed, thereby reducing two key steps of processing the read-write command, enabling other commands to be processed faster, and improving the processing efficiency of the read-write command.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a read-write command processing method, a read-write command processing device, an electronic device and a computer readable medium. BACKGROUND

[0002] The current solid state disk (SSD) product generally adopts NAND (computer flash device) particles as storage medium, and the NAND flash is a non-volatile storage technology that can save data after power off. With the continuous development of NAND technology, in order to reduce the cost of each bit of storage and improve the storage capacity, 96, 112, 128 layers and the next generation of 192 layers all put forward higher requirements for CPU (central processing unit) processing capacity. After the increase of unit storage capacity, the speed of software processing is also faster and faster. For the back-end module that directly interacts with NAND, the current mainstream processing method adopts power-on initialization stage to apply enough context objects, such as 512. When the back-end receives a read-write command, it applies a free context object, and then fills the context object record with the parameters obtained from the read-write command and sends it to NAND. After the NAND is executed and returned, the context object is found again, the completion message is constructed, and then returned to the CPU. After sending the completion message, the context object is released. This traditional context object management method is relatively simple, each context object is suitable for all read-write commands, but the application and release process is required when processing each read-write command, which takes a long time to apply and release the context object, and makes the processing efficiency of read-write command low. SUMMARY

[0003] In view of the above problems, the present application is proposed to provide a read-write command processing method, a read-write command processing device, an electronic device and a computer readable medium which can overcome the above problems or at least partially solve the above problems.

[0004] The present application discloses a read-write command processing method applied to a firmware of a solid state disk, wherein the solid state disk further comprises a NAND, the NAND comprises at least one functional unit, the firmware communicates with a CPU and the functional unit respectively, the functional unit is configured with at least one context object of a priority level, and the method comprises the following steps:

[0005] receiving a read-write command sent by the CPU; the read-write command records a command type;

[0006] determine the priority level of the read-write command according to the command type and a preset correspondence relationship; the preset correspondence relationship is a correspondence relationship between the command type of the read-write command and the priority level of the read-write command;

[0007] determine the context object with the same priority level as the read-write command as a target context object according to the priority level of the read-write command;

[0008] obtain the target context object from the functional unit;

[0009] generate a message processing request by using the read-write command and the target context object, and send the message processing request to the functional unit; the functional unit is used for processing the read-write command in the message processing request.

[0010] Optionally, the context object includes a high-priority context object and a low-priority context object; the priority level of the read-write command includes a high priority and a low priority; the step of determining the context object with the same priority level as the read-write command as a target context object according to the priority level of the read-write command includes:

[0011] if the priority level of the read-write command is the high priority, the target context object is determined as the high-priority context object;

[0012] if the priority level of the read-write command is the low priority, the target context object is determined as the low-priority context object.

[0013] Optionally, the step of generating a message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit includes:

[0014] parsing the read-write command, and converting the read-write command into a target instruction recognizable by the functional unit;

[0015] generating the message processing request by using the target instruction and the target context object.

[0016] Optionally, the command type includes a read command and a write command,

[0017] the step of determining the priority level of the read-write command according to the command type and a preset correspondence relationship includes:

[0018] if the command type is the read command, the priority level of the read-write command is determined as the high priority;

[0019] If the command type is the write command, the priority level of the read-write command is determined as the low priority.

[0020] Optionally, the method further comprises:

[0021] Two context objects are configured for each of the functional units.

[0022] A request for setting a priority level for the functional units is received, and the two context objects of each of the functional units are set as the high-priority context object and the low-priority context object.

[0023] Optionally, before the step of configuring two context objects for each of the functional units, the method further comprises:

[0024] In an initial stage of power-on of the solid state disk, a functional unit setting request is received; the functional unit setting request records the number of the functional units;

[0025] According to the number of the functional units, the number of the functional units are set.

[0026] Optionally, after the step of generating a message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit, the method further comprises:

[0027] A processing result returned by the functional unit is received;

[0028] A completion message is generated by using the processing result and is sent to the CPU.

[0029] Embodiments of the application disclose a read-write command processing device, which is characterized in that the device is applied to firmware of a solid state disk, the solid state disk further comprises a NAND, the NAND comprises at least one functional unit, the firmware respectively communicates with a CPU and the functional unit, the functional unit is configured with at least one context object of a priority level, and the device comprises:

[0030] A first receiving module is configured to receive a read-write command sent by the CPU; the read-write command records a command type;

[0031] A priority level determining module is configured to determine a priority level of the read-write command according to the command type and a preset corresponding relationship; the preset corresponding relationship is a corresponding relationship between the command type of the read-write command and the priority level of the read-write command;

[0032] A target context object determining module is configured to determine, according to the priority level of the read-write command, the context object with the same priority level as the read-write command as a target context object;

[0033] an obtaining module, configured to obtain the target context object from the function unit;

[0034] a generating module, configured to generate a message processing request by using the read-write command and the target context object, and send the message processing request to the function unit; the function unit is configured to process the read-write command in the message processing request.

[0035] Optionally, the context objects include a high-priority context object and a low-priority context object; the priority level of the read-write command includes a high priority and a low priority, and the target context object determining module includes:

[0036] a first target context object determining submodule, configured to determine the target context object as the high-priority context object if the priority level of the read-write command is the high priority;

[0037] a second target context object determining submodule, configured to determine the target context object as the low-priority context object if the priority level of the read-write command is the low priority.

[0038] Optionally, the generating module includes:

[0039] a converting submodule, configured to parse the read-write command and convert the read-write command into a target instruction recognizable by the function unit;

[0040] a generating submodule, configured to generate the message processing request by using the target instruction and the target context object.

[0041] Optionally, the command type includes a read command and a write command, and the priority level determining module includes:

[0042] a first priority level determining submodule, configured to determine the priority level of the read-write command as the high priority if the command type is the read command;

[0043] a second priority level determining submodule, configured to determine the priority level of the read-write command as the low priority if the command type is the write command.

[0044] Optionally, the apparatus further includes:

[0045] a configuring module, configured to configure two context objects for each function unit;

[0046] a priority level setting module, configured to receive a request of setting a priority level for the function unit, and set the two context objects of each function unit as the high-priority context object and the low-priority context object.

[0047] Optionally, the apparatus further comprises:

[0048] a second receiving module, configured to receive a function unit setting request in a solid state disk power-on initial stage; the function unit setting request records the number of the function units;

[0049] a function unit setting module, configured to set the number of the function units according to the number of the function units.

[0050] Optionally, the apparatus further comprises:

[0051] a returning module, configured to receive a processing result returned by the function unit;

[0052] a sending module, configured to generate a completion message by using the processing result and send the completion message to the CPU.

[0053] The embodiment of the present application further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;

[0054] the memory is used for storing a computer program;

[0055] the processor is used for executing the program stored on the memory, and realizes the read-write command processing method as described in the embodiment of the present application.

[0056] The embodiment of the present application further discloses one or more computer readable media, which store instructions, and when executed by one or more processors, make the processor execute the read-write command method as described in the embodiment of the present application.

[0057] The embodiment of the present application has the following advantages:

[0058] In the embodiment of the present application, the firmware of the solid state disk receives the read-write command sent by the CPU, determines the priority level of the read-write command according to the command type and the preset correspondence relationship, determines the target context object with the same priority level as the read-write command according to the priority level of the read-write command, acquires the target context object, generates a message processing request using the read-write command and the target context object, and sends the message processing request to the functional unit of the NAND, so that the functional unit processes the read-write command in the message processing request. By the method of the present application, the functional unit is configured with context objects with different priority levels, which are respectively used to deliver read-write commands with the same priority level, and the command type of the read-write command has a corresponding relationship with the priority level, so that when the firmware receives the read-write command, it can determine the priority level of the read-write command according to the command type and the preset correspondence relationship, generate a message processing request using the target context object with the same priority level as the read-write command and the read-write command, and send it to the functional unit for processing. Therefore, after the firmware acquires the read-write command, it can deliver the read-write command using the context object configured by it, without the need to apply for a new context object, and after the read-write command processing is completed, it is no longer necessary to release the context object, thereby reducing two time-consuming steps in the read-write command processing flow in the prior art, and improving the processing efficiency of the read-write command. BRIEF DESCRIPTION OF DRAWINGS

[0059] Figure 1 is a step flow chart of a read-write command processing method provided in the embodiment of the present application;

[0060] Figure 2 is a step flow chart of another read-write command processing method provided in the embodiment of the present application;

[0061] Figure 3 is a flow chart of processing a read-write instruction provided in the embodiment of the present application;

[0062] Figure 4 is a structural block diagram of a read-write command processing device provided in the embodiment of the present application;

[0063] Figure 5 is a block diagram of an electronic device provided in the embodiment of the present application;

[0064] Figure 6 is a schematic diagram of a computer readable medium provided in the embodiment of the present application. DETAILED DESCRIPTION

[0065] In order to make the above-mentioned objects, features and advantages of the present application more apparent and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.

[0066] The prior art is that each context object is applicable to all read-write commands, and has a globally unique identifier, i.e., a context object number (context ID), which is used to find the previous parameters after receiving a function unit completion message. In a multi-core scenario, the storage location of the context object must be a place that can be accessed by all memory channels. Processing each read-write command needs to go through several stages, i.e., applying for a context object, filling parameters, waiting for a function unit reply, returning a completion message, and releasing the context object. Among them, the time-consuming of waiting for a function unit reply is a NAND feature, which will be significantly improved with the continuous development of NAND technology. In the remaining part, the time-consuming of applying for a context object and releasing a context object is relatively long, which makes the processing efficiency of read-write commands relatively low.

[0067] To solve the above problems, the application improves the read-write command processing mechanism, establishes a fixed mapping relationship between each function unit and the context object in the solid state disk initialization power-on phase, so that the context object application and release steps are no longer performed when processing messages after power-on is completed. In a multi-core mode, only the context object corresponding to each function unit needs to be accessed normally, and the context object no longer needs to be stored centrally. The flexible storage and acquisition of the context object improves the processing efficiency of read-write commands. Moreover, the context objects of the function units are independent of each other, which reduces the coupling and is beneficial to function debugging and bug positioning.

[0068] Reference Figure 1 Fig. 1 shows a step flowchart of a read-write command processing method provided in an embodiment of the application, which can specifically include the following steps:

[0069] Step 101, receiving a read-write command sent by the CPU; the read-write command records a command type;

[0070] In the embodiment of the application, the solid state disk includes a master control firmware and a storage device NAND flash memory, the NAND includes at least one function unit, each function unit is configured with at least one context object of a priority level, and the function unit can process read-write commands. The firmware can communicate with the upper CPU and the function unit respectively, so that the firmware determines and acquires a target context object according to the read-write command sent by the CPU, generates a message processing request using the read-write command and the target context object, and sends the message processing request to the function unit for processing.

[0071] In the case of power-on of the solid state disk, if the CPU has data reading or writing requirement, the CPU can send a read-write command to the firmware, and the firmware can perform preliminary processing on the received read-write command after receiving the read-write command sent by the CPU, convert the read-write command into a target instruction recognizable by a functional unit, and forward the target instruction to the functional unit for processing. The read-write command sent by the CPU can record a command type, so as to determine whether the read-write command is a read command or a write command.

[0072] In step 102, the priority level of the read-write command is determined according to the command type and a preset correspondence relationship; the preset correspondence relationship is a correspondence relationship between the command type of the read-write command and the priority level of the read-write command.

[0073] In the embodiment of the application, the priority level of the read-write command can be configured, so as to determine which context object with priority level is used based on the priority level of the read-write command. The context object is used as a transmission channel, and the firmware can transmit the read-write command to the functional unit by using the context object. Specifically, the configuration of the priority level of the read-write command can set a correspondence relationship between the command type of the read-write command and the priority level of the read-write command, so as to determine the priority level of the read-write command according to the command type and the correspondence relationship between the command type and the priority level.

[0074] The command type can include a read command and a write command, so the read-write command can be a read command or a write command. The priority level can be the order of processing of the read-write command, and the priority level includes a high priority level and a low priority level.

[0075] After obtaining the read-write command, the firmware can determine the priority level of the read-write command by using the command type of the read-write command and a preset correspondence relationship. The correspondence relationship refers to a one-to-one correspondence relationship between the command type and the priority level. The read command can be configured as a high priority level, and the write command can be configured as a low priority level. Thus, after receiving the read-write command, the firmware can first determine whether the read-write command is a read command or a write command according to the command type recorded in the read-write command. When the read-write command is a read command, the priority level of the read-write command is determined as a high priority level. When the read-write command is a write command, the priority level of the read-write command is determined as a low priority level.

[0076] In step 103, the context object with the same priority level as the read-write command is determined as a target context object according to the priority level of the read-write command.

[0077] Each functional unit is configured with at least one context object, after determining the priority level of the read-write command, the firmware can further determine which context object of the functional unit to deliver the read-write command, specifically, the firmware can deliver the read-write command using the context object having the same priority level as the read-write command, that is, the context object having the same priority level as the read-write command can be determined as the target context object.

[0078] Step 104, obtaining the target context object from the functional unit;

[0079] Each functional unit is configured with two context objects, and the two context objects have different priority levels, which are high-priority objects and low-priority objects respectively. After determining the target context object, if the target context object is a high-priority context object, the firmware obtains the high-priority context object from the functional unit, and if the target context object is a low-priority context object, the firmware obtains the low-priority context object from the functional unit.

[0080] Step 105, generating a message processing request using the read-write command and the target context object, and sending the message processing request to the functional unit; the functional unit is used to process the read-write command in the message processing request.

[0081] After obtaining the target context object, the firmware can generate a message processing request using the read-write command and the target context object, and send the message processing request to the functional unit for processing. After receiving the message processing request, the functional unit can execute the read-write command in the message processing request, if the command type of the read-write command is a read command, the read-write command can further include a logical address, then the functional unit can read data in the storage area of the NAND according to the logical address; if the command type of the read-write command is a write command, the read-write command can further carry data, then the functional unit can write the carried data into the storage area of the NAND, thereby realizing the processing of the read-write command.

[0082] The read-write command processing method provided by the embodiment of the present application is used to receive the read-write command sent by the CPU, determine the priority level of the read-write command according to the command type and the preset correspondence relationship, determine the target context object with the same priority level as the read-write command according to the priority level of the read-write command, obtain the target context object, generate a message processing request by using the read-write command and the target context object, and send the message processing request to the functional unit of the NAND, so that the functional unit processes the read-write command in the message processing request. According to the method, the functional unit is configured with context objects with different priority levels, which are respectively used to deliver read-write commands with the same priority level. The command type of the read-write command has a correspondence relationship with the priority level, so that the firmware can determine the priority level of the read-write command according to the command type and the preset correspondence relationship when receiving the read-write command, generate a message processing request by using the target context object with the same priority level as the read-write command and the read-write command, and send the message processing request to the functional unit for processing. Therefore, the firmware can deliver the read-write command by using the configured context object after obtaining the read-write command, and does not need to apply for a new context object. After the read-write command processing is completed, the context object does not need to be released any more, thereby reducing two time-consuming steps in the read-write command processing flow in the prior art, and improving the processing efficiency of the read-write command.

[0083] Referring to Figure 2 The steps of another read-write command processing method provided by an embodiment of the present application are shown in a step flowchart, and can specifically include the following steps:

[0084] Step 201: receiving the read-write command sent by the CPU; the read-write command records a command type;

[0085] In an embodiment of the present application, the method further includes:

[0086] S11: configuring two context objects for each functional unit;

[0087] In the prior art, if the same functional unit receives command B when executing command A, and command B has a higher priority level, the functional unit will first process command B by using the context object, suspend the processing of command A, and then continue to process command A after the processing of command B is completed. This method makes the processing efficiency of the read-write command relatively low. Therefore, in the embodiment of the present application, the firmware can configure two context objects for each functional unit, so as to ensure that each functional unit has sufficient context objects for processing the read-write command sent by the upper layer, and the two context objects can correspond to different priority levels, thereby processing read-write commands with different priority levels.

[0088] S12, receiving a request of setting priority level for the function unit, setting the two context objects of each function unit as the high priority context object and the low priority context object.

[0089] After configuring two context objects for each function unit, when receiving a request of setting priority level for the function unit, the firmware can set the two context objects of each function unit as the high priority context object and the low priority context object respectively, the high priority context object can be used to process high priority read-write commands, and the low priority context object can be used to process low priority read-write commands.

[0090] In an embodiment of the present application, before the step of configuring two context objects for each function unit, the method further comprises:

[0091] S21, receiving a function unit setting request in the initial stage of power-on of the solid state disk; the function unit setting request records the number of the function units;

[0092] S22, setting the number of function units according to the number of the function units.

[0093] Before configuring context objects for each function unit, i.e. in the initial stage of power-on of the solid state disk, the firmware can receive a function unit setting request, and the function unit setting request can record the number of function units so that the firmware knows how many function units to set.

[0094] After receiving the function unit setting request, the firmware can set the number of function units according to the number of function units, and the set function units are used to process read-write commands subsequently.

[0095] Step 202, determining the priority level of the read-write command according to the command type and a preset corresponding relationship; the preset corresponding relationship is a corresponding relationship between the command type of the read-write command and the priority level of the read-write command;

[0096] In an embodiment of the present application, the step of determining the priority level of the read-write command according to the command type and a preset corresponding relationship comprises:

[0097] S31, if the command type is the read command, determining the priority level of the read-write command as the high priority;

[0098] S32, if the command type is the write command, determining the priority level of the read-write command as the low priority.

[0099] The firmware can determine whether the read-write command is a read command or a write command according to the command type recorded in the read-write command after receiving the read-write command. If the read-write command is a read command, the firmware can determine that the priority level of the read-write command is a high priority level. If the read-write command is a write command, the firmware can determine that the priority level of the read-write command is a low priority level.

[0100] In step 203, if the priority level of the read-write command is the high priority level, the target context object is determined to be the high priority context object.

[0101] After determining the priority level of the read-write command, the firmware can determine the target context object according to the priority level of the read-write command. The context object with the same priority level as the read-write command is determined to be the target context object. Specifically, if the priority level of the read-write command is a high priority level, the target context object is determined to be a high priority context object. If the priority level of the read-write command is a low priority level, the target context object is determined to be a low priority context object.

[0102] In step 204, if the priority level of the read-write command is the low priority level, the target context object is determined to be the low priority context object.

[0103] In step 205, the target context object is obtained from the functional unit.

[0104] In step 206, a message processing request is generated by using the read-write command and the target context object, and the message processing request is sent to the functional unit. The functional unit is used to process the read-write command in the message processing request.

[0105] In an embodiment of the present application, the step of generating the message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit, comprises:

[0106] In step S41, the read-write command is parsed to convert the read-write command into a target instruction recognizable by the functional unit.

[0107] The instruction recognizable by the firmware is different from the instruction recognizable by the functional unit. Therefore, after receiving the read-write command, the firmware can parse the read-write command to convert the read-write command into a target instruction recognizable by the functional unit, so that the functional unit can parse and determine what instruction needs to be processed after receiving the target instruction.

[0108] In step S42, the message processing request is generated by using the target instruction and the target context object.

[0109] After the read-write command is converted into the target instruction, the firmware can generate a message processing request by using the read-write command and the target context object, and send the message processing request to the functional unit for processing. The functional unit, after receiving the message processing request, can execute the read-write command in the message processing request, thereby realizing the processing of the read-write command.

[0110] In an embodiment of the present application, after the step of generating the message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit, the method further comprises:

[0111] S51, receiving the processing result returned by the functional unit;

[0112] After the functional unit processes the target instruction, the functional unit can return the processing result to the firmware, so that the firmware, after generating the message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit for processing, can receive the processing result returned by the functional unit.

[0113] S52, generating a completion message by using the processing result and sending the completion message to the CPU.

[0114] After receiving the processing result returned by the functional unit, the firmware constructs a completion message by using the processing result and sends the completion message to the CPU. If the type of the read-write command is a read command, the processing result returned by the functional unit will include the read data, so the completion message sent to the CPU can include the data to be read by the CPU; if the type of the read-write command is a write command, the completion message can be a feedback of the completion of the command processing.

[0115] Referring to Figure 3 , a flowchart of processing a read-write instruction provided in an embodiment of the present application is shown.

[0116] 1. In the initial stage of power-on of the solid state disk, the master control firmware sets the number and size of the functional units of the NAND;

[0117] 2. The firmware configures two context objects for each functional unit, which are a high-priority context object and a low-priority context object. The high-priority context object is used to process high-priority read-write commands, and the low-priority context object is used to process low-priority read-write commands;

[0118] 3. When the firmware receives a read-write command sent by the upper CPU, the priority of the read-write command can be determined. If the read-write command is of low priority, the low-priority context object is obtained; if the read-write command is of high priority, the high-priority context object is obtained;

[0119] 4, record the read-write command in the context object, and send the required parameters to the functional unit, the functional unit processes the read-write command and returns the execution result to the functional unit;

[0120] 5, after receiving the execution result, the firmware can obtain the context object according to the number of the context object, and transform the completion message using the parameters recorded in the context object and send it to the CPU;

[0121] 6, after returning the completion message to the CPU, the context object is in the standby execution state again, and the functional unit can continue to process the new read-write command using the context object when receiving the new read-write command.

[0122] Through the read-write command processing method of the embodiment of the application, the firmware of the solid state disk receives the read-write command sent by the CPU, determines the priority level of the read-write command according to the command type and the preset corresponding relationship, determines the target context object with the same priority level as the read-write command according to the priority level of the read-write command, obtains the target context object, generates a message processing request using the read-write command and the target context object, and sends the message processing request to the functional unit of the NAND, so that the functional unit processes the read-write command in the message processing request. Through the method of the application, the functional unit is configured with context objects of different priority levels, which are respectively used to deliver read-write commands of the same priority level, and the command type of the read-write command has a corresponding relationship with the priority level, so that the firmware can determine the priority level of the read-write command according to the command type and the preset corresponding relationship when receiving the read-write command, generate a message processing request using the target context object with the same priority level as the read-write command and the read-write command, and send it to the functional unit for processing. Therefore, after the firmware obtains the read-write command, it can deliver the read-write command using the context object configured by it, without applying for a new context object, and after the read-write command processing is completed, it is no longer necessary to release the context object, thereby reducing two time-consuming steps in the read-write command processing flow in the prior art, and improving the processing efficiency of the read-write command.

[0123] It should be noted that, for the method embodiment, in order to simply describe, it is expressed as a series of action combinations, but those skilled in the art should know that the embodiments of the application are not limited by the described action sequence, because according to the embodiments of the application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the involved actions are not necessarily necessary for the embodiments of the application.

[0124] Referring to Figure 4 , a structure block diagram of a read-write instruction processing device provided in an embodiment of the application is shown, which can specifically include the following modules:

[0125] The first receiving module 401 is configured to receive a read-write command sent by the CPU; the read-write command records a command type;

[0126] The priority level determining module 402 is configured to determine a priority level of the read-write command according to the command type and a preset correspondence relationship; the preset correspondence relationship is a correspondence relationship between the command type of the read-write command and the priority level of the read-write command;

[0127] The target context object determining module 403 is configured to determine, according to the priority level of the read-write command, the context object with the same priority level as the read-write command as a target context object;

[0128] The obtaining module 404 is configured to obtain the target context object from the functional unit;

[0129] The generating module 405 is configured to generate a message processing request by using the read-write command and the target context object, and send the message processing request to the functional unit; the functional unit is configured to process the read-write command in the message processing request.

[0130] Optionally, the context object includes a high-priority context object and a low-priority context object; the priority level of the read-write command includes a high priority and a low priority, and the target context object determining module 403 includes:

[0131] The first target context object determining submodule is configured to determine the target context object as the high-priority context object if the priority level of the read-write command is the high priority;

[0132] The second target context object determining submodule is configured to determine the target context object as the low-priority context object if the priority level of the read-write command is the low priority.

[0133] Optionally, the generating module 405 includes:

[0134] The converting submodule is configured to parse the read-write command, and convert the read-write command into a target instruction recognizable by the functional unit;

[0135] The generating submodule is configured to generate the message processing request by using the target instruction and the target context object.

[0136] Optionally, the command type includes a read command and a write command, and the priority level determining module 402 includes:

[0137] The first priority level determining submodule is configured to determine the priority level of the read-write command as the high priority if the command type is the read command.

[0138] The second priority level determining submodule is configured to determine the priority level of the read-write command as the low priority if the command type is the write command.

[0139] Optionally, the device further comprises:

[0140] The configuration module is configured to configure two context objects for each of the functional units.

[0141] The priority level setting module is configured to receive a request for setting the priority level of the functional units, and set the two context objects of each of the functional units as the high priority context object and the low priority context object.

[0142] Optionally, the device further comprises:

[0143] The second receiving module is configured to receive a functional unit setting request in a solid state disk power-on initial stage; the functional unit setting request records the number of the functional units;

[0144] The functional unit setting module is configured to set the number of the functional units according to the number of the functional units.

[0145] Optionally, the device further comprises:

[0146] The returning module is configured to receive a processing result returned by the functional units;

[0147] The sending module is configured to generate a completion message using the processing result and send the completion message to the CPU.

[0148] In the read / write command processing device of this embodiment, the firmware of the solid-state drive receives read / write commands sent by the CPU, determines the priority level of the read / write commands according to the command type and a preset correspondence, determines the context object with the same priority level as the read / write commands as the target context object according to the priority level of the read / write commands, obtains the target context object, generates a message processing request using the read / write commands and the target context object, and sends the message processing request to the functional unit of the NAND, so that the functional unit processes the read / write commands in the message processing request. With this device, the functional unit is configured with context objects of different priority levels, which are used to transmit read and write commands of the same priority level. The command type and priority level of the read and write commands have a corresponding relationship. When the firmware receives a read or write command, it can determine the priority level of the read or write command according to the command type and the preset correspondence. It uses the target context object with the same priority level as the read or write command to generate a message processing request and send it to the functional unit for processing. Thus, after the firmware obtains the read or write command, it can use its configured context object to transmit the read or write command without needing to apply for a new context object. After the read or write command is processed, it no longer needs to release the context object. This reduces two time-consuming steps in the read or write command processing flow of the prior art and improves the processing efficiency of read and write commands.

[0149] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0150] In addition, embodiments of the present invention also provide an electronic device, such as... Figure 5 As shown, it includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504.

[0151] Memory 503 is used to store computer programs;

[0152] When processor 501 executes the program stored in memory 503, it performs the following steps:

[0153] Receive read / write commands sent by the CPU; the read / write commands record the command type;

[0154] The priority level of the read / write command is determined based on the command type and a preset correspondence; the preset correspondence is the correspondence between the command type of the read / write command and the priority level of the read / write command.

[0155] determining, according to the priority level of the read-write command, the context object having the same priority level as the read-write command as a target context object;

[0156] obtaining the target context object from the functional unit;

[0157] generating a message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit; the functional unit is configured to process the read-write command in the message processing request.

[0158] Optionally, the context object includes a high-priority context object and a low-priority context object; the priority level of the read-write command includes a high priority and a low priority, and the step of determining, according to the priority level of the read-write command, the context object having the same priority level as the read-write command as a target context object includes:

[0159] if the priority level of the read-write command is the high priority, determining the target context object as the high-priority context object;

[0160] if the priority level of the read-write command is the low priority, determining the target context object as the low-priority context object.

[0161] Optionally, the step of generating a message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit includes:

[0162] parsing the read-write command to convert the read-write command into a target instruction recognizable by the functional unit;

[0163] generating the message processing request by using the target instruction and the target context object.

[0164] Optionally, the command type includes a read command and a write command,

[0165] the step of determining the priority level of the read-write command according to the command type and a preset corresponding relationship includes:

[0166] if the command type is the read command, determining the priority level of the read-write command as the high priority;

[0167] if the command type is the write command, determining the priority level of the read-write command as the low priority.

[0168] Optionally, the method further includes:

[0169] configuring two context objects for each functional unit;

[0170] receiving a request for setting priority levels for the functional units, and setting the two context objects for each of the functional units as the high-priority context object and the low-priority context object.

[0171] Optionally, before the step of configuring two context objects for each of the functional units, the method further comprises:

[0172] receiving a functional unit setting request in an initial stage of power-on of the solid state disk, the functional unit setting request recording a number of the functional units;

[0173] setting the number of the functional units according to the number of the functional units.

[0174] Optionally, after the step of generating a message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit, the method further comprises:

[0175] receiving a processing result returned by the functional unit;

[0176] generating a completion message by using the processing result and sending the completion message to the CPU.

[0177] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0178] The communication interface is used for communication between the terminal and other devices.

[0179] The memory can include a Random Access Memory (RAM), and can also include a non-volatile memory, such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor.

[0180] The processor described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; or can be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0181] As shown in FIG. 6, in another embodiment provided by the present application, a computer readable storage medium 601 is also provided, and the computer readable storage medium 601 stores instructions, which, when executed on a computer, cause the computer to perform the read-write command processing method described in the above embodiments. Figure 6

[0182] In another embodiment provided by the present application, a computer program product containing instructions is also provided, which, when executed on a computer, cause the computer to perform the read-write command processing method described in the above embodiments.

[0183] In the above embodiments, the implementation can be achieved entirely or partially by software, hardware, firmware or any combination thereof. When implemented by software, the implementation can be achieved entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the flow or function described in the embodiments of the present application is entirely or partially generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)), etc. ​

[0184] It is to be noted that, as used in this specification and the appended claims, the singular forms "a," "an" and "the" include plural referents unless the context clearly dictates otherwise. Thus, for example, reference to "a component" can include a combination of two or more components, and the term "an element" can include comparable reference to a plurality of elements. Also, as used in this specification and the appended claims, the term "or" as used in the context of "A / B" or "A / B / C" means any of the possibilities; for example, the term "or" means "any of A, B, or C; or any of A, B, or C." Further, the term "comprising" as used in this specification and the appended claims, is inclusive or open and does not exclude additional, non-relevant elements or limit it to the specific elements

[0185] Each of the embodiments in the specification is described in a relevant manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.

[0186] The preferred embodiments of the present application have been described in detail above. However, all the changes and modifications that can be made to the present application in terms of the principles of the present application fall within the scope of the present application.

Claims

1. A read-write command processing method, characterized by, The application relates to firmware applied to a solid state disk, wherein the solid state disk further comprises NAND, the NAND comprises at least one functional unit, the firmware is in communication with a CPU and the functional unit respectively, the functional unit is configured with at least one context object of a priority level, and the method comprises the following steps: receiving a read-write command sent by the CPU; the read-write command records a command type; determining the priority level of the read-write command according to the command type and a preset corresponding relationship; the preset corresponding relationship is the corresponding relationship between the command type of the read-write command and the priority level of the read-write command; determining the context object with the same priority level as the read-write command as a target context object according to the priority level of the read-write command; obtaining the target context object from the functional unit; generating a message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit; the functional unit is used for processing the read-write command in the message processing request.

2. The method of claim 1, wherein, The context object comprises a high-priority context object and a low-priority context object; the priority level of the read-write command comprises a high priority and a low priority; the step of determining the context object with the same priority level as the read-write command as a target context object according to the priority level of the read-write command comprises the following steps: if the priority level of the read-write command is the high priority, the target context object is determined as the high-priority context object; if the priority level of the read-write command is the low priority, the target context object is determined as the low-priority context object.

3. The method of claim 1, wherein, The step of generating a message processing request by using the read-write command and the target context object, and sending the message processing request to the functional unit comprises the following steps: parsing the read-write command, and converting the read-write command into a target instruction recognizable by the functional unit; generating the message processing request by using the target instruction and the target context object.

4. The method of claim 1, wherein, The command type comprises a read command and a write command; The step of determining the priority level of the read-write command according to the command type and a preset corresponding relationship comprises the following steps: if the command type is the read command, the priority level of the read-write command is determined as the high priority; if the command type is the write command, the priority level of the read-write command is determined as the low priority.

5. The method of claim 1, wherein, The method further comprises the following steps: configuring two context objects for each functional unit; receiving a request for setting the priority level of the functional unit, and setting the two context objects of each functional unit as a high-priority context object and a low-priority context object.

6. The method of claim 5, wherein, Before the step of configuring two context objects for each functional unit, the method further comprises the following steps: receiving a functional unit setting request in the initial stage of power-on of the solid state disk; the functional unit setting request records the number of the functional units; setting the number of the functional units according to the number of the functional units.

7. The method of claim 1, wherein, The step of generating a message processing request using the read-write command and the target context object, and sending the message processing request to the functional unit, is followed by: receiving a processing result returned by the functional unit; generating a completion message using the processing result and sending it to the CPU.

8. A read-write command processing apparatus characterized by comprising: The firmware applied to a solid state disk further comprises a NAND, the NAND comprising at least one functional unit, the firmware respectively communicating with a CPU and the functional unit, the functional unit being configured with at least one context object of a priority level, the device comprising: a first receiving module configured to receive a read-write command sent by the CPU; the read-write command recording a command type; a priority level determining module configured to determine a priority level of the read-write command according to the command type and a preset correspondence relationship; the preset correspondence relationship being a correspondence relationship between the command type of the read-write command and the priority level of the read-write command; a target context object determining module configured to determine, according to the priority level of the read-write command, the context object having the same priority level as the read-write command as a target context object; an obtaining module configured to obtain the target context object from the functional unit; a generating module configured to generate a message processing request using the read-write command and the target context object, and send the message processing request to the functional unit; the functional unit being configured to process the read-write command in the message processing request.

9. An electronic device, comprising: comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus; the memory is configured to store a computer program; the processor is configured to execute the program stored on the memory, and realize the read-write command processing method according to any one of claims 1-7.

10. One or more computer readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the read-write command processing method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Priority-based TPM read-write control method

    CN105740713A

  • Data read-write method, NAND controller and computer readable storage medium

    CN114489488A