[go: up one dir, main page]

CN112214300A - Command timeout processing method, processing device and computer readable storage medium - Google Patents

Command timeout processing method, processing device and computer readable storage medium Download PDF

Info

Publication number
CN112214300A
CN112214300A CN202011086987.5A CN202011086987A CN112214300A CN 112214300 A CN112214300 A CN 112214300A CN 202011086987 A CN202011086987 A CN 202011086987A CN 112214300 A CN112214300 A CN 112214300A
Authority
CN
China
Prior art keywords
command
tag
frame
prp
resource pool
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011086987.5A
Other languages
Chinese (zh)
Other versions
CN112214300B (en
Inventor
王涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zeshi Technology Wuhan Co Ltd
Beijing Zeshi Technology Co ltd
Original Assignee
Zeshi Technology Wuhan Co Ltd
Beijing Zeshi Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zeshi Technology Wuhan Co Ltd, Beijing Zeshi Technology Co ltd filed Critical Zeshi Technology Wuhan Co Ltd
Priority to CN202011086987.5A priority Critical patent/CN112214300B/en
Publication of CN112214300A publication Critical patent/CN112214300A/en
Application granted granted Critical
Publication of CN112214300B publication Critical patent/CN112214300B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a command timeout processing method, a processing device and a computer readable storage medium. The processing method comprises the following steps: constructing a resource pool, wherein the resource pool is used for storing labels, and the labels comprise command labels, frame labels and PRP labels; receiving a command issued by a host; determining a command tag, a frame tag and a PRP tag corresponding to the command; taking out the command label, the frame label and the PRP label distributed for the command from the resource pool; determining whether the command times out; and in the case of command timeout, recycling the command label, the frame label and the PRP label which are allocated to the command into the resource pool. According to the scheme, the command tags, the frame tags and the PRP tags are forcibly recycled under the condition of command timeout, the high-efficiency processing of command timeout by adopting the SSD controller is realized, the resources are reasonably utilized, unnecessary occupation of the resources is avoided, the processing efficiency of command timeout is improved, and the operating efficiency of the system is further improved.

Description

Command timeout processing method, processing device and computer readable storage medium
Technical Field
The present application relates to the field of command timeout processing, and in particular, to a command timeout processing method, a processing apparatus, a computer-readable storage medium, and a processor.
Background
In the SSD controller, when a host issues a command, a corresponding execution queue ID and a command ID are allocated, and meanwhile, the controller allocates resources such as a corresponding command tag, a corresponding frame tag, a corresponding PRP tag and the like according to the structure of the controller to split the command.
In some cases, the command is not returned after being issued, if the command is not processed, various resources cannot be released, the system operation efficiency is reduced, and meanwhile, the host computer is also triggered to overtime, so that the controller is reset.
Although the resource structure of different SSD controllers may be different, the hardware processing power is limited. In each case, the system needs to operate continuously and stably, and reasonable recovery of resources is necessary for the SSD controller.
In a typical controller scheme, there is no timeout handling mechanism at all, handled directly by the host, which may directly trigger a controller reset.
If timeout detection and processing is performed by firmware, only a very single scene can be processed, and the overall efficiency and effect of the scene are difficult to meet.
However, the prior art lacks an efficient method for processing command timeout of the solid state hard disk controller.
Disclosure of Invention
The present application mainly aims to provide a command timeout processing method, a processing apparatus, a computer-readable storage medium, and a processor, so as to solve the problem in the prior art that an efficient command timeout processing method for a solid state disk controller is lacking.
In order to achieve the above object, according to an aspect of the present application, there is provided a command timeout processing method including: constructing a resource pool, wherein the resource pool is used for storing labels, and the labels comprise a command label, a frame label and a PRP label; receiving a command issued by a host; determining the command tag, the frame tag and the PRP tag corresponding to the command; fetching the command tag, the frame tag, and the PRP tag allocated for the command from the resource pool; determining whether the command times out; and in the case of command timeout, recycling the command tag, the frame tag and the PRP tag allocated to the command into the resource pool.
Further, the resource pool includes a command resource pool, a frame resource pool, and a PRP resource pool, where the command resource pool is used for storing the command tag, the frame resource pool is used for storing the frame tag, and the PRP resource pool is used for storing the PRP tag.
Further, after the resource pool is constructed and before the command issued by the host is received, the processing method further includes: initializing the resource pool.
Further, determining whether the command times out comprises: acquiring the issuing time of the command; acquiring current time; calculating the difference value between the issuing time and the current time; determining that the command is timed out if the difference is greater than a predetermined value; determining that the command does not time out if the difference is less than or equal to the predetermined value.
Further, after taking out the command tag, the frame tag, and the PRP tag allocated for the command from the resource pool, and before determining whether the command times out, the method further comprises: and constructing an RAM (random access memory), wherein the RAM comprises a command tag RAM, a frame tag RAM and a PRP (private branch point) tag RAM, the command tag RAM is used for storing the issuing time and an effective identifier of the command, the effective identifier is used for indicating whether the command is issued, the frame tag RAM is used for storing a first corresponding relation and a second corresponding relation, the first corresponding relation is the corresponding relation between the frame tag and the command tag, the second corresponding relation is the corresponding relation between the frame tag and the PRP tag, and the PRP tag RAM is used for storing addresses in the memory corresponding to the PRP tags.
Further, acquiring the issuing time of the command includes: traversing the frame tag RAM; determining the command tag corresponding to the frame tag according to the first corresponding relation; and inquiring the issuing time of the command in the command tag RAM according to the command tag.
Further, in the case that the command is timed out, recycling the command tag, the frame tag, and the PRP tag allocated to the command into the resource pool includes: recycling the frame tag to the resource pool; determining the command tag corresponding to the frame tag according to the first corresponding relation; recycling the command label; determining the PRP label corresponding to the frame label according to the second corresponding relation; recovering the PRP label.
Further, the command tag corresponds to a plurality of the frame tags, and recycling the command tag includes: and when all the plurality of frame tags corresponding to the command tag are recovered, recovering the command tag.
Further, the processing method further comprises: setting overtime processing time; and discarding the frame data when detecting that the frame data corresponding to the command returns in the case that all the frame tags are not collected in the timeout processing time.
According to another aspect of the present application, there is provided a command timeout processing apparatus, including: constructing a resource pool, wherein the resource pool is used for storing labels, and the labels comprise a command label, a frame label and a PRP label; receiving a command issued by a host; determining the command tag, the frame tag and the PRP tag corresponding to the command; fetching the command tag, the frame tag, and the PRP tag allocated for the command from the resource pool; determining whether the command times out; and in the case of command timeout, recycling the command tag, the frame tag and the PRP tag allocated to the command into the resource pool.
According to an aspect of the present application, there is provided a computer-readable storage medium, which includes a stored program, wherein when the program runs, the apparatus on which the computer-readable storage medium is located is controlled to execute any one of the above processing methods for command timeout.
According to an aspect of the present application, there is provided a processor for executing a program, wherein the program executes any one of the command timeout processing methods.
By the technical scheme, the resource pool is built, the command issued by the host is received, the command label, the frame label and the PRP label distributed to the command issued by the host are taken out of the resource pool, and the command label, the frame label and the PRP label distributed to the command are recycled to the resource pool under the condition that the command is overtime, namely the command is not returned all the time after being issued. Compared with the host processing command overtime in the prior art, the host overtime is avoided, the controller reset cannot be triggered, and the stability of the controller is improved. Compared with the method for detecting and processing overtime by firmware in the prior art, the method can meet various command overtime scenes, improves the efficiency of command overtime processing, simultaneously, the firmware only needs to configure overtime parameters, saves firmware resources, does not need firmware interaction, and improves the performance.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
FIG. 1 shows a flowchart of a command timeout handling method according to an embodiment of the application; and
fig. 2 shows a schematic diagram of a command timeout processing device according to an embodiment of the application.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It will be understood that when an element such as a layer, film, region, or substrate is referred to as being "on" another element, it can be directly on the other element or intervening elements may also be present. Also, in the specification and claims, when an element is described as being "connected" to another element, the element may be "directly connected" to the other element or "connected" to the other element through a third element.
For convenience of description, some terms or expressions referred to in the embodiments of the present application are explained below:
a Solid State Drive (SSD), commonly referred to as a Solid State Disk. The solid state disk is a hard disk made of a solid state electronic storage chip array. The SSD is composed of a control unit and a storage unit.
According to an embodiment of the application, a command timeout processing method is provided.
Fig. 1 is a flowchart of a command timeout processing method according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S101, constructing a resource pool, wherein the resource pool is used for storing labels, and the labels comprise command labels, frame labels and PRP labels;
step S102, receiving a command issued by a host;
step S103, determining the command tag, the frame tag and the PRP tag corresponding to the command;
step S104, taking out the command label, the frame label and the PRP label distributed for the command from the resource pool;
step S105, determining whether the command is overtime;
step S106, when the command is overtime, collecting the command tag, the frame tag and the PRP tag allocated to the command into the resource pool.
In the above scheme, the resource pool is constructed, the command issued by the host is received, the command tag, the frame tag and the PRP tag distributed for the command issued by the host are taken out from the resource pool, and the command tag, the frame tag and the PRP tag distributed for the command are recovered to the resource pool under the condition that the command is overtime, namely the command is not returned all the time after being issued, so that the command tag, the frame tag and the PRP tag are forcibly recovered under the condition that the command is overtime, the high-efficiency processing of command overtime by adopting the SSD controller is realized, the reasonable utilization of resources is realized, the unnecessary occupation of resources is avoided, the processing efficiency of command overtime is improved, and the operating efficiency of the system is further improved. Compared with the host processing command overtime in the prior art, the host overtime is avoided, the controller reset cannot be triggered, and the stability of the controller is improved. Compared with the method for detecting and processing overtime by firmware in the prior art, the method can meet various command overtime scenes, improves the efficiency of command overtime processing, simultaneously, the firmware only needs to configure overtime parameters, saves firmware resources, does not need firmware interaction, and improves the performance.
Specifically, the executing main body of the steps S101 to S106 is the SSD controller, so that efficient processing of command timeout by the SSD controller is realized, processing efficiency of command timeout is improved, resources are reasonably utilized, unnecessary occupation of resources is avoided, that is, the command timeout does not occupy corresponding command tag, frame tag and PRP tag, so that corresponding command tag, frame tag and PRP tag are conveniently allocated to the effective command, and processing efficiency of the command is improved.
In addition, the command overtime processing is a background polling detection task, does not occupy the bandwidth of a main channel, does not influence the normal operation of the system, and improves the operation efficiency of the system.
Furthermore, multiple commands in the scheme can be processed simultaneously, and the next command does not need to be processed after one command is processed.
Specifically, regarding the task interface, the firmware only needs to configure the enable signal, return the basic information such as the status, and other hardware automatically processes the corresponding task. In addition, query interval configuration can be added, and after one round of query is completed, the next round is performed at intervals. This process is more cost effective.
Certainly, under the condition that the command is not overtime, after the command issued by the host is received, the command tag, the frame tag and the PRP tag corresponding to the command are allocated to the command, and when the command returns, the command tag, the frame tag and the PRP tag corresponding to the command are recovered to a resource pool.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
In an embodiment of the present application, the resource pool includes a command resource pool, a frame resource pool, and a PRP resource pool, where the command resource pool is used to store the command tag, the frame resource pool is used to store the frame tag, and the PRP resource pool is used to store the PRP tag. The independent management of the command label, the frame label and the PRP label is realized, and the command overtime processing efficiency is further improved.
In another embodiment of the present application, after the resource pool is constructed and before the command issued by the host is received, the processing method further includes: and initializing the resource pool. That is, all spaces of the resource pool are filled up, for example, if the command resource pool has 100 spaces, the command resource pool is numbered from 1 to 100, and the frame resource pool has 200 spaces, the frame resource pool is numbered from 1 to 200, and if the PRP resource pool has 400 spaces, the PRP resource pool 1 to 400 is numbered, so as to facilitate the subsequent determination of the command tag, the frame tag and the PRP tag corresponding to the command, for example, the command tag corresponding to the first command is numbered 1, the corresponding frame tag is numbered 1 to 2, and the corresponding PRP tag is numbered 1 to 4; the serial number of a command tag corresponding to the second command is 2, the serial number of a corresponding frame tag is 3-4, and the serial number of a corresponding PRP tag is 5-8; after receiving the command issued by the host, distributing corresponding command tags, frame tags and PRP tags to each received command, so as to facilitate command management and command timeout processing. In addition, a FIFO (First In First out), i.e. a First In First out queue, may be used to initialize the resource pool.
In another embodiment of the present application, determining whether the command is timed out includes: acquiring the issuing time of the command; acquiring current time; calculating the difference value between the issuing time and the current time; determining that the command is overtime if the difference is greater than a predetermined value; and determining that the command does not time out in the case where the difference is less than or equal to the predetermined value. Specifically, the predetermined value may be set to 20ms, 30ms, 50ms, etc., and those skilled in the art may set an appropriate predetermined value according to actual circumstances.
In another embodiment of the present application, determining whether the command is timed out includes: any one of the commands corresponds to a plurality of frame data, and in the case where any one of the frame data is overtime, the command is determined to be overtime.
In yet another embodiment of the present application, after taking out the command tag, the frame tag, and the PRP tag allocated to the command from the resource pool, and before determining whether the command is timed out, the method further includes: and constructing an RAM, wherein the RAM comprises a command tag RAM, a frame tag RAM and a PRP tag RAM, the command tag RAM is used for storing the issuing time and a valid identifier of the command, the valid identifier is used for indicating whether the command is issued, namely the command is valid if the command is issued, and the command is invalid if the command is not issued, the frame tag RAM is used for storing a first corresponding relation and a second corresponding relation, the first corresponding relation is the corresponding relation between the frame tag and the command tag, the second corresponding relation is the corresponding relation between the frame tag and the PRP tag, and the PRP tag RAM is used for storing addresses in a memory corresponding to the PRP tags. Namely, the extra RAM is adopted to manage the issuing time, the effective identification, the corresponding relation between the frame tag and the command tag and the corresponding relation between the frame tag and the PRP tag of the command, thereby improving the processing speed of command overtime. And managing label resources by using the RAM so as to realize resource circulation of the out-of-order frames.
In particular, the task overhead with respect to command timeout processing. Under conservative assumption that one lookup table has 3 clock cycles, the system frequency is 200MHz, the depth of the three tables (i.e. the RAM) is 8K, and when all commands time out, the maximum time required for one round of query is (8192 × 3 × 3) × 5ns — 368 us. The scheme adopts a three-level table look-up mode for overtime query, the operation is efficient, and one round of query can be controlled within 1 ms. The overtime of the general host command is in the second level, and the processing efficiency of the system completely meets the requirement. And one round of frame tag RAM query is completed, which represents that one round of overtime polling is ended without repeated query.
In another embodiment of the present application, obtaining the issuing time of the command includes: traversing the frame tag RAM; determining the command tag corresponding to the frame tag according to the first corresponding relationship; according to the command tag, the command issuing time is inquired in the command tag RAM. The command tag RAM stores the issuing time of the command, the command tags correspond to the issuing time of the command one by one, when the command issued by the host is received, the issuing time of the command is stored in the command tag RAM synchronously, and the command tags are also stored in the command tag RAM, so that the command tags corresponding to the command need to be found when the issuing time of the command is required to be obtained, the command consists of a plurality of frame data, and the frame header information of each frame data carries the frame tags, so that the frame tags can be obtained by reading each frame data, then the command tags can be obtained according to the first corresponding relation, and the issuing time of the command can be obtained after the command tags are obtained. The scheme can meet the query efficiency of the out-of-order frames.
In another embodiment of the present application, when the command is overtime, the recovering the command tag, the frame tag, and the PRP tag allocated to the command into the resource pool includes: recovering the frame tag to the resource pool; determining the PRP label corresponding to the frame label according to the second correspondence; recovering the PRP label; determining the command tag corresponding to the frame tag according to the first corresponding relationship; and recovering the command tag. Under the condition that the command is determined to be overtime, firstly, recovering frame tags into the frame resource pool, and then, recovering the PRP tags corresponding to the frame tags into the PRP resource pool, specifically, each frame tag corresponds to a plurality of PRP tags, the second corresponding relationship is actually the corresponding relationship between the frame tag and the first PRP tag, the PRP tags are stored in a linked list form and have linked list end marks, so that the information of all the PRP tags corresponding to the frame tags can be obtained as long as the information of the first PRP tag is obtained, for example, the number of the frame tag is 2, the number of the first PRP tag corresponding to the frame tag is 5, and the number of one frame tag corresponds to four PRP tags, so that the tags of all the PRP tags can be obtained to be 5-8; and then determining the command label corresponding to the frame label according to the first corresponding relation, and then recycling the command label to a command resource pool. The recovery of the command label, the frame label and the PRP label is realized, the subsequent commands are distributed, the reasonable utilization of resources is realized, and the unnecessary occupation of the resources is avoided.
In another embodiment of the present application, the recovering the command tags, where the command tags correspond to a plurality of frame tags, includes: and recovering the command tag when all of the plurality of frame tags corresponding to the command tag are recovered. One command tag corresponds to a plurality of frame tags, and when all of the plurality of frame tags corresponding to the command tag are collected, the command tag is collected again. And the frame label quantity corresponding to one command label is stored in the command label RAM, and under the condition that all the frame labels are completely recovered, the end identifier gives an end prompt to prompt all the frame labels to be completely recovered, and then the command labels are recovered. The command tag, the frame tag, and the PRP tag may be recycled using a fifo (First In First out), i.e., a First In First out queue.
In another embodiment of the present application, the processing method further includes: setting overtime processing time; and discarding the frame data when it is detected that the frame data corresponding to the command is returned in a case where all the frame tags are not collected within the timeout processing time. In order to increase the processing speed of the command, a timeout processing time is set, for example, the timeout processing time is set to 1s, and if all the frame tags cannot be collected within 1s and frame data corresponding to the command is returned, the frame data is not processed any more.
In another embodiment of the present application, the processing method further includes: when the command is subjected to timeout processing, the command is subjected to lock protection to prevent the normal frame data from affecting the frame data overtime when returning, for example, if the timeout command number is No. 4 (that is, the command tag corresponding to the command is No. 4), the command No. 4 needs to set the busy flag (that is, the command is undergoing timeout processing) when entering the timeout processing, and if the normal frame data is returned, the busy flag corresponding to the command is inquired, and the normal frame processing is stopped (that is, the frame is discarded). This prevents normal frame data from returning and interfering with the timeout process.
The embodiment of the present application further provides a device for processing command timeout, and it should be noted that the device for processing command timeout according to the embodiment of the present application may be used to execute the method for processing command timeout provided in the embodiment of the present application. The following describes a command timeout processing apparatus according to an embodiment of the present application.
Fig. 2 is a schematic diagram of a command timeout processing device according to an embodiment of the application. As shown in fig. 2, the apparatus includes:
a first constructing unit 10, configured to construct a resource pool, where the resource pool is used to store tags, where the tags include a command tag, a frame tag, and a PRP tag;
a receiving unit 20, configured to receive a command issued by a host;
a first determining unit 30 configured to determine the command tag, the frame tag, and the PRP tag corresponding to the command;
an extracting unit 40 configured to extract the command tag, the frame tag, and the PRP tag allocated to the command from the resource pool;
a second determination unit 50 for determining whether the command is timed out;
a collecting unit 60, configured to collect the command tag, the frame tag, and the PRP tag allocated to the command into the resource pool when the command is timed out.
In the above scheme, the first building unit builds the resource pool, the receiving unit receives the command issued by the host, the taking-out unit takes out the command label, the frame label and the PRP label distributed for the command issued by the host from the resource pool, and the recovery unit recovers the command label, the frame label and the PRP label distributed for the command into the resource pool under the condition that the command is overtime, that is, the command is not returned all the time after being issued. Compared with the host processing command overtime in the prior art, the host overtime is avoided, the controller reset cannot be triggered, and the stability of the controller is improved. Compared with the device for detecting and processing overtime by firmware in the prior art, the device can meet various command overtime scenes, improve the efficiency of command overtime processing, simultaneously, the firmware only needs to configure overtime parameters, save firmware resources, do not need firmware interaction, and improve the performance.
In addition, the command overtime processing is a background polling detection task, does not occupy the bandwidth of a main channel, does not influence the normal operation of the system, and improves the operation efficiency of the system.
Furthermore, multiple commands in the scheme can be processed simultaneously, and the next command does not need to be processed after one command is processed.
Specifically, regarding the task interface, the firmware only needs to configure the enable signal, return the basic information such as the status, and other hardware automatically processes the corresponding task. In addition, query interval configuration can be added, and after one round of query is completed, the next round is performed at intervals. This process is more cost effective.
Certainly, under the condition that the command is not overtime, after the command issued by the host is received, the command tag, the frame tag and the PRP tag corresponding to the command are allocated to the command, and when the command returns, the command tag, the frame tag and the PRP tag corresponding to the command are recovered to a resource pool.
In an embodiment of the present application, the resource pool includes a command resource pool, a frame resource pool, and a PRP resource pool, where the command resource pool is used to store the command tag, the frame resource pool is used to store the frame tag, and the PRP resource pool is used to store the PRP tag. The independent management of the command label, the frame label and the PRP label is realized, and the command overtime processing efficiency is further improved.
In another embodiment of the present application, the processing apparatus further includes an initializing unit, where the initializing unit is configured to initialize the resource pool after the resource pool is constructed and before a command issued by the host is received. That is, all spaces of the resource pool are filled up, for example, if the command resource pool has 100 spaces, the command resource pool is numbered from 1 to 100, and the frame resource pool has 200 spaces, the frame resource pool is numbered from 1 to 200, and if the PRP resource pool has 400 spaces, the PRP resource pool 1 to 400 is numbered, so as to facilitate the subsequent determination of the command tag, the frame tag and the PRP tag corresponding to the command, for example, the command tag corresponding to the first command is numbered 1, the corresponding frame tag is numbered 1 to 2, and the corresponding PRP tag is numbered 1 to 4; the serial number of a command tag corresponding to the second command is 2, the serial number of a corresponding frame tag is 3-4, and the serial number of a corresponding PRP tag is 5-8; after receiving the command issued by the host, distributing corresponding command tags, frame tags and PRP tags to each received command, so as to facilitate command management and command timeout processing. In addition, a FIFO (First In First out), i.e. a First In First out queue, may be used to initialize the resource pool.
In another embodiment of the present application, the second determining unit includes a first obtaining module, a second obtaining module, a calculating module, a first determining module, and a second determining module, where the first obtaining module is configured to obtain an issuing time of the command; the second acquisition module is used for acquiring the current time; the calculation module is used for calculating the difference value between the issuing time and the current time; the first determining module is used for determining that the command is overtime under the condition that the difference value is larger than a preset value; the second determining module is used for determining that the command does not time out under the condition that the difference value is smaller than or equal to the preset value. Specifically, the predetermined value may be set to 20ms, 30ms, 50ms, etc., and those skilled in the art may set an appropriate predetermined value according to actual circumstances.
In another embodiment of the present application, any one of the above-mentioned commands corresponds to a plurality of frame data, and the second determining unit is further configured to determine that the command has timed out if any one of the above-mentioned frame data has timed out.
In still another embodiment of the present application, the apparatus further includes a second constructing unit, configured to construct a RAM after the command tag, the frame tag, and the PRP tag allocated to the command are taken out of the resource pool and before it is determined whether the command is timed out, where the RAM includes a command tag RAM, a frame tag RAM, and a PRP tag RAM, the command tag RAM is configured to store the issue time of the command and a valid flag, the valid flag is configured to indicate whether the command is an issued command, that is, the command is valid if the command is an issued command, and invalid if the command is a non-issued command, the frame tag RAM is configured to store a first correspondence and a second correspondence, the first correspondence is a correspondence between the frame tag and the command tag, the second correspondence is a correspondence between the frame tag and a PRP tag, and the PRP tag RAM is used to store an address in a memory corresponding to each of the PRP tags. Namely, the extra RAM is adopted to manage the issuing time, the effective identification, the corresponding relation between the frame tag and the command tag and the corresponding relation between the frame tag and the PRP tag of the command, thereby improving the processing speed of command overtime. And managing label resources by using the RAM so as to realize resource circulation of the out-of-order frames.
In particular, the task overhead with respect to command timeout processing. Under conservative assumption that one lookup table has 3 clock cycles, the system frequency is 200MHz, the depth of the three tables (i.e. the RAM) is 8K, and when all commands time out, the maximum time required for one round of query is (8192 × 3 × 3) × 5ns — 368 us. The scheme adopts a three-level table look-up mode for overtime query, the operation is efficient, and one round of query can be controlled within 1 ms. The overtime of the general host command is in the second level, and the processing efficiency of the system completely meets the requirement. And one round of frame tag RAM query is completed, which represents that one round of overtime polling is ended without repeated query.
In another embodiment of the present application, the first obtaining module is further configured to traverse the frame tag RAM; determining the command tag corresponding to the frame tag according to the first corresponding relationship; according to the command tag, the command issuing time is inquired in the command tag RAM. The command tag RAM stores the issuing time of the command, the command tags correspond to the issuing time of the command one by one, when the command issued by the host is received, the issuing time of the command is stored in the command tag RAM synchronously, and the command tags are also stored in the command tag RAM, so that the command tags corresponding to the command need to be found when the issuing time of the command is required to be obtained, the command consists of a plurality of frame data, and the frame header information of each frame data carries the frame tags, so that the frame tags can be obtained by reading each frame data, then the command tags can be obtained according to the first corresponding relation, and the issuing time of the command can be obtained after the command tags are obtained. The scheme can meet the query efficiency of the out-of-order frames.
In another embodiment of the present application, the recycling unit includes a first recycling module, a third determining module, a second recycling module, a fourth determining module, and a third recycling module, where the first recycling module is configured to recycle the frame tag to the resource pool; the third determining module is configured to determine the PRP label corresponding to the frame label according to the second correspondence; the second recovery module is used for recovering the PRP label; the fourth determining module is configured to determine the command tag corresponding to the frame tag according to the first corresponding relationship; the third recovery module is used for recovering the command label. Under the condition that the command is determined to be overtime, firstly, recovering frame tags into the frame resource pool, and then, recovering the PRP tags corresponding to the frame tags into the PRP resource pool, specifically, each frame tag corresponds to a plurality of PRP tags, the second corresponding relationship is actually the corresponding relationship between the frame tag and the first PRP tag, the PRP tags are stored in a linked list form and have linked list end marks, so that the information of all the PRP tags corresponding to the frame tags can be obtained as long as the information of the first PRP tag is obtained, for example, the number of the frame tag is 2, the number of the first PRP tag corresponding to the frame tag is 5, and the number of one frame tag corresponds to four PRP tags, so that the tags of all the PRP tags can be obtained to be 5-8; and then determining the command label corresponding to the frame label according to the first corresponding relation, and then recycling the command label to a command resource pool. The recovery of the command label, the frame label and the PRP label is realized, the subsequent commands are distributed, the reasonable utilization of resources is realized, and the unnecessary occupation of the resources is avoided.
In another embodiment of the application, the command tag corresponds to a plurality of frame tags, and the third recycling module is further configured to recycle the command tag when all of the plurality of frame tags corresponding to the command tag are recycled. One command tag corresponds to a plurality of frame tags, and when all of the plurality of frame tags corresponding to the command tag are collected, the command tag is collected again. And the frame label quantity corresponding to one command label is stored in the command label RAM, and under the condition that all the frame labels are completely recovered, the end identifier gives an end prompt to prompt all the frame labels to be completely recovered, and then the command labels are recovered. The command tag, the frame tag, and the PRP tag may be recycled using a fifo (First In First out), i.e., a First In First out queue.
In another embodiment of the present application, the processing apparatus further includes a setting unit and a discarding unit, where the setting unit is configured to set a timeout processing time; the discarding means discards the frame data when it is detected that the frame data corresponding to the command is returned in a case where all the frame tags are not collected within the timeout processing time. In order to increase the processing speed of the command, a timeout processing time is set, for example, the timeout processing time is set to 1s, and if all the frame tags cannot be collected within 1s and frame data corresponding to the command is returned, the frame data is not processed any more.
In another embodiment of the present application, the processing device further includes a protection unit, where the protection unit is configured to lock and protect the command when the command is subjected to timeout processing, so as to prevent the timeout frame data from being affected when normal frame data is returned, for example, if the timeout command number is No. 4 (that is, the command tag corresponding to the command is No. 4), it is necessary to set the busy flag of the command No. 4 (that is, the command is subjected to timeout processing) when the timeout processing is performed, and when normal frame data is returned, the busy flag of the corresponding command is queried, and normal frame processing is stopped (that is, the frame is discarded). This prevents normal frame data from returning and interfering with the timeout process.
The processing device of command timeout comprises a processor and a memory, wherein the first constructing unit, the receiving unit, the first determining unit, the fetching unit, the second determining unit, the recovering unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the processing efficiency of command timeout of the solid state hard disk controller is improved by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
The embodiment of the invention provides a computer-readable storage medium, which comprises a stored program, wherein when the program runs, a device where the computer-readable storage medium is located is controlled to execute the command timeout processing method.
The embodiment of the invention provides a processor, which is used for running a program, wherein the program runs to execute the command timeout processing method.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein when the processor executes the program, at least the following steps are realized:
step S101, constructing a resource pool, wherein the resource pool is used for storing labels, and the labels comprise command labels, frame labels and PRP labels;
step S102, receiving a command issued by a host;
step S103, determining the command tag, the frame tag and the PRP tag corresponding to the command;
step S104, taking out the command label, the frame label and the PRP label distributed for the command from the resource pool;
step S105, determining whether the command is overtime;
step S106, when the command is overtime, collecting the command tag, the frame tag and the PRP tag allocated to the command into the resource pool.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program of initializing at least the following method steps when executed on a data processing device:
step S101, constructing a resource pool, wherein the resource pool is used for storing labels, and the labels comprise command labels, frame labels and PRP labels;
step S102, receiving a command issued by a host;
step S103, determining the command tag, the frame tag and the PRP tag corresponding to the command;
step S104, taking out the command label, the frame label and the PRP label distributed for the command from the resource pool;
step S105, determining whether the command is overtime;
step S106, when the command is overtime, collecting the command tag, the frame tag and the PRP tag allocated to the command into the resource pool.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above embodiments of the present application have been implemented in hardware, and on the premise that the service type and the return delay are controllable, the bandwidth, efficiency, resources, and usability can all be balanced.
From the above description, it can be seen that the above-described embodiments of the present application achieve the following technical effects:
1) the command overtime processing method comprises the steps of constructing a resource pool, receiving a command issued by a host, taking out a command label, a frame label and a PRP label distributed for the command issued by the host from the resource pool, and recovering the command label, the frame label and the PRP label distributed for the command to the resource pool under the condition that the command is overtime, namely the command is not returned all the time after being issued, so that the command label, the frame label and the PRP label are forcibly recovered under the condition that the command is overtime, the command overtime is efficiently processed by adopting an SSD controller, the reasonable utilization of resources is realized, the unnecessary occupation of resources is avoided, the command overtime processing efficiency is improved, and the operating efficiency of a system is improved. Compared with the host processing command overtime in the prior art, the host overtime is avoided, the controller reset cannot be triggered, and the stability of the controller is improved. Compared with the method for detecting and processing overtime by firmware in the prior art, the method can meet various command overtime scenes, improves the efficiency of command overtime processing, simultaneously, the firmware only needs to configure overtime parameters, saves firmware resources, does not need firmware interaction, and improves the performance.
2) The command overtime processing device comprises a first building unit, a receiving unit, a fetching unit, a recovery unit and a SSD controller, wherein the first building unit builds a resource pool, the receiving unit receives a command issued by a host, the fetching unit fetches a command label, a frame label and a PRP label distributed for the command issued by the host from the resource pool, and the recovery unit recovers the command label, the frame label and the PRP label distributed for the command to the resource pool under the condition that the command is overtime, namely the command is not returned all the time after being issued. Compared with the host processing command overtime in the prior art, the host overtime is avoided, the controller reset cannot be triggered, and the stability of the controller is improved. Compared with the device for detecting and processing overtime by firmware in the prior art, the device can meet various command overtime scenes, improve the efficiency of command overtime processing, simultaneously, the firmware only needs to configure overtime parameters, save firmware resources, do not need firmware interaction, and improve the performance.
The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (12)

