Data queue processing method and device

By dividing the data queue into queue groups and using mechanisms such as graph marking and timestamps for processing, it solves the problems of increased SOC area and power consumption and low scheduling efficiency in the multi-queue technology in the NVMe standard, and achieves efficient data queue processing.

CN111897665BActive Publication Date: 2024-09-27BEIJING ZETTASTONE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010773663.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-04
Publication Date
2024-09-27
Estimated Expiration
2040-08-04

AI Technical Summary

Technical Problem

In the NVMe standard, when multi-queue technology handles a large number of data queues, it causes an increase in SOC area and power consumption, and low scheduling efficiency. Existing technologies cannot effectively solve this problem.

Method used

By dividing multiple data queues into queue groups for storage and processing, ensuring that the number of each queue group does not exceed the maximum number of local storage or processors, and using mechanisms such as graph marking and timestamps for scheduling and processing, queue groups are realized. Effective and fast processing.

Benefits of technology

It improves the processing efficiency of multiple data queues, reduces the SOC area and power consumption, and solves the problems of scheduling difficulties and low efficiency in multi-queue processing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111897665B
    Figure CN111897665B
Patent Text Reader

Abstract

The present invention discloses a method and device for processing a data queue. The method comprises: obtaining a queue group to be processed sent by a memory, wherein the queue group to be processed is a queue group including a data queue to be processed, the memory is used to receive a data queue message, and generate a queue group according to a first predetermined order for the data queue corresponding to the data queue message, and when the generated queue group includes multiple queue groups, the multiple queue groups are stored according to a second predetermined order; the data queues in the queue group to be processed are processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored locally. The present invention solves the technical problems of multi-queue processing methods in related technologies, scheduling difficulties, and low efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a method and device for processing a data queue. Background Art

[0002] Among the many technologies in the NVMe standard, multi-queue technology is one of the important methods to improve performance. With the help of multi-queue technology, NVMe can allocate different queues according to tasks, scheduling priorities and CPU cores to achieve high-performance storage functions.

[0003] The related technology cannot be implemented in the case of multiple queues, such as 8K queues or even more. Especially when a doorbell pointer is more than 2Byte, multiple queues will quickly increase the SOC area and power consumption.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0005] The embodiment of the present invention provides a data queue processing method and device to at least solve the technical problems of multi-queue processing methods in related technologies, such as scheduling difficulties and low efficiency.

[0006] According to one aspect of an embodiment of the present invention, a method for processing a data queue is provided, comprising: obtaining a queue group to be processed stored in a memory, wherein the queue group to be processed is a queue group including data queues to be processed, the memory is used to receive data queue messages, and divide the data queues corresponding to the data queue messages into queue groups for storage; processing the data queues in the queue group to be processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored locally.

[0007] Optionally, before obtaining the queue group to be processed sent by the memory, it includes: determining whether the number of received data queues exceeds the maximum number of locally stored data queues; directly receiving the data queues if the number of received data queues does not exceed the maximum number of locally stored data queues; receiving the data queues through the memory if the number of received data queues exceeds the maximum number of locally stored data queues; and executing the step of obtaining the queue group to be processed stored in the memory when the data queues are received through the storage.

[0008] Optionally, obtaining the queue group to be processed sent by the memory includes: determining whether the queue group is a queue group to be processed with task processing through a first bitmap mark, wherein the queue group includes a first bitmap mark, and the first bitmap mark of the queue group to be processed with task processing is different from the first bitmap mark of the queue group without task; obtaining a data queue of the queue group to be processed through a reading interface, wherein the data structure of the queue group is the same as the data structure of the queue data stored locally.

[0009] Optionally, processing the data queue to be processed in the queue group includes: determining the data queue to be processed in the queue group through a second bitmap mark, wherein the data queue includes a second bitmap mark, and the second bitmap mark of the data queue to be processed with task processing is different from the second bitmap mark of the data queue without task; determining whether the data queue to be processed is an order-preserving queue; and when the data queue to be processed is an order-preserving queue, processing the data queue to be processed and the corresponding order-preserving data queue according to the order of the order-preserving queues.

[0010] Optionally, the method further includes: obtaining a timestamp of a data queue in the queue group; determining whether processing of the queue group has timed out based on the timestamp, and if the queue group has timed out, scheduling the queue group of the memory to perform anti-starvation processing.

[0011] Optionally, it also includes: when the data queue processing of the queue group is completed, sending the processing attribute information of the data queue of the queue group to the memory, wherein the processing attribute information includes the processing timestamp of the data queue of the queue group, and the memory determines whether the queue group has been updated during the processing according to the processing timestamp. When the data queue of the queue group has been updated during the processing, it is determined that the queue group still has tasks to be processed, and the queue group is re-added to the storage queue group in order.

[0012] According to another aspect of an embodiment of the present invention, a method for processing a data queue is also provided, including: receiving a data queue message, and dividing the data queues corresponding to the data queue message into queue groups for storage; sending the queue group to be processed to a processor, wherein the queue group to be processed is a queue group including data queues to be processed, and the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored by the processor, and the processor is used to process the queues in the queue group.

[0013] Optionally, before receiving a data queue message, the method includes: determining whether the number of received data queues exceeds the maximum number of data queues stored by the processor; and executing the step of receiving a data queue message if the number of received data queues exceeds the maximum number of data queues stored by the processor.

[0014] According to another aspect of an embodiment of the present invention, a data queue processing device is also provided, including: an acquisition module, used to acquire a queue group to be processed stored in a memory, wherein the queue group to be processed is a queue group including data queues to be processed, and the memory is used to receive data queue messages, and divide the data queues corresponding to the data queue messages into queue groups for storage; a processing module, used to process the data queues in the queue group to be processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored locally.

[0015] According to another aspect of an embodiment of the present invention, a data queue processing device is also provided, including: a storage module, used to receive data queue messages, and divide the data queues corresponding to the data queue messages into queue groups for storage; a sending module, used to send the queue group to be processed to a processor, wherein the queue group to be processed is a queue group including data queues to be processed, and the number of data queues of the queue group to be processed does not exceed the maximum number of data queues stored by the processor, and the processor is used to process the queues in the queue group.

[0016] According to another aspect of an embodiment of the present invention, a computer storage medium is further provided, wherein the computer storage medium includes a stored program, wherein when the program is executed, the device where the computer storage medium is located is controlled to execute any one of the above-mentioned data queue processing methods.

[0017] According to another aspect of an embodiment of the present invention, a processor is further provided, wherein the processor is used to run a program, wherein the program executes any one of the above-mentioned methods for processing a data queue when running.

[0018] In an embodiment of the present invention, a queue group to be processed stored in a memory is obtained, wherein the queue group to be processed is a queue group including a data queue to be processed, and the memory is used to receive a data queue message, and divide the data queues corresponding to the data queue message into queue groups for storage; the data queues in the queue group to be processed are processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of locally stored data queues, and multiple data queues are divided into queue groups for storage in the memory, and the processor processes the data queues in units of queue groups, thereby achieving the purpose of effectively and quickly processing multiple data queues, thereby achieving the technical effect of improving the efficiency of multiple data queue processing, and further solving the technical problems of multi-queue processing methods in related technologies, scheduling difficulties, and low efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0020] Figure 1 is a flow chart of a method for processing a data queue according to an embodiment of the present invention;

[0021] Figure 2 is a flowchart of another method for processing a data queue according to an embodiment of the present invention;

[0022] Figure 3 is a schematic diagram of an NVMe queue according to an embodiment of the present invention;

[0023] Figure 4 is a schematic diagram of the connection between a host and a controller according to an embodiment of the present invention;

[0024] Figure 5 is a schematic diagram of a queue and a DDR according to an embodiment of the present invention;

[0025] Figure 6 is a schematic diagram of a data structure in a DDR according to an embodiment of the present invention;

[0026] Figure 7 is a schematic diagram of sq_cq_entry / 9 of a queue according to an embodiment of the present invention;

[0027] Figure 8 is a schematic diagram of the data structure of sq_cq_info / 10 of a queue according to an embodiment of the present invention;

[0028] Fig. 9 is a schematic diagram of order_table / 11 of a queue according to an embodiment of the present invention;

[0029] Fig.10 is a schematic diagram of a queue replacement group according to an embodiment of the present invention;

[0030] Fig.11 is a schematic diagram of queue replacement group when the number of queues is small according to an embodiment of the present invention;

[0031] Fig.12 is a schematic diagram of a data queue processing device according to an embodiment of the present invention;

[0032] Fig.13 It is a schematic diagram of another data queue processing device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0033] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0034] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0035] According to an embodiment of the present invention, a method embodiment of a method for processing a data queue is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0036] Figure 1 is a flow chart of a method for processing a data queue according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0037] Step S102, obtaining a queue group to be processed stored in a memory, wherein the queue group to be processed is a queue group including a data queue to be processed, and the memory is used to receive a data queue message, and divide the data queues corresponding to the data queue message into queue groups according to a first predetermined order for storage;

[0038] Step S104, processing the data queues in the queue group to be processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of locally stored data queues.

[0039] Through the above steps, a queue group to be processed stored in a memory is obtained, wherein the queue group to be processed is a queue group including a data queue to be processed, and the memory is used to receive a data queue message, and divide the data queues corresponding to the data queue message into queue groups for storage; the data queues in the queue group to be processed are processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of locally stored data queues, and multiple data queues are divided into queue groups for storage in the memory, and the processor processes the data queues in units of queue groups, thereby achieving the purpose of effectively and quickly processing multiple data queues, thereby achieving the technical effect of improving the efficiency of multiple data queue processing, and then solving the technical problems of multi-queue processing methods in related technologies, scheduling difficulties, and low efficiency.

[0040] The above-mentioned memory may be a double data rate synchronous dynamic random access memory DDR (Double Date Rate), which is set in the controller, and the execution subject of the above-mentioned steps may be a queue module Queue in the above-mentioned controller, referred to as queue. Since the storage space of the controller used by the queue of the controller is very limited, when the number of data queues is small, it can be temporarily stored locally in the queue. However, with the development of the network, data queues with extremely large data volumes have also become a common demand. Since it is difficult for the queue to store a large number of data queues locally, a memory is set to store the data queues.

[0041] Since the memory can store a large number of data queues, when the queue needs to process the data queue, the corresponding data queue is called from the memory. However, the data queue in the memory has a large amount of data, which is inconvenient to store and read, and has low efficiency. Therefore, in this embodiment, the data queues in the memory are organized into queue groups according to the first order, and the queue groups are stored according to the second order. The queue groups here can be received and processed by the queue at one time. Therefore, the number of data queues in the queue group to be processed does not exceed the maximum number of locally stored data queues.

[0042] Usually, the number of data queues in the queue group is the maximum number of data queues that can be stored locally in the queue, so as to ensure that each time the queue group in the memory is migrated to the queue, the migration efficiency of the data queue can be achieved with the maximum efficiency, thereby further improving the processing efficiency of the data queue.

[0043] The above-mentioned data queues can be formed into queue groups according to a first order. The above-mentioned first order can be the order of storing the reception of the data queues. According to the normal processing order and the principle of first-come-first-processed, the data queues are divided into queue groups. Since the reception order of the data queues is in a sequence, there will be a sequence relationship between the composed queue groups. The sequence of the queue groups is also the second order. The queue groups are stored according to the sequence of the queue groups, which is convenient for the subsequent retrieval and migration of the queue groups, thereby improving the retrieval and migration efficiency of the data groups, thereby improving the processing efficiency of the data queues.

[0044] Optionally, before obtaining the queue group to be processed sent by the memory, it includes: determining whether the number of received data queues exceeds the maximum number of locally stored data queues; directly receiving the data queues when the number of received data queues does not exceed the maximum number of locally stored data queues; receiving the data queues through the memory when the number of received data queues exceeds the maximum number of locally stored data queues; and executing the step of obtaining the queue group to be processed stored in the memory when the data queues are received through the storage.

[0045] The host sends the data queue to be processed to the processor or memory through the network connection through the doorbell. Specifically, when the number of data queues does not exceed the maximum number of data queues stored in the processor, it is directly sent to the processor; when the number of data queues exceeds the maximum number of data queues stored in the processor, it is sent to the memory, and the processor obtains the data queue from the memory. By dividing multiple data queues into queue groups for storage in the memory, the processor processes the data queues in units of queue groups, thereby achieving the purpose of effectively and quickly processing multiple data queues, thereby achieving the technical effect of improving the efficiency of multiple data queue processing, and then solving the technical problems of multi-queue processing methods in related technologies, scheduling difficulties, and low efficiency.

[0046] Obtaining the queue group to be processed sent by the memory includes: determining whether the queue group is the queue group at the front of the sequence; if the queue group is the queue group at the front of the sequence, directly obtaining the queue group; if the queue group is not the queue group at the front of the sequence, scheduling the queue group through the scheduling module to make the queue group at the front of the queue group sequence, and obtaining the scheduled queue group.

[0047] Since the queue groups are stored in the memory in a second order of precedence, the normal reading order is also in the second order, but the queue group at the front of the second order is not necessarily in a pending state. Therefore, when the queue group is not the front queue group in the order, the queue group is scheduled by the scheduling module to make the queue group at the front of the queue group order, and the queue group after scheduling is obtained. The scheduling module can be set in the queue Queue, and the queue group can be scheduled and migrated at any time according to the needs of the queue Queue.

[0048] Optionally, obtaining the queue group to be processed sent by the memory includes: determining whether the queue group is a queue group to be processed with task processing through a first bit map mark, wherein the queue group includes a first bit map mark, and the first bit map mark of the queue group to be processed with task processing is different from the first bit map mark of the queue group without task; obtaining a data queue of the queue group to be processed through a reading interface, wherein the data structure of the queue group is the same as the data structure of the queue data stored locally.

[0049] Optionally, processing the data queue in the queue group to be processed includes: determining the data queue to be processed in the queue group through a second bitmap mark, wherein the data queue includes a second bitmap mark, and the second bitmap mark of the data queue to be processed with task processing is different from the second bitmap mark of the data queue without task; determining whether the data queue to be processed is an order-preserving queue; if the data queue to be processed is an order-preserving queue, processing the data queue to be processed and the corresponding order-preserving data queue according to the order of the order-preserving queues.

[0050] The first bitmap mark may be Qbitmap / 12, and the second bitmap mark may be Qbitmap / 8.

[0051] Before obtaining the queue group to be processed sent by the memory, the head pointer and tail pointer of multiple data queues of the queue group stored in the memory can be determined; when the values ​​of the head pointer and the tail pointer of the data queue are not equal, it is determined that the data queue has a task, and it is determined that the queue group to which the data queue belongs has a task. When the processor determines that the values ​​of the head pointer and the tail pointer of the data queue are not equal, the processor can update the second bitmap mark of the data queue to determine the data queue to be processed in the queue group. Alternatively, when the memory determines that the values ​​of the head pointer and the tail pointer of the data queue are not equal, the memory can update the first bitmap mark of the queue group to which the data queue belongs, thereby determining that the queue group is the queue group to be processed.

[0052] The above-mentioned data queue can be a submission queue, or a completion queue, wherein the completion queue is the completion information of the submission queue. Both the submission queue and the completion queue include a head pointer and a tail pointer to identify the data start and data end of the submission queue and the completion queue. When the values ​​of the head pointer and the tail pointer of the data queue are not equal, it means that there is data in the data queue, and it is determined that the data queue has a task, thereby determining that the queue group to which the data queue belongs has a task.

[0053] In an optional embodiment, some data queues are order-preserving queues, that is, data queues with order-preserving queues must be processed in the order of order-preserving. For example, the order-preserving of the first data queue and the second data queue is that the first data queue precedes the second data queue. Then, the operation must be remembered according to the request of the first data queue, and only after the operation can the second data queue be processed.

[0054] Optionally, the method further includes: obtaining a timestamp of a data queue in the queue group; determining whether the processing of the queue group has timed out according to the timestamp, and in the case of a queue group timeout, scheduling the queue group of the storage device to perform anti-starvation processing.

[0055] In the case of a queue group timeout, the queue group of the scheduling storage is processed to prevent starvation.

[0056] Optionally, it also includes: when the data queue processing of the queue group is completed, sending the processing attribute information of the data queue of the queue group to the memory, wherein the processing attribute information includes the processing timestamp of the data queue of the queue group, and the memory determines whether the queue group has been updated during the processing according to the processing timestamp. When the data queue of the queue group has been updated during the processing, it is determined that the queue group still has tasks to be processed, and the queue group is re-added to the storage queue group in order.

[0057] This ensures effective processing of the queue group and prevents untimely and incomplete processing of the data queue and omissions in data queue processing due to updates of the data queue when the queue is processing the queue group, further improving the reliability and stability of data queue processing.

[0058] Figure 2 2 is a flowchart of another method for processing a data queue according to an embodiment of the present invention. As shown in FIG. 2 , according to another aspect of the embodiment of the present invention, a method for processing a data queue is also provided, including:

[0059] Step S202, receiving a data queue message, and dividing the data queue corresponding to the data queue message into queue groups for storage;

[0060] Step S204, sending the queue group to be processed to the processor, wherein the queue group to be processed is a queue group including data queues to be processed, the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored in the processor, and the processor is used to process the queues in the queue group.

[0061] Through the above steps, a data queue message is received, and the data queues corresponding to the data queue message are divided into queue groups for storage; the queue group to be processed is sent to the processor, wherein the queue group to be processed is a queue group including the data queue to be processed, and the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored in the processor. The processor is used to process the queues in the queue group. By dividing multiple data queues into queue groups in the memory for storage, the processor processes the data queues in units of queue groups, thereby achieving the purpose of effectively and quickly processing multiple data queues, thereby achieving the technical effect of improving the efficiency of multiple data queue processing, and then solving the technical problems of multi-queue processing methods in related technologies, scheduling difficulties, and low efficiency.

[0062] The execution subject of the above steps may be the above queue.

[0063] Optionally, before receiving a data queue message, the method includes: determining whether the number of received data queues exceeds the maximum number of data queues stored by the processor; and executing the step of receiving a data queue message if the number of received data queues exceeds the maximum number of data queues stored by the processor.

[0064] It should be noted that this embodiment also provides an optional implementation, which is described in detail below.

[0065] Figure 3 is a schematic diagram of an NVMe queue according to an embodiment of the present invention. The NVMe queue of this embodiment is as follows Figure 3 As shown in the figure, the host is called Host, the central controller is CPU, and the NVMe device is called controller (hard disk, controller). The host and controller interact through the queue of shared memory.

[0066] In the latest NVMe protocol, each NVMe Controller (hard disk, controller) allows up to 65535 input and output IO queues and one user Admin queue. The user Admin queue is created immediately after the device is initialized, including a send queue and a completion queue. Other IO queues are generated by control commands sent from the user Admin queue. The IO queue relationship specified by NVMe is relatively flexible, that is, one send queue can correspond to one completion queue, or several send queues can correspond to one completion queue.

[0067] The interaction process of the data queue is as follows:

[0068] 1. The host fills in the command to the corresponding sq.tail (Submission Queue.tail) pointer position and adds 1 to the sq.tail pointer;

[0069] 2. The host tells sq (Submission Queue) the sq.tail pointer through the doorbell;

[0070] 3. The controller determines the sq.head (Submission Queue.head) pointer and the sq.tail pointer, obtains the relevant tasks, and increases the sq.tail pointer by 1;

[0071] 4. The controller completes related tasks;

[0072] 5. The controller fills in the completed task and the completed task includes sq.head information, and completes the maintenance of the cq.tail (Completion Queue.tail, completion queue tail) pointer;

[0073] 6. The controller sends relevant interrupts to the CPU;

[0074] 7. The CPU processes the related cq (Completion Queue) tasks and updates the cq.head (Completion Queue.head) pointer through the doorbell;

[0075] This implementation solves the problem of implementing multiple queues (1-64K), the difficulty in scheduling multiple queues, and the difficulty in scheduling low-priority queues. On-chip resources can be used for fast access and high-frequency access.

[0076] Advanced on-chip storage solutions facilitate the concurrency and order preservation of multiple instructions and commands. The on-chip CPU can easily access sq / cq information, making error management and reporting easier.

[0077] Tasks in a queue can be executed in order or out of order, and returned in order or out of order. Tasks between different queues can be executed out of order. This can increase concurrency and solve system performance delay and throughput issues.

[0078] Figure 4 Schematic diagram of the connection between the host and the controller according to an embodiment of the present invention. Figure 4 As shown, the host updates SQyTDBL (Submission Queue y Tail Doorbell) and CQyHDBL (Completion Queue y Head Doorbell) through the network connection interconnect / 7. The controller selects these doorbells according to the queue mode and updates them to the queue or DDR (Double Date Rate), and records the updated timestamp.

[0079] There are 4 srams (Static Random Access Memory) / 1 / 2 / 3 / 4 or space sq / cq_dbl / 15 in the queue or DDR, corresponding to sq.head / sq.tail / cq.head / cq.tail. When sq.head and sq.tail are not equal, it means that this queue has tasks, and the corresponding bitmap / 8 / 12 is set. The queue will process the tasks of the sq queue by polling the weights of different queues.

[0080] Sq_cq_entry / 9 stores the original content of the response sq_command (submit command) and cq_command (complete command), and connects to the network connection interconnect / 7 through slv / 7, so that the software can query the CPU / 18 or the related accelerator ACC / 19 to query the original command. Among them, each data stream entry of sq_cq_entry / 9 has a unique number for easy indexing.

[0081] The submission queue / completion queue information Sq / cq_info / 10 will store queue related information, including but not limited to QoS (Quality of Service), queue base address, queue depth, queue interruption, the correspondence between sq and cq, whether the queue physical address is continuous, the current queue status, etc.

[0082] The command table Order_table / 11 stores information about commands that need to be ordered, including but not limited to which command to order, execution status, etc. The order-preserving queue has an order-preserving depth. If the order-preserving queue is full, it will affect the execution of the queue.

[0083] Sq / cq_info / 14 and the doorbell sq / cq_dbl / 15 of the submission queue / completion queue can be mapped to the on-chip related units 1 / 2 / 3 / 4 / 10. How to replace the on-chip resources can be set according to the grouping weight or aging, which is convenient for system scheduling.

[0084] Figure 5 is a schematic diagram of a queue and a DDR according to an embodiment of the present invention, such as Figure 5 As shown, the data structure of sram / 1 / 2 / 3 / 4 in the queue includes but is not limited to splitting the 1 / 2 / 3 / 4 combination into one or more SRAMs (Static Random Access Memory). sqt represents sq.tail, sqh represents sq.head, cqh represents cq.head, and cqt represents cq.tail. sqt and cqh are maintained by the host, and sqh and cqt are maintained by the hardware. Bitmap 8 indicates whether the relevant queue has a task.

[0085] According to the NVMe protocol, cqt / cqh / sqh / sqt in the queue only require 2 bytes respectively. The size of the doorbell can be reasonably allocated according to the on-chip resources. For example, if the chip supports 512 data queues, 512*4*2=4Kbyte is required. The above on-chip resources are also the storage resources of the queue of the controller.

[0086] In DDR, CAP.DSTRD is configured according to the minimum granularity of DDR write at one time, that is, it is necessary to ensure that DDR does not generate strobe writes, thereby ensuring the efficiency of DDR.

[0087] Since the bit width of the network connection interconnect / 7 is generally an integer multiple of 8B, it is convenient to map the resources of DDR and queue. That is, it is very convenient to take out the information of the next 512 queues from DDR to replace the information in the queue on the chip, so as to realize the scheduling of multiple data queues.

[0088] Figure 6 Schematic diagram of the data structure in DDR according to an embodiment of the present invention. Figure 6 As shown, the doorbell space of DDR can be grouped according to the doorbell resources on the queue, for example, 512 doorbells per group. Each group of doorbells has a timestamp register to record the time when the current CPU is updated. Among them, the bitmap qbitmap / 12 corresponds to the group. When the queue is replaced, the queue group is grouped as a unit, and the time when the replacement occurs is recorded. When the queue is replaced next time, the timestamp of the local load and the timestamp of the CPU update are compared. If the timestamp of the CPU is greater than the timestamp of the local load, the host has updated the doorbell again. At this time, the bitmap qbitmap / 12 mark of the queue group cannot be changed.

[0089] Figure 7 is a schematic diagram of sq_cq_entry / 9 of a queue according to an embodiment of the present invention, such as Figure 7 As shown, the depth of sq_cq_entry / 9 should meet the needs of ACC / 19 and CPU / 18, for example, the depth is 64. The scheduling of tasks needs to support rr / wrr / user customization. The replacement mechanism of the queue group Group can be but is not limited to the following three:

[0090] 1. Fixed scheduling of certain tasks;

[0091] 2. Timeout switching;

[0092] 3. After all tasks are scheduled, automatically switch to the next group;

[0093] The scheduling mechanisms within a queue group include but are not limited to the following three:

[0094] 1. Rr scheduling;

[0095] 2.Wrr scheduling;

[0096] 3. According to the timestamp information in sq / cq_info / 10, if a timeout occurs, scheduling must be performed to prevent starvation;

[0097] Each sq and cq pair has an instruction address command_id, which is used to mark the unique address of the instruction command. If cpu / 18 or ACC / 19 has a task, it can apply for the instruction address command_id and issue an instruction command through slv / 6.

[0098] Sq_cq_entry / 9 obtains the corresponding sq_command submission queue instruction information through mst / 5, and completes the cq_command completion queue instruction information according to sq / cq_info / 10.

[0099] Among them, the contents of the sq_command submission queue instruction and the cq_command completion queue instruction are consistent with those specified by NVMe.

[0100] Figure 8 is a schematic diagram of the data structure of sq_cq_info / 10 of a queue according to an embodiment of the present invention, such as Figure 8 The data structure of sq_cq_info / 10 is shown below, including but not limited to the following data:

[0101] sq_base_addr: base address of sq queue;

[0102] current_saddr: When the physical address of the sq queue is non-continuous, the physical address of the command processed by the current generation;

[0103] qsize: the size of the sq queue;

[0104] qid: queue number;

[0105] cqid: the completion queue corresponding to the current queue;

[0106] priority / pc: whether the priority / physical address of the current queue is continuous;

[0107] timestamp: the time when the current queue was last processed;

[0108] queue_enable: queue enable;

[0109] abort_command: There are tasks to be canceled in the current queue, and the admin queue needs to be queried;

[0110] abuse: The previous task in the current queue needs to maintain order;

[0111] delete: The queue is being deleted;

[0112] current_caddr: the physical address of the current command of the cq queue;

[0113] ien: interrupt enable;

[0114] interrupt: interrupt vector;

[0115] Fig. 9 is a schematic diagram of order_table / 11 of a queue according to an embodiment of the present invention, such as Fig. 9 As shown, the depth of order_table / 11 should be set according to the number of order-preserving tasks required, for example, 8 order-preserving depths. Each order-preserving queue needs to store information such as sq_num (submission queue number) / sqid (submission queue address) / command_id (submission queue instruction). When the execution unit completes an instruction command and the instruction command is an order-preserving task, the instruction address command_id needs to be updated, and order_table / 11 releases the next instruction command or writes back the completion status of the order-preserving queue according to the instruction address command_id.

[0116] Fig.10 is a schematic diagram of a queue replacement group according to an embodiment of the present invention, such as Fig.10 As shown, the mechanism for replacing group is:

[0117] 1. The queue bitmap Qbitmap

[12] (queue bitmap) notifies the queue queue which queue group group has tasks through hard wiring. Among them, the hard wiring 1004 can set the cycle multicycle;

[0118] 2. Different queue groups can be polled through rr / wrr;

[0119] 3. Queue Queue / 1001 sends the address of the corresponding queue group group according to the polling result and updates the relevant information of the queue group group;

[0120] 4. Save the queue group number group_num / 1003 and load time load_time / 1002 at the same time;

[0121] 5. Queue takes the command command of the current queue group group to complete the task until the condition for exiting the queue group group is met;

[0122] 6. Queue Queue updates the queue group number group_num / 1003 and load time load_time / 1002 to DDR through 1008 through the write command;

[0123] 7. DDR compares the current queue group group and timestamp timestamp. If it is found that the host host has been updated during the queue processing, the information of the queue bitmap qbitmap / 12 cannot be changed, that is, the current queue group group still has tasks to be done;

[0124] 8. Queue takes the next queue group group;

[0125] Fig.11 is a schematic diagram of queue replacement group when the number of queues is small according to an embodiment of the present invention, such as Fig.11 As shown, when the number of queues required is small, all queue information can be directly saved on the system on chip SoC (System on Chip). Through the multiplexer mux selection, the update updata information of the host host is all updated on the SoC to realize the fast mode of the queue. The above-mentioned system on chip SoC can be the system on chip of the controller controller.

[0126] This implementation has the following key points:

[0127] 1. Can support 1 to 65536 queues;

[0128] 2. QoS scheduling of different queues can be performed according to task requirements;

[0129] 3. It has a mechanism to prevent starvation, and every task has a chance to be executed;

[0130] 4. Divide the queues into queue groups to minimize on-chip and DDR resources and facilitate replacement by queue group;

[0131] 5. Divide the queues into queue groups and follow the secondary scheduling to optimize resources and obtain ideal scheduling results. The logic is simple and easy to implement.

[0132] 6. On-chip resources and DDR resources have the same data structure, which is convenient for direct replacement and easy to implement;

[0133] 7. On-chip bitmap / 8 implementation mechanism and DDR bitmap / 12 mechanism and data structure according to the queue group mechanism;

[0134] 8. Sq / cq_info / 10 and sq / cq_info / 14 have the same data structure and related contents;

[0135] 9. Data conversion of Sq / cq_doorbell / 1 / 2 / 3 / 4 / 15 ensures DDR efficiency while facilitating Queue and DDR sharing;

[0136] 10. Reasonable CAP.DSTRD ensures the maximum execution efficiency of DDR;

[0137] 11. Timestamp mechanism, that is, recording the time when the task is updated on the host and the time when the on-chip resources are exchanged, to ensure that the task is not lost;

[0138] 12. CPU can directly access sq / cq_entry to facilitate task management;

[0139] 13. Different commands can be executed out of order or in order without affecting the concurrency of the task;

[0140] 14. It can support fast working mode, that is, when the task queue is small, directly use the on-chip resources.

[0141] This implementation can realize any number of queues (1-64K), different queues can be scheduled in a wrr / rr / user defined manner, and an active anti-starvation mechanism can effectively manage multiple queues.

[0142] Multitasking can achieve disorder or order preservation, and multiple tasks can work simultaneously, providing excellent performance while also taking into account the area and implementation difficulty.

[0143] The queue group mechanism and the queue group mechanism to prevent task loss can ensure the safe and stable operation of the system, and each task has the opportunity to participate in the scheduling. Replacing by queue group can effectively save resources and implementation difficulty, while achieving relatively good power consumption.

[0144] DDR provides relevant information (task, timestamp) according to queue groups, which effectively saves implementation resources and avoids the difficulty of queue and DDR interaction. It is convenient for implementation and can also provide excellent performance.

[0145] The host writes the doorbell information directly into DDR or queue, which can be selected as needed. When there are fewer queues, relatively excellent performance and low power consumption are obtained.

[0146] Fig.12is a schematic diagram of a data queue processing device according to an embodiment of the present invention, such as Fig.12 As shown, according to another aspect of an embodiment of the present invention, a data queue processing device is provided, including: an acquisition module 1202 and a processing module 1204. The device is described in detail below.

[0147] An acquisition module 1202 is used to acquire a queue group to be processed stored in a memory, wherein the queue group to be processed is a queue group including data queues to be processed, and the memory is used to receive data queue messages and divide the data queues corresponding to the data queue messages into queue groups for storage; a processing module 1204 is connected to the above-mentioned acquisition module 1202, and is used to process the data queues in the queue group to be processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored locally.

[0148] Through the above-mentioned device, an acquisition module 1202 is used to acquire a queue group to be processed stored in a memory, wherein the queue group to be processed is a queue group including a data queue to be processed, and the memory is used to receive a data queue message, and divide the data queues corresponding to the data queue message into queue groups for storage; the processing module 1204 processes the data queues in the queue group to be processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of locally stored data queues, and multiple data queues are divided into queue groups for storage in the memory, and the processor processes the data queues in units of queue groups, thereby achieving the purpose of effectively and quickly processing multiple data queues, thereby achieving the technical effect of improving the efficiency of multiple data queue processing, and then solving the technical problems of multi-queue processing methods in related technologies, scheduling difficulties, and low efficiency.

[0149] Fig.13 is a schematic diagram of another data queue processing device according to an embodiment of the present invention, such as Fig.13 As shown, according to another aspect of an embodiment of the present invention, a data queue processing device is provided, including: a storage module 1302 and a sending module 1304. The device is described in detail below.

[0150] The storage module 1302 is used to receive data queue messages and divide the data queues corresponding to the data queue messages into queue groups for storage; the sending module 1304 is connected to the above-mentioned storage module 1302, and is used to send the queue group to be processed to the processor, wherein the queue group to be processed is a queue group including data queues to be processed, and the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored in the processor, and the processor is used to process the queues in the queue group.

[0151] Through the above-mentioned device, a storage module 1302 is used to receive data queue messages, and the data queues corresponding to the data queue messages are divided into queue groups for storage; the sending module 1304 sends the queue group to be processed to the processor, wherein the queue group to be processed is a queue group including data queues to be processed, and the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored in the processor. The processor is used to process the queues in the queue group. By dividing multiple data queues into queue groups in the memory for storage, the processor processes the data queues in units of queue groups, thereby achieving the purpose of effectively and quickly processing multiple data queues, thereby achieving the technical effect of improving the efficiency of multi-data queue processing, and then solving the technical problems of multi-queue processing methods in related technologies, scheduling difficulties, and low efficiency.

[0152] According to another aspect of an embodiment of the present invention, a computer storage medium is provided, the computer storage medium including a stored program, wherein when the program is running, the device where the computer storage medium is located is controlled to execute any one of the above-mentioned data queue processing methods.

[0153] According to another aspect of an embodiment of the present invention, a processor is provided, and the processor is used to run a program, wherein any one of the above-mentioned data queue processing methods is executed when the program is run.

[0154] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0155] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0156] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0157] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0158] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0159] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0160] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for processing a data queue, characterized in that: include: Acquire a queue group to be processed stored in a memory, wherein the queue group to be processed is a queue group including a data queue to be processed, the memory is used to receive a data queue message, and divide the data queues corresponding to the data queue message into queue groups for storage, wherein the data queues are formed into queue groups according to a first order, and the queue groups are stored according to a second order; Processing the data queues in the queue group to be processed, wherein the number of the data queues in the queue group to be processed does not exceed the maximum number of the locally stored data queues; Wherein, processing the data queues in the queue group to be processed includes: Determine the data queue to be processed in the queue group by a second bitmap mark, wherein the data queue includes a second bitmap mark, and the second bitmap mark of the data queue to be processed with task processing is different from the second bitmap mark of the data queue without task processing; Determine whether the data queue to be processed is an order-preserving queue; In the case where the data queue to be processed is an order-preserving queue, the data queue to be processed and the corresponding order-preserving data queue are processed according to the order of the order-preserving queues; Wherein, obtaining the queue group to be processed sent by the storage includes: In a case where the queue group to be processed is the queue group ranked first in the second sequence, obtaining the queue group to be processed; In a case where the queue group to be processed is not the queue group ranked first in the second sequence, scheduling the queue group to be processed to the queue group ranked first in the second sequence, and acquiring the queue group to be processed; Before getting the queue group to be processed sent by the memory, include: Determine the head pointer and the tail pointer of a plurality of data queues of the queue group stored in the memory; When the value of the head pointer is not equal to the value of the tail pointer, determining that there is a task in the data queue, and updating the second bitmap mark of the data queue to determine that there is a data queue to be processed in the queue group where the data queue is located; or When the value of the head pointer is not equal to the value of the tail pointer, the first bitmap mark of the queue group where the data queue is located is updated to determine that there is a queue group to be processed in the queue group.

2. The method according to claim 1, characterized in that Before obtaining the queue group to be processed sent by the storage, include: Determine whether the number of received data queues exceeds the maximum number of local storage data queues; When the number of the received data queues does not exceed the maximum number of the locally stored data queues, directly receiving the data queues; In the case where the number of the received data queues exceeds the maximum number of locally stored data queues, the data queues are received through the memory; in the case where the data queues are received through the memory, the step of acquiring the queue group to be processed stored in the memory is performed.

3. The method according to claim 1, characterized in that The queue groups to be processed by the acquisition storage include: Determine whether the queue group is a queue group to be processed with a task to be processed by using a first bitmap mark, wherein the queue group includes a first bitmap mark, and the first bitmap mark of the queue group to be processed with a task to be processed is different from the first bitmap mark of the queue group without a task; The data queue of the queue group to be processed is obtained through a reading interface, wherein the data structure of the queue group is the same as the data structure of the queue data stored locally.

4. The method according to claim 1, characterized in that: Also includes: Get the timestamp of the data queue in the queue group; Determine whether processing of the queue group has timed out according to the timestamp, and in the case of timeout of the queue group, schedule the queue group of the memory to perform anti-starvation processing.

5. The method according to claim 1, characterized in that Also includes: When the data queue processing of the queue group is completed, the processing attribute information of the data queue of the queue group is sent to the memory, wherein the processing attribute information includes the processing timestamp of the data queue of the queue group, and the memory determines whether the queue group has been updated during the processing according to the processing timestamp. When the data queue of the queue group has been updated during the processing, it is determined that the queue group still has tasks to be processed, and the queue group is re-added to the storage queue group in order.

6. A method for processing a data queue, characterized in that: include: receiving a data queue message, and dividing the data queues corresponding to the data queue message into queue groups for storage, wherein the data queues are organized into queue groups according to a first order, and the queue groups are stored according to a second order; Sending a queue group to be processed to a processor, wherein the queue group to be processed is a queue group including data queues to be processed, the number of data queues in the queue group to be processed does not exceed the maximum number of data queues stored by the processor, and the processor is used to process the queues in the queue group; The processing of the queues in the queue group includes: Determine the data queue to be processed in the queue group by a second bitmap mark, wherein the data queue includes a second bitmap mark, and the second bitmap mark of the data queue to be processed with task processing is different from the second bitmap mark of the data queue without task processing; Determine whether the data queue to be processed is an order-preserving queue; In the case where the data queue to be processed is an order-preserving queue, the data queue to be processed and the corresponding order-preserving data queue are processed according to the order of the order-preserving queues; The queue group to be processed is determined by the following steps: In a case where the queue group to be processed is the queue group ranked first in the second sequence, obtaining the queue group to be processed; In a case where the queue group to be processed is not the queue group ranked first in the second sequence, scheduling the queue group to be processed to the queue group ranked first in the second sequence, and acquiring the queue group to be processed; Before sending a queue group to be processed to the processor, include: Determine the head pointer and tail pointer of multiple data queues of the queue group; When the value of the head pointer is not equal to the value of the tail pointer, determining that there is a task in the data queue, and updating the second bitmap mark of the data queue to determine that there is a data queue to be processed in the queue group where the data queue is located; or When the value of the head pointer is not equal to the value of the tail pointer, the first bitmap mark of the queue group where the data queue is located is updated to determine that there is a queue group to be processed in the queue group.

7. The method according to claim 6, characterized in that Before receiving a data queue message, include: Determining whether the number of received data queues exceeds the maximum number of data queues stored by the processor; In a case where the number of the received data queues exceeds the maximum number of the data queues stored by the processor, the step of receiving data queue messages is performed.

8. A data queue processing device, characterized in that: include: an acquisition module, configured to acquire a queue group to be processed stored in a memory, wherein the queue group to be processed is a queue group including a data queue to be processed, the memory is configured to receive a data queue message, and divide the data queues corresponding to the data queue message into queue groups for storage, wherein the data queues are organized into queue groups according to a first order, and the queue groups are stored according to a second order; A processing module, used for processing the data queues in the queue group to be processed, wherein the number of data queues in the queue group to be processed does not exceed the maximum number of locally stored data queues; Wherein, the processing module is further used to determine the data queue to be processed in the queue group through the second bitmap mark, wherein the data queue includes a second bitmap mark, and the second bitmap mark of the data queue to be processed with task processing is different from the second bitmap mark of the data queue without task; determine whether the data queue to be processed is an order-preserving queue; if the data queue to be processed is an order-preserving queue, process the data queue to be processed and the corresponding order-preserving data queue according to the order of the order-preserving queue; The acquisition module is further used for, when the queue group to be processed is the queue group ranked first in the second sequence, acquiring the queue group to be processed; when the queue group to be processed is not the queue group ranked first in the second sequence, scheduling the queue group to be processed to the queue group ranked first in the second sequence, and acquiring the queue group to be processed; The device is also used to determine the head pointer and tail pointer of multiple data queues of the queue group stored in the memory; when the value of the head pointer and the value of the tail pointer are not equal, it is determined that there is a task in the data queue, and the second bitmap mark of the data queue is updated to determine that there is a data queue to be processed in the queue group where the data queue is located; or when the value of the head pointer and the value of the tail pointer are not equal, the first bitmap mark of the queue group where the data queue is located is updated to determine that there is a queue group to be processed in the queue group.

9. A data queue processing device, characterized in that: include: A storage module, used for receiving a data queue message, and dividing the data queues corresponding to the data queue message into queue groups for storage, wherein the data queues are organized into queue groups according to a first order, and the queue groups are stored according to a second order; a sending module, configured to send a queue group to be processed to a processor, wherein the queue group to be processed is a queue group including data queues to be processed, the number of data queues of the queue group to be processed does not exceed the maximum number of data queues stored by the processor, and the processor is configured to process the queues in the queue group; Wherein, the sending module is also used to determine the data queue to be processed in the queue group through the second bitmap mark, wherein the data queue includes a second bitmap mark, and the second bitmap mark of the data queue to be processed with task processing is different from the second bitmap mark of the data queue without task; determine whether the data queue to be processed is an order-preserving queue; if the data queue to be processed is an order-preserving queue, process the data queue to be processed and the corresponding order-preserving data queue according to the order of the order-preserving queue; The sending module is further used for, when the queue group to be processed is the queue group ranked first in the second sequence, obtaining the queue group to be processed; when the queue group to be processed is not the queue group ranked first in the second sequence, scheduling the queue group to be processed to the queue group ranked first in the second sequence, and obtaining the queue group to be processed; The device is also used to determine the head pointer and tail pointer of multiple data queues of the queue group stored in the memory; when the value of the head pointer and the value of the tail pointer are not equal, it is determined that there is a task in the data queue, and the second bitmap mark of the data queue is updated to determine that there is a data queue to be processed in the queue group where the data queue is located; or when the value of the head pointer and the value of the tail pointer are not equal, the first bitmap mark of the queue group where the data queue is located is updated to determine that there is a queue group to be processed in the queue group.