Queue processing method and device, server, electronic equipment and storage medium
By setting a backpressure mechanism in the NVMe protocol and using a backpressure enable identifier and preset threshold to control the queue state, the IO timeout problem when the CQ is full under high pressure in the NVMe protocol is solved, and the data read and write efficiency is improved.
Patent Information
- Application Number
- CN202310146480.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-21
- Publication Date
- 2026-01-27
- Estimated Expiration
- 2043-02-21
AI Technical Summary
Under high-pressure I/O scenarios, the NVMe protocol's CQ may be in a "full" state, causing the storage device to be unable to place the completion message into the completion queue in a timely manner, resulting in I/O timeout errors. The existing retransmission mechanism cannot effectively solve the data read/write timeout problem under high pressure.
By obtaining the backpressure enable identifier, the number of free entries in the current completion queue, and the preset backpressure threshold, the control register corresponding to the submission queue is set to unreadable, preventing the storage device from obtaining new data read/write commands and providing buffer time until the completion message is placed in the completion queue.
It effectively prevents data read/write timeout errors, reduces queue processing steps, improves data read/write efficiency, eliminates the need for retransmission mechanisms, and ensures that the host device receives the completion message in a timely manner.
Smart Images

Figure CN116149559B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of server technology, and more specifically, to a queue processing method, apparatus, server, electronic device, and storage medium. Background Technology
[0002] As the industry's demands for storage device performance continue to increase, NVMe (NonVolatile Memory express) SSDs (Solid State Drives), with their superior read and write performance, are becoming the mainstream storage devices. NVMe SSDs utilize the NVMe protocol specification. NVMe is not merely a logical protocol interface, but also a command standard and a specified protocol. In this protocol, storage devices interact with host devices via SQ (Submission Queue), CQ (Completion Queue), and DB (Doorbell). Simply put, the host device places prepared commands in the SQ and notifies the storage device to retrieve the command from the SQ via the DB; after processing the command, the storage device places a completion message in the CQ and informs the host device via the DB that the command processing is complete.
[0003] To achieve faster processing speeds and higher data throughput, the NVMe protocol supports a queue size of 64K (the upper limit supported by the protocol) and a queue depth of 64K. The number and depth of queues can be flexibly configured by the host device via commands. When the SSD is under high-pressure IO (Input Output, Data Read / Write) scenarios, the CQ may be in a "full" state. In this case, the storage device cannot place completion messages into the CQ. If the host device does not receive the command completion message for a long time, an IO timeout error will occur.
[0004] To address this issue, the industry typically uses a resend mechanism to resend previously unsent commands when available space in the CQ (Customer Queues). However, in high-pressure business scenarios, a large number of commands need to be resent, which cannot effectively solve the technical problem of data read / write timeouts. Summary of the Invention
[0005] This application provides a queue processing method, apparatus, server, electronic device, and storage medium to solve the technical problem of data read / write timeout errors in the prior art.
[0006] This application provides a queue processing method, including:
[0007] Obtain the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue;
[0008] When the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to unreadable.
[0009] The read / write status of the control register corresponding to the submission queue is used to control the storage device to obtain data read / write commands issued by the host device from the submission queue.
[0010] According to a queue processing method provided in this application, before obtaining the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue, the method includes:
[0011] Based on the number of data read / write commands processed simultaneously by the storage device and / or the queue depth of the current completion queue, a preset backpressure threshold corresponding to the current completion queue is determined;
[0012] Write the preset backpressure threshold corresponding to the current completion queue into the first control register corresponding to the current completion queue.
[0013] According to a queue processing method provided in this application, after writing the preset backpressure threshold corresponding to the currently completed queue into the first control register corresponding to the currently completed queue, the method includes:
[0014] Based on the queue creation information in the host device, determine the submission queue corresponding to the currently completed queue;
[0015] Obtain the queue identifier of the submission queue;
[0016] Write the queue identifier of the submission queue into the second control register corresponding to the currently completed queue.
[0017] According to a queue processing method provided in this application, after writing the queue identifier of the submission queue into the second control register corresponding to the currently completed queue, the method includes:
[0018] Set the backpressure enable identifier to true and write the backpressure enable identifier to the completion queue management control register.
[0019] According to a queue processing method provided in this application, setting the read / write state of the control register corresponding to the submission queue corresponding to the currently completed queue to unreadable includes:
[0020] Based on the second control register corresponding to the current completion queue, obtain the queue identifier of the submission queue corresponding to the current completion queue;
[0021] Based on the queue identifier of the submission queue corresponding to the current completed queue, the control register corresponding to the submission queue is determined, and the read / write status of the control register corresponding to the submission queue is set to unreadable.
[0022] According to a queue processing method provided in this application, after obtaining the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue, the method includes:
[0023] If the backpressure enable identifier is false or the number of idle entries is greater than or equal to the preset backpressure threshold, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to readable, so that the storage device can obtain the data read / write command issued by the host device from the submission queue.
[0024] According to a queue processing method provided in this application
[0025] This application also provides a queue processing apparatus, including:
[0026] The acquisition unit is used to acquire the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue;
[0027] The processing unit is configured to set the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue to unreadable when the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold.
[0028] The read / write status of the control register corresponding to the submission queue is used to control the storage device to obtain data read / write commands issued by the host device from the submission queue.
[0029] This application also provides a server, including a processor;
[0030] The processor is equipped with the aforementioned queue processing device.
[0031] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the queue processing methods described above.
[0032] This application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the queue processing method as described above.
[0033] The queue processing method, apparatus, server, electronic device, and storage medium provided in this application can identify whether the host device has issued a command to enable backpressure by obtaining a backpressure enable identifier; by obtaining the number of free entries in the current completion queue and the preset backpressure threshold corresponding to the current completion queue, the occupancy status of the entries in the current completion queue can be determined; when the backpressure enable identifier is true and the number of free entries is less than the preset backpressure threshold, that is, when there is a possibility that the entries in the current completion queue are about to be completely occupied by completion messages, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to unreadable, which can prevent the storage device from obtaining new data read / write commands from the submission queue, providing buffer time for the storage device and the submission queue. After the storage device finishes processing the data read / write command, it can promptly place the completion message into the completion queue, and also enable the host device to receive the command completion message in a timely manner, preventing data read / write timeout errors. The queue processing method provided in this application embodiment does not require the use of a retransmission mechanism to retransmit unsent commands, reducing the operation steps of queue processing and improving the efficiency of data read / write. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is one of the flowcharts of the queue processing method provided in this application;
[0036] Figure 2 This is the second flowchart of the queue processing method provided in this application;
[0037] Figure 3 This is a schematic diagram of the queue processing device provided in this application;
[0038] Figure 4 This is a schematic diagram of the server structure provided in this application;
[0039] Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0040] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0041] It should be noted that the terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0042] Figure 1 This is one of the flowcharts illustrating the queue processing method provided in this application, such as... Figure 1 As shown, the method includes steps 110 and 120.
[0043] Step 110: Obtain the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue.
[0044] Specifically, the execution subject of the queue processing method provided in this application embodiment is a queue processing device, which can be a hardware device independently set in the host device or a software program running in the host device.
[0045] The backpressure enable identifier is a symbol used to determine whether backpressure is applied to the storage device's operations of retrieving data read and write commands. Backpressure occurs when the storage device's processing rate of data read and write commands cannot keep up with the rate at which the host device sends data read and write commands. Therefore, it is necessary to restrict the storage device's retrieval of data read and write commands, i.e., prevent the storage device from retrieving data read and write commands issued by the host device from the submission queue.
[0046] For example, the backpressure enable identifier can be "TURE" or "FALSE". If the backpressure enable identifier is "TURE", it means that the host device has issued a command to enable backpressure. The queue processing device will judge the current system environment to determine whether to perform backpressure on the operation of data read and write commands to the storage device. If the backpressure enable identifier is "FALSE", it means that the host device has not issued a command to enable backpressure. The queue processing device will not perform backpressure on the operation of data read and write commands to the storage device.
[0047] The number of free entries represents the number of data read / write command completion messages that the current completion queue can still receive from the storage device. The completion queue contains multiple entries, with one command potentially occupying one entry. Fewer free entries indicate higher processing pressure on the storage device; more free entries indicate lower processing pressure.
[0048] For example, if the completion queue contains 10 entries, and 4 entries in the current completion queue have been occupied by the completion messages of data read / write commands, leaving 6 entries unoccupied, then these 6 entries are free entries, and the number of free entries is 6.
[0049] The preset backpressure threshold is used to determine whether the storage device continues to obtain data read and write commands from the commit queue corresponding to the current completion queue.
[0050] If the number of free entries is less than the preset backpressure threshold, meaning that many entries in the current completion queue have been occupied by completion messages of data read / write commands, in order to prevent the current completion queue from being completely occupied by completion messages, thus preventing the current completion queue from becoming blocked, the queue processing device can apply backpressure to the operation of retrieving data read / write commands from the storage device. If the number of free entries is greater than or equal to the preset backpressure threshold, meaning that there are many entries in the current completion queue that have not been occupied by completion messages, in order to improve the efficiency of data read / write, the queue processing device may not apply backpressure to the operation of retrieving data read / write commands from the storage device.
[0051] The queue processing device can apply backpressure to data read / write commands from the storage device by obtaining the backpressure enable identifier, the number of free entries in the currently completed queue, and the preset backpressure threshold corresponding to the currently completed queue.
[0052] Step 120: When the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold, set the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue to unreadable.
[0053] The read / write status of the control register corresponding to the submission queue is used to control the storage device to obtain data read / write commands issued by the host device from the submission queue.
[0054] Specifically, the storage device in this application embodiment can be a solid-state drive using the NVMe protocol specification.
[0055] The host device can be various electronic devices, including but not limited to smartphones, tablets, laptops, desktop computers, and servers. The host device can connect to the storage device through an interface and read and write data on the storage device.
[0056] The control register corresponding to the submission queue is used to instruct the storage device to retrieve data read / write commands from the submission queue.
[0057] The read / write status of the control register corresponding to the submission queue includes readable and unreadable. If the read / write status is readable, the storage device can obtain data read / write commands for the submission queue through the control register; if the read / write status is unreadable, the storage device cannot obtain data read / write commands for the submission queue through the control register.
[0058] The mapping between commit queues and completion queues can be configured according to specific circumstances. For example, one commit queue can correspond to one completion queue; or multiple commit queues can correspond to one completion queue.
[0059] When the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold, the queue processing device sets the read / write status of the control register corresponding to the submission queue of the currently completed queue to unreadable. At this time, the storage device cannot obtain data read / write commands from the submission queue.
[0060] The queue processing method provided in this application can identify whether the host device has issued a command to enable backpressure by obtaining a backpressure enable identifier; it can determine the occupancy status of the current completion queue by obtaining the number of free entries in the current completion queue and the preset backpressure threshold corresponding to the current completion queue; when the backpressure enable identifier is true and the number of free entries is less than the preset backpressure threshold, that is, when there is a possibility that the entries in the current completion queue are about to be completely occupied by completion messages, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to unreadable, which can prevent the storage device from obtaining new data read / write commands from the submission queue, providing buffer time for the storage device and the submission queue. After the storage device finishes processing the data read / write command, it can promptly place the completion message into the completion queue, and also enable the host device to receive the command completion message in a timely manner, preventing data read / write timeout errors. It eliminates the need to use a retransmission mechanism to retransmit unsent commands, reduces the number of queue processing steps, and improves the efficiency of data read / write.
[0061] Based on the above embodiments, the method further includes the following steps before step 110:
[0062] Based on the number of data read / write commands processed simultaneously by the storage device and / or the queue depth of the current completion queue, determine the preset backpressure threshold corresponding to the current completion queue;
[0063] Write the preset backpressure threshold corresponding to the current completion queue into the first control register corresponding to the current completion queue.
[0064] Specifically, the number of data read / write commands that a storage device can process simultaneously is the maximum number of data read / write commands that the current storage device can process simultaneously.
[0065] The preset backpressure threshold should not be set too high or too low. If the preset backpressure threshold is set too high, it will reduce the data read and write efficiency of the host device; or if the preset backpressure threshold is set too low, it will not be able to solve the technical problem of data read and write timeout.
[0066] The preset backpressure threshold corresponding to the current completion queue can be determined based on the number of data read / write commands that the storage device can process simultaneously and / or the queue depth of the current completion queue.
[0067] For example, if a storage device processes 10 data read / write commands simultaneously, the preset backpressure threshold is 6, and the number of free entries in the current completion queue is 7, then the number of free entries in the current completion queue exceeds the preset backpressure threshold, and the queue processing device will not apply backpressure during queue processing. If the storage device processes 10 data read / write commands simultaneously and prepares to place the completion messages of all 10 commands into the current completion queue at the same time, but the number of free entries in the current completion queue does not support placing the completion messages of all 10 data read / write commands, the queue processing device will issue an alarm. Therefore, if the preset backpressure threshold is less than the number of data read / write commands the storage device processes simultaneously, the risk of the queue processing device issuing an alarm is relatively high.
[0068] For example, if the storage device processes 5 data read / write commands simultaneously, the preset backpressure threshold is 15, and the number of idle entries in the current completion queue is 10, then the number of idle entries in the current completion queue is less than the preset backpressure threshold. The queue processing device will apply backpressure during the queue processing. If the storage device processes 10 data read / write commands simultaneously, the completion messages of the 10 data read / write commands can also be placed in the current completion queue. However, due to the backpressure, the storage device cannot continue to read data read / write commands from the submission queue, resulting in idle computing resources and reduced data read / write efficiency.
[0069] Therefore, the preset backpressure threshold can be set as the number of data read and write commands that the storage device can process simultaneously.
[0070] The queue depth is the number of complete message entries that can be placed in the current completion queue. If the preset backpressure threshold is greater than the current completion queue depth, the queue processing device will issue an alarm.
[0071] For example, with a preset backpressure threshold of 10 and a current completion queue depth of 5, the completion message of one data read / write command occupies one entry in the current completion queue. If the storage device retrieves 8 data read / write commands from the submission queue, processes and completes these 8 commands simultaneously, the completion messages for these 8 commands would require 8 entries in the current completion queue. However, since the current completion queue depth is 5, even if all entries in the queue are free, it cannot accommodate the completion messages for all 8 commands. Therefore, the queue processing device will issue an alarm.
[0072] Therefore, the preset backpressure threshold should be less than the current completion queue depth.
[0073] After determining the preset backpressure threshold corresponding to the current completion queue, the backpressure threshold is written to the first control register corresponding to the current completion queue. The preset backpressure threshold can be obtained by parsing the first control register.
[0074] The queue processing method provided in this application can determine the preset backpressure threshold corresponding to the current completed queue by simultaneously processing the number of data read / write commands and / or the queue depth of the current completed queue through the storage device. By setting the preset backpressure threshold, the operation of the storage device to obtain data read / write commands can be backpressured in a timely manner, thereby improving the efficiency of data read / write and preventing data read / write timeouts.
[0075] Based on any of the above embodiments, after writing the preset backpressure threshold corresponding to the current completion queue into the first control register corresponding to the current completion queue, the method further includes:
[0076] Based on the queue creation information in the host device, determine the submission queue corresponding to the current completed queue;
[0077] Get the queue identifier of the submission queue;
[0078] Write the queue identifier of the submission queue into the second control register corresponding to the current completion queue.
[0079] Specifically, both the commit queue and the completion queue are created by the host device. The commit queue corresponding to the current completion queue can be determined based on the queue creation message in the host device. The current completion queue may correspond to only one commit queue or it may correspond to multiple commit queues.
[0080] The queue identifier of a submission queue is a unique identifier that can identify the submission queue; that is, the unique submission queue corresponding to the queue identifier can be determined through the queue identifier. The queue identifier of a submission queue can be the address information of the submission queue.
[0081] The queue processing device obtains the queue identifier of the submission queue corresponding to the current completed queue and writes the queue identifier into the second control register corresponding to the current completed queue. That is, the submission queue corresponding to the current completed queue can be obtained by parsing the second control register.
[0082] The queue processing method provided in this application, by mapping the submission queue and the completion queue, can effectively reduce the pressure on the storage device to obtain data read / write commands issued by the host device from the submission queue corresponding to the current completion queue, thereby improving the efficiency of data read / write.
[0083] Based on any of the above embodiments, after writing the queue identifier of the submission queue into the second control register corresponding to the currently completed queue, the method includes:
[0084] Set the backpressure enable identifier to true and write the backpressure enable identifier to the completion queue management control register.
[0085] Specifically, setting the backpressure enable identifier to true indicates that the host device may have issued a command to enable backpressure. The backpressure enable identifier is written to the completion queue management control register. At this time, the completion queue management control register can confirm that the host device has issued a command to enable backpressure. The queue processing device further judges the current system environment to determine whether to prevent the storage device from obtaining data read / write commands issued by the host device from the submission queue.
[0086] The queue processing method provided in this application writes the backpressure enable identifier into the completion queue management control register. The completion queue management control register can be used to determine whether the host device has issued a command to enable backpressure, and thus determine whether to prevent the storage device from obtaining data read / write commands issued by the host device from the submission queue, thereby improving the efficiency of data read / write.
[0087] Based on any of the above embodiments, step 120 includes:
[0088] Based on the second control register corresponding to the current completion queue, obtain the queue identifier of the submission queue corresponding to the current completion queue;
[0089] Based on the queue identifier of the submission queue corresponding to the current completed queue, determine the control register corresponding to the submission queue, and set the read / write status of the control register corresponding to the submission queue to unreadable.
[0090] Specifically, when the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold, the queue processing device parses the second control register corresponding to the current completion queue to obtain the queue identifier of the submission queue corresponding to the current completion queue. Since the submission queue and the queue identifier are in one-to-one correspondence, the submission queue and the control register corresponding to the submission queue can be determined by obtaining the queue identifier of the submission queue corresponding to the current completion queue, and the read / write status of the control register corresponding to the submission queue is set to unreadable.
[0091] If the read / write status of the control register corresponding to the commit queue is unreadable, the storage device cannot read the control register corresponding to the commit queue. That is, the storage device cannot obtain data read / write commands in the commit queue. At this time, the storage device can only process the previously obtained data read / write commands and cannot obtain new data read / write commands from the commit queue.
[0092] The queue processing method provided in this application, by setting the read / write status of the control register corresponding to the commit queue corresponding to the current completion queue to unreadable when the backpressure enable identifier is true and the number of idle entries is less than a preset backpressure threshold, can prevent the storage device from continuously obtaining data read / write commands from the commit queue, causing the entries in the completion queue to be occupied by a large number of data read / write completion messages, making the completion queue "full". The queue processing method provided in this application can effectively solve the technical problem of data read / write timeout when a large number of data read / write commands occur, and improve the efficiency of data read / write.
[0093] Based on any of the above embodiments, after step 110, the method further includes:
[0094] If the backpressure enable identifier is false or the number of idle entries is greater than or equal to the preset backpressure threshold, the read / write status of the control register corresponding to the current completion queue is set to readable, so that the storage device can obtain data read / write commands issued by the host device from the submission queue.
[0095] Specifically, when the read / write status of the control register corresponding to the commit queue of the current completion queue is set to unreadable, the storage device can only process data read / write commands before backpressure and cannot obtain new data read / write commands from the commit queue. As a result, the number of idle entries in the current completion queue will continue to increase. In order to prevent waste of resources, when the number of idle entries is greater than or equal to the preset backpressure threshold, the read / write status of the control register corresponding to the commit queue of the current completion queue can be set to readable.
[0096] In addition, the host device can determine the current system environment and decide not to issue a command to enable backpressure. At this time, the backpressure enable identifier is false. When the backpressure enable identifier is false, the read / write status of the control register corresponding to the current completion queue and the submission queue can be set to readable, so that the storage device can obtain the data read / write commands issued by the host device from the submission queue.
[0097] The queue processing method provided in this application sets the read / write status of the control register corresponding to the submission queue of the currently completed queue to readable when the backpressure enable identifier is false or the number of idle entries is greater than or equal to a preset backpressure threshold. This allows the storage device to promptly obtain data read / write commands from the host device in the submission queue, provided the current system environment permits, thus avoiding resource waste and improving data read / write efficiency.
[0098] Figure 2 This is the second flowchart of the queue processing method provided in this application, as shown below. Figure 2 As shown, the method includes steps 210, 220, 230 and 240.
[0099] Step 210: Query the completion queue management control register to obtain the backpressure enable identifier, and determine whether the host device has issued a command to enable backpressure. If the host device has issued a command to enable backpressure, query the first control register corresponding to the current completion queue to obtain the preset backpressure threshold.
[0100] Step 220: Determine whether the number of idle entries in the current completed queue is less than the preset backpressure threshold.
[0101] Step 230: If the number of idle entries in the current completion queue is less than the preset backpressure threshold, set the read / write status of the control register corresponding to the submission queue to unreadable.
[0102] When the read / write status of the control register corresponding to the submission queue is unreadable, the storage device cannot obtain data read / write commands from the submission queue until the backpressure enable identifier is false or the number of free entries is greater than or equal to the preset backpressure threshold. Only then can the storage device obtain data read / write commands issued by the host device from the submission queue.
[0103] Step 240: If the host device has not issued a command to enable backpressure and the number of idle entries in the current completion queue is greater than or equal to the preset backpressure threshold, when the host device places a data read / write command into the submission queue, it retrieves the data read / write command from the submission queue through the queue doorbell and sends the data read / write command to the storage device. After the storage device processes the data read / write command, it places the completion message into the completion queue through the completion queue engine.
[0104] The queue processing method provided in this application can effectively apply back pressure to the operation of the storage device to obtain data read and write commands issued by the host device from the submission queue corresponding to the current completed queue by configuring the control register and setting a preset back pressure threshold, thereby improving the efficiency of data read and write.
[0105] Based on the above-described queue processing method, this application also provides a queue processing apparatus. The following will be combined with... Figure 3 The device is described in detail.
[0106] Figure 3 This is a schematic diagram of the queue processing device provided in this application, as shown below. Figure 3 As shown, the queue processing apparatus of this application embodiment includes an acquisition unit 310 and a processing unit 320.
[0107] The acquisition unit 310 is used to acquire the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue.
[0108] The processing unit 320 is used to set the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue to unreadable when the backpressure enable identifier is true and the number of idle entries is less than a preset backpressure threshold.
[0109] The read / write status of the control register corresponding to the submission queue is used to control the storage device to obtain data read / write commands issued by the host device from the submission queue.
[0110] Specifically, according to the embodiments of this application, any multiple units in the acquisition unit 310 and the processing unit 320 can be combined into one unit, or any one of the units can be split into multiple units.
[0111] Alternatively, at least some of the functions of one or more of these units may be combined with at least some of the functions of other units and implemented in one unit.
[0112] According to embodiments of this application, at least one of the acquisition unit 310 and the processing unit 320 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in any one of the three methods of software, hardware, and firmware, or in a suitable combination of any of these.
[0113] Alternatively, at least one of the acquisition unit 310 and the processing unit 320 may be implemented at least partially as a computer program unit, which can perform corresponding functions when the computer program unit is run.
[0114] The queue processing device provided in this application embodiment can identify whether the host device has issued a command to enable backpressure by obtaining a backpressure enable identifier; it can determine the occupancy status of the current completion queue by obtaining the number of free entries in the current completion queue and the preset backpressure threshold corresponding to the current completion queue; when the backpressure enable identifier is true and the number of free entries is less than the preset backpressure threshold, that is, when there is a possibility that the entries in the current completion queue are about to be completely occupied by completion messages, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to unreadable, which can prevent the storage device from obtaining new data read / write commands from the submission queue, providing buffer time for the storage device and the submission queue. After the storage device finishes processing the data read / write command, it can promptly place the completion message into the completion queue, and also enable the host device to receive the command completion message in a timely manner, preventing data read / write timeout errors. The queue processing device provided in this application embodiment does not need to use a retransmission mechanism to retransmit unsent commands, reducing the operation steps of queue processing and improving the efficiency of data read / write.
[0115] Based on any of the above embodiments, the queue processing device further includes a writing unit:
[0116] The write unit is used to determine the preset backpressure threshold corresponding to the current completion queue based on the number of data read and write commands processed simultaneously by the storage device and / or the queue depth of the current completion queue.
[0117] Write the preset backpressure threshold corresponding to the current completion queue into the first control register corresponding to the current completion queue.
[0118] Based on any of the above embodiments, the writing unit is further configured to:
[0119] Based on the queue creation information in the host device, determine the submission queue corresponding to the current completed queue;
[0120] Get the queue identifier of the submission queue;
[0121] Write the queue identifier of the submission queue into the second control register corresponding to the current completion queue.
[0122] Based on any of the above embodiments, the writing unit is further configured to:
[0123] Set the backpressure enable identifier to true and write the backpressure enable identifier to the completion queue management control register.
[0124] Based on any of the above embodiments, the processing unit is specifically used for:
[0125] Based on the second control register corresponding to the current completion queue, obtain the queue identifier of the submission queue corresponding to the current completion queue;
[0126] Based on the queue identifier of the submission queue corresponding to the current completed queue, determine the control register corresponding to the submission queue, and set the read / write status of the control register corresponding to the submission queue to unreadable.
[0127] Based on any of the above embodiments, the acquisition unit is further configured to:
[0128] If the backpressure enable identifier is false or the number of idle entries is greater than or equal to the preset backpressure threshold, the read / write status of the control register corresponding to the current completion queue is set to readable, so that the storage device can obtain data read / write commands issued by the host device from the submission queue.
[0129] This application also provides a server. Figure 4 This is a schematic diagram of the server structure provided in this application; as shown Figure 4 As shown, the server 400 includes a processor 410; the processor is equipped with the aforementioned queue processing device 420.
[0130] The server provided in this application includes the above-described queue processing device to implement the above-described queue processing method. Its specific implementation method is consistent with the aforementioned method implementation method and can achieve the same beneficial effects, so it will not be described again here.
[0131] Based on any of the above embodiments Figure 5 This is a schematic diagram of the structure of the electronic device provided in this application, such as... Figure 5As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communications bus 540, wherein the processor 510, communications interface 520, and memory 530 communicate with each other via the communications bus 540. The processor 510 can call logical instructions in the memory 530 to execute a queue processing method, which includes:
[0132] Get the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue;
[0133] When the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to unreadable.
[0134] The read / write status of the control register corresponding to the submission queue is used to control the storage device to obtain data read / write commands issued by the host device from the submission queue.
[0135] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0136] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, it can implement the methods provided in the above embodiments.
[0137] In another aspect, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the methods provided in the above embodiments.
[0138] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of this application, depending on actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0139] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0140] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A queue processing method, characterized in that, include: Obtain the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue; When the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to unreadable. The read / write status of the control register corresponding to the submission queue is used to control the storage device to obtain data read / write commands issued by the host device from the submission queue. Before obtaining the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue, the method includes: Based on the number of data read / write commands processed simultaneously by the storage device and / or the queue depth of the current completion queue, a preset backpressure threshold corresponding to the current completion queue is determined; Write the preset backpressure threshold corresponding to the current completion queue into the first control register corresponding to the current completion queue.
2. The queue processing method according to claim 1, characterized in that, After writing the preset backpressure threshold corresponding to the current completion queue into the first control register corresponding to the current completion queue, the method includes: Based on the queue creation information in the host device, determine the submission queue corresponding to the currently completed queue; Obtain the queue identifier of the submission queue; Write the queue identifier of the submission queue into the second control register corresponding to the currently completed queue.
3. The queue processing method according to claim 2, characterized in that, After writing the queue identifier of the submission queue into the second control register corresponding to the currently completed queue, the method includes: Set the backpressure enable identifier to true and write the backpressure enable identifier to the completion queue management control register.
4. The queue processing method according to claim 1, characterized in that, Setting the read / write status of the control register corresponding to the submission queue of the current completed queue to unreadable includes: Based on the second control register corresponding to the current completion queue, obtain the queue identifier of the submission queue corresponding to the current completion queue; Based on the queue identifier of the submission queue corresponding to the current completed queue, the control register corresponding to the submission queue is determined, and the read / write status of the control register corresponding to the submission queue is set to unreadable.
5. The queue processing method according to any one of claims 1 to 4, characterized in that, After obtaining the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue, the method includes: If the backpressure enable identifier is false or the number of idle entries is greater than or equal to the preset backpressure threshold, the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue is set to readable, so that the storage device can obtain the data read / write command issued by the host device from the submission queue.
6. A queue processing device, characterized in that, include: The acquisition unit is used to acquire the backpressure enable identifier, the number of idle entries in the current completion queue, and the preset backpressure threshold corresponding to the current completion queue; The processing unit is configured to set the read / write status of the control register corresponding to the submission queue corresponding to the current completion queue to unreadable when the backpressure enable identifier is true and the number of idle entries is less than the preset backpressure threshold. The read / write status of the control register corresponding to the submission queue is used to control the storage device to obtain data read / write commands issued by the host device from the submission queue. The queue processing device further includes a writing unit, which is used to determine a preset backpressure threshold corresponding to the current completion queue based on the number of data read / write commands processed simultaneously by the storage device and / or the queue depth of the current completion queue; and write the preset backpressure threshold corresponding to the current completion queue into the first control register corresponding to the current completion queue.
7. A server, characterized in that, Including the processor; The processor is equipped with the queue processing device as described in claim 6.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the queue processing method as described in any one of claims 1 to 5.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the queue processing method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Back-pressure information generating method, system and apparatus
CN101340385A
Method and an apparatus for virtualization of quality-of-service
CN104750539A