1. A method for processing command timeout, comprising:
constructing a resource pool, wherein the resource pool is used for storing labels, and the labels comprise a command label, a frame label and a PRP label;
receiving a command issued by a host;
determining the command tag, the frame tag and the PRP tag corresponding to the command;
fetching the command tag, the frame tag, and the PRP tag allocated for the command from the resource pool;
determining whether the command times out;
and in the case of command timeout, recycling the command tag, the frame tag and the PRP tag allocated to the command into the resource pool.
2. The processing method according to claim 1, wherein the resource pool comprises a command resource pool, a frame resource pool and a PRP resource pool, the command resource pool is used for storing the command tag, the frame resource pool is used for storing the frame tag, and the PRP resource pool is used for storing the PRP tag.
3. The process of claim 1, wherein after the resource pool is built and before the host-issued command is received, the process further comprises:
initializing the resource pool.
4. The process of claim 1, wherein determining whether the command times out comprises:
acquiring the issuing time of the command;
acquiring current time;
calculating the difference value between the issuing time and the current time;
determining that the command is timed out if the difference is greater than a predetermined value;
determining that the command does not time out if the difference is less than or equal to the predetermined value.
5. The processing method according to claim 4, wherein after taking out the command tag, the frame tag, and the PRP tag allocated for the command from the resource pool, and before determining whether the command times out, the method further comprises:
and constructing an RAM (random access memory), wherein the RAM comprises a command tag RAM, a frame tag RAM and a PRP (private branch point) tag RAM, the command tag RAM is used for storing the issuing time and an effective identifier of the command, the effective identifier is used for indicating whether the command is issued, the frame tag RAM is used for storing a first corresponding relation and a second corresponding relation, the first corresponding relation is the corresponding relation between the frame tag and the command tag, the second corresponding relation is the corresponding relation between the frame tag and the PRP tag, and the PRP tag RAM is used for storing addresses in the memory corresponding to the PRP tags.
6. The processing method of claim 5, wherein obtaining the time of issuing the command comprises:
traversing the frame tag RAM;
determining the command tag corresponding to the frame tag according to the first corresponding relation;
and inquiring the issuing time of the command in the command tag RAM according to the command tag.
7. The processing method according to claim 5, wherein in case of timeout of the command, recycling the command tag, the frame tag and the PRP tag allocated to the command into the resource pool comprises:
recycling the frame tag to the resource pool;
determining the PRP label corresponding to the frame label according to the second corresponding relation;
recovering the PRP label;
determining the command tag corresponding to the frame tag according to the first corresponding relation;
and recycling the command label.
8. The processing method of claim 7, wherein the command tag corresponds to a plurality of the frame tags, and wherein recycling the command tag comprises:
and when all the plurality of frame tags corresponding to the command tag are recovered, recovering the command tag.
9. The processing method according to claim 1, characterized in that it further comprises:
setting overtime processing time;
and discarding the frame data when detecting that the frame data corresponding to the command returns in the case that all the frame tags are not collected in the timeout processing time.
10. A command timeout processing apparatus, comprising:
the system comprises a construction unit, a resource pool and a resource management unit, wherein the resource pool is used for storing labels, and the labels comprise command labels, frame labels and PRP labels;
the receiving unit is used for receiving a command issued by the host;
a first determining unit, configured to determine the command tag, the frame tag, and the PRP tag corresponding to the command;
a fetching unit, configured to fetch the command tag, the frame tag, and the PRP tag allocated to the command from the resource pool;
a second determination unit configured to determine whether the command times out;
a recycling unit, configured to recycle, to the resource pool, the command tag, the frame tag, and the PRP tag allocated to the command when the command is overtime.
11. A computer-readable storage medium, comprising a stored program, wherein the program, when executed, controls an apparatus in which the computer-readable storage medium is located to execute the command timeout processing method according to any one of claims 1 to 9.
12. A processor, characterized in that the processor is configured to execute a program, wherein the program executes the method for processing command timeout according to any one of claims 1 to 9.
CN202011086987.5A 2020-10-12 2020-10-12 Method and device for processing command timeout and computer readable storage medium Active CN112214300B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011086987.5A CN112214300B (en) 2020-10-12 2020-10-12 Method and device for processing command timeout and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011086987.5A CN112214300B (en) 2020-10-12 2020-10-12 Method and device for processing command timeout and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112214300A true CN112214300A (en) 2021-01-12
CN112214300B CN112214300B (en) 2024-05-17

Family

ID=74053594

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011086987.5A Active CN112214300B (en) 2020-10-12 2020-10-12 Method and device for processing command timeout and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112214300B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567824A (en) * 2003-06-17 2005-01-19 港湾网络有限公司 Method for distributing universal label of network node
US20090300222A1 (en) * 2008-06-02 2009-12-03 Sun Microsystems, Inc. Near zero overhead command timeout scheme
CN101707566A (en) * 2009-11-30 2010-05-12 成都市华为赛门铁克科技有限公司 Label distributing method and processing device
CN103019971A (en) * 2012-11-25 2013-04-03 向志华 Method of quickly responding to trim command, SSD (Solid State Disk) controller and system
CN104780232A (en) * 2014-01-13 2015-07-15 华为技术有限公司 A resource allocating method, controller and system
CN110088724A (en) * 2017-03-24 2019-08-02 西部数据技术公司 The system and method for adaptively fulfiling publication ahead of schedule are carried out using controller storage buffer area
CN110737540A (en) * 2019-09-29 2020-01-31 深圳忆联信息系统有限公司 Recovery optimization method, device, equipment and storage medium for SSD read exception
CN111078382A (en) * 2019-12-17 2020-04-28 中国建设银行股份有限公司 Command timeout processing method and device
CN111221476A (en) * 2020-01-08 2020-06-02 深圳忆联信息系统有限公司 Front-end command processing method and device for improving SSD performance, computer equipment and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567824A (en) * 2003-06-17 2005-01-19 港湾网络有限公司 Method for distributing universal label of network node
US20090300222A1 (en) * 2008-06-02 2009-12-03 Sun Microsystems, Inc. Near zero overhead command timeout scheme
CN101707566A (en) * 2009-11-30 2010-05-12 成都市华为赛门铁克科技有限公司 Label distributing method and processing device
CN103019971A (en) * 2012-11-25 2013-04-03 向志华 Method of quickly responding to trim command, SSD (Solid State Disk) controller and system
CN104780232A (en) * 2014-01-13 2015-07-15 华为技术有限公司 A resource allocating method, controller and system
CN110088724A (en) * 2017-03-24 2019-08-02 西部数据技术公司 The system and method for adaptively fulfiling publication ahead of schedule are carried out using controller storage buffer area
CN110737540A (en) * 2019-09-29 2020-01-31 深圳忆联信息系统有限公司 Recovery optimization method, device, equipment and storage medium for SSD read exception
CN111078382A (en) * 2019-12-17 2020-04-28 中国建设银行股份有限公司 Command timeout processing method and device
CN111221476A (en) * 2020-01-08 2020-06-02 深圳忆联信息系统有限公司 Front-end command processing method and device for improving SSD performance, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112214300B (en) 2024-05-17

Similar Documents

Publication Publication Date Title
CN109669776B (en) Detection task processing method, device and system
CN107968810B (en) Resource scheduling method, device and system for server cluster
CN111638953B (en) Method, device and storage medium for realizing GPU virtualization
CN114168490B (en) Method and related device for determining memory reclamation threshold
CN109951494B (en) Simulation data processing method and device, simulation equipment and storage medium
CN108959118B (en) Data writing method and device
CN107368367B (en) Resource allocation processing method and device and electronic equipment
CN110162396A (en) Method for recovering internal storage, device, system and storage medium
CN110647392A (en) Intelligent elastic expansion method based on container cluster
CN112306411B (en) Data storage method and device, nonvolatile storage medium and processor
CN108874688A (en) A kind of message data caching method and device
CN104104705A (en) Access method and device of distributed storage system
CN102209016B (en) Data processing method, device and data processing system
US10209905B2 (en) Reusing storage blocks of a file system
CN114070755B (en) Virtual machine network flow determination method, device, electronic equipment and storage medium
CN104679575A (en) Input and output flow control system and method
CN106571935B (en) Resource scheduling method and equipment
CN110618946A (en) Stack memory allocation method, device, equipment and storage medium
CN113595773B (en) Information processing method, device, electronic equipment and storage medium
CN105100901A (en) A virtual storage card configuration method and system
CN112214300B (en) Method and device for processing command timeout and computer readable storage medium
CN111562883B (en) Cache management system, method and device for solid state disk
WO2021227789A1 (en) Storage space allocation method and device, terminal, and computer readable storage medium
CN110825308A (en) Data space management method and device
CN118113485A (en) Task execution method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant