A method and device for querying, writing and reading a scatter-gather list based on hardware offloading
By establishing cache management vectors and index matrices on the NVMe subsystem, querying, reading and writing dispersed aggregation lists independently of the host solves the problem of excessive load on the host central processor in the NVMe protocol and achieves efficient data transmission and reduction. Delay.
Patent Information
- Application Number
- CN202311569298.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2043-11-22
AI Technical Summary
In the NVMe protocol, during the data reading and writing process based on the distributed aggregation list, the host central processor load is too high, causing latency problems. Especially during high-speed and massive data transmission, frequent software intervention leads to performance bottlenecks.
Adopt a decentralized aggregation list query write and read method based on hardware offloading. By establishing a cache management vector and cache index matrix on the NVMe subsystem, data query, parsing, and read and write operations are performed independently of the host, reducing software intervention and utilizing the PCIe bus. and network connection for data transmission.
When transmitting large amounts of data, it significantly reduces system delay and software load, reduces the cache space required for distributed aggregation list storage, and improves data transmission efficiency.
Smart Images

Figure CN117591023B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for querying, writing and reading a scatter-gather list based on hardware offloading. Background Art
[0002] The Non-Volatile Memory express (NVMe) protocol defines the interface between the host and the non-volatile memory subsystem based on the peripheral component interconnect standard and interface (PCIe). It includes the command set, queue and register interface for the interaction between the driver software and the non-volatile memory subsystem, and also defines the basic command set of the NVMe subsystem.
[0003] The Non-Volatile Memory expressover Fabrics (NVMe oF) protocol defines how to use various common transaction layer protocols to implement NVMe functions. The transaction layer referred to in the protocol includes RDMA, FibreChannel, PCIe Fabrics and other implementations.
[0004] The NVMe protocol connects non-volatile storage devices such as solid state drives (SSDs) to the host system through the local PCIe interface, which can give full play to the SSD bandwidth performance. The NVMe oF protocol extends the access to non-volatile storage devices to distributed systems through the network to achieve storage sharing and remote access.
[0005] NVMe supports two types of data pointers, Physical Region Page (PRP) and Scatter Gather List (SGL), while NVMe oF only supports SGL. Although SGL data pointers can describe data memory space of any location and size, and are more flexible to use, due to the discontinuity of memory space, frequent software intervention is required during data transmission, which is an important factor restricting latency.
[0006] It can be seen that the conversion process between NVMe oF and NVMe protocol is relatively complicated, and consumes a lot of host CPU. During the high-speed and massive data reading and writing process, it will bring a huge load to the host CPU. Therefore, a new NVMe read and write processing solution is urgently needed. Summary of the invention
[0007] In view of this, an embodiment of the present invention provides a scatter-gather list query, write and read method and device based on hardware offloading to eliminate or improve one or more defects existing in the prior art and solve the problem of delay caused by high host central processing unit load when reading and writing data based on NVMe.
[0008] One aspect of the present invention provides a scatter-gather list query writing method based on hardware offloading, the method is used to be executed on an NVMe subsystem, the NVMe subsystem is connected to a host through a PCIe bus and to a storage controller through a network, the method comprising the following steps:
[0009] Reading and querying the first-in-first-out queue of the submission queue doorbell, obtaining the position information of the pending submission queue entry instruction, and reading the pending submission queue entry instruction from the host according to the position information; the pending submission queue entry instruction is a write command;
[0010] Determine the data pointer type of the to-be-processed submission queue entry instruction, and read and parse a first data pointer according to the type of the corresponding data pointer; the first data pointer points to target data in the host memory;
[0011] Establishing a cache management vector locally and applying for multiple local cache spaces, wherein each element in the cache management vector is marked to indicate whether the corresponding cache space is occupied;
[0012] The first data pointer is completely read, converted into an SGL end segment descriptor composed of one or more SGL data block descriptors as a second data pointer, stored in the local cache space, and the cache space number and the number of data block descriptors stored in the corresponding cache space are marked, and the storage position is marked by the cache management vector;
[0013] Establishing a cache index matrix of the pending submission queue entry instruction and the second data pointer, using the queue number and command number of the pending submission queue entry instruction as the address, and writing the cache space number and the corresponding number of data block descriptors into the cache index matrix;
[0014] Receiving the current receivable data amount fed back by the storage controller based on the pending submission queue entry instruction, and applying for corresponding data cache to the network sending port;
[0015] Querying the cache space number corresponding to the second data pointer from the cache index matrix, and reading the second data pointer to initiate a data read request for the target data;
[0016] The read target data is written into the data cache, and the information of the used second pointer is recorded; if all the second pointers are read, the corresponding cache management vector is cleared.
[0017] In some embodiments, the method further includes: when the data cache is larger than the target data corresponding to the current data block descriptor of the second data pointer, continuously and automatically updating to the next data block descriptor, reading data and writing it into the data cache; updating the cache index matrix according to the sequence number and address corresponding to the data block descriptor of the data read-out completed in the second data pointer, and resuming reading from the record position when applying for a new data cache next time.
[0018] In some embodiments, the method further comprises:
[0019] In the case that the data cache is smaller than the target data corresponding to the current data block descriptor of the second data pointer, after writing stops, the cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor of the completed data read, and reading is resumed from the record position when a new data cache is applied next time.
[0020] In some embodiments, the data pointer type is a PRP address type, wherein the value of the PRP field is used to indicate the address of the target data in the host memory;
[0021] Or, the data pointer type is an SGL data block descriptor, wherein the address field is used to indicate the address of the target data in the host memory;
[0022] Or, the data pointer type is an SGL segment descriptor or an SGL end segment descriptor, wherein the address field is used to indicate the address of the SGL data block descriptor in the host memory.
[0023] In some embodiments, each element in the cache management vector marks whether the corresponding cache space is occupied, including: when the element is 1, it indicates that the corresponding cache space is occupied, and when the element is 0, it indicates that the corresponding cache space is not occupied.
[0024] On the other hand, the present invention also provides a scatter-gather list query and reading method based on hardware offloading, the method is used to be executed on an NVMe subsystem, the NVMe subsystem is connected to a host through a PCIe bus and to a storage controller through a network, the method comprising the following steps:
[0025] Read and query the first-in-first-out queue of the submission queue doorbell, obtain the location information of the pending submission queue entry instruction, and read the pending submission queue entry instruction from the host; the pending submission queue entry instruction is a read command;
[0026] Determine the data pointer type of the to-be-processed submission queue entry instruction, and read and parse a third data pointer according to the type of the corresponding data pointer; the third data pointer points to a target storage address in the host memory;
[0027] Establishing a cache management vector locally and applying for multiple local cache spaces, wherein each element in the cache management vector is marked to indicate whether the corresponding cache space is occupied;
[0028] The third data pointer is completely read, converted into an SGL end segment descriptor composed of one or more SGL data block descriptors as a fourth data pointer, stored in the local cache space, and the cache space number and the number of data block descriptors stored in the corresponding cache space are marked, and the storage position is marked by the cache management vector;
[0029] Establishing a cache index matrix of the pending submission queue entry instruction and the fourth data pointer, using the queue number and command number of the pending submission queue entry instruction as the address, and writing the cache space number and the corresponding number of data block descriptors into the cache index matrix;
[0030] forwarding the pending submission queue entry instruction to the storage controller, receiving the returned target data, and storing it in the data cache;
[0031] Querying the cache space number corresponding to the fourth data pointer from the cache index matrix, reading the fourth data pointer, initiating a data write request to the host, and writing the data in the data cache to the host address pointed to by the fourth pointer;
[0032] The information of the used fourth pointer is recorded, and if all the data blocks pointed to by the fourth pointer are written, the cache management vector is cleared.
[0033] In some embodiments, the data pointer type is a PRP address type, wherein the value of the PRP field is used to indicate the address of the target data in the host memory;
[0034] Or, the data pointer type is an SGL data block descriptor, wherein the address field is used to indicate the address of the target data in the host memory;
[0035] Or, the data pointer type is an SGL segment descriptor or an SGL end segment descriptor, wherein the address field is used to indicate the address of the SGL data block descriptor in the host memory.
[0036] In some embodiments, the method also includes: when the capacity of the target storage address is less than the data volume of the target data, automatically updating to the address corresponding to the next data block descriptor in the fourth data pointer to continue storage after the target storage address is full; updating the cache index matrix according to the sequence number and address corresponding to the data block descriptor of the currently completed data writing, waiting for the next new data to be written from the record position.
[0037] The method further comprises:
[0038] When the capacity of the target storage address is greater than the amount of target data, the cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor to which data writing has been completed in the fourth data pointer, and the next time new data is written, it is continued to be written from the recording position.
[0039] On the other hand, the present invention also provides a scatter-gather list query read-write device based on hardware offloading, comprising a processor and a memory, wherein the memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the above method.
[0040] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.
[0041] The beneficial effects of the present invention are at least:
[0042] The method and device for querying, writing and reading a dispersed-gather list based on hardware offloading described in the present invention construct an NVMe subsystem to query, parse, read and write the dispersed-gather list independently of the host, and do not require software intervention when large amounts of data are transmitted, thereby greatly reducing system latency and software load; by establishing a dynamic cache management method, the cache space required for storing the dispersed-gather list is greatly reduced.
[0043] Additional advantages, purposes, and features of the present invention will be described in part in the following description, and will become apparent to those skilled in the art after studying the following, or may be learned from the practice of the present invention. The purposes and other advantages of the present invention may be achieved and obtained by the structures specifically indicated in the specification and the accompanying drawings.
[0044] Those skilled in the art will appreciate that the objectives and advantages that can be achieved with the present invention are not limited to the above specific description, and the above and other objectives that can be achieved by the present invention will be more clearly understood from the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of the present application, and do not constitute a limitation of the present invention. In the drawings:
[0046] Figure 1 This is a connection structure diagram of a scatter-gather list query write-read device based on hardware offloading according to an embodiment of the present invention.
[0047] Figure 2 This is a logical diagram of an SGL query, parsing and storage method implemented based on hardware according to another embodiment of the present invention.
[0048] Figure 3 The present invention is a logical diagram of SQE query, parsing and indexing in the SGL query, parsing and storage method based on hardware implementation described in an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the illustrative embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0050] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, only structures and / or processing steps closely related to the solutions according to the present invention are shown in the accompanying drawings, while other details that are not closely related to the present invention are omitted.
[0051] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0052] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.
[0053] In the prior art, the data access process based on NVMe and NVMe oF involves SGL (ScatterGather List) data pointers. Although SGL data pointers can describe data memory space of any position and size and are more flexible to use, due to the discontinuity of the memory space, software needs to intervene frequently during data transmission, which is an important factor restricting the reduction of latency and will also bring great load to the host's central processing unit (CPU).
[0054] Specifically, the present invention provides a scatter-gather list query writing method based on hardware offloading, referring to Figure 1The method is used to be executed on an NVMe subsystem, the NVMe subsystem is connected to a host via a PCIe bus and to a storage controller via a network, and the method includes the following steps S101 to S108:
[0055] Step S101: read and query the first-in-first-out queue of the submission queue doorbell, obtain the location information of the submission queue entry instruction to be processed, and read the submission queue entry instruction to be processed from the host according to the location information; the submission queue entry instruction to be processed is a write command.
[0056] Step S102: determine the data pointer type of the to-be-processed submission queue entry instruction, and read and parse a first data pointer according to the type of the corresponding data pointer; the first data pointer points to target data in the host memory.
[0057] Step S103: a cache management vector is established locally, and a plurality of local cache spaces are applied for. Each element in the cache management vector is marked to indicate whether the corresponding cache space is occupied.
[0058] Step S104: read the first data pointer completely, convert it into an SGL end segment descriptor composed of one or more SGL data block descriptors as the second data pointer, store it in the local cache space, mark the cache space number and the number of data block descriptors stored in the corresponding cache space, and mark the storage location through the cache management vector.
[0059] Step S105: Establish a cache index matrix of the pending submitted queue entry instruction and the second data pointer, use the queue number and command number (CID) of the pending submitted queue entry instruction as the address, and write the cache space number and its corresponding number of data block descriptors into the cache index matrix.
[0060] Step S106: receiving the current receivable data volume fed back by the storage controller based on the instruction of the pending submission queue entry, and applying for corresponding data buffer to the network sending port.
[0061] Step S107: query the cache space number corresponding to the second data pointer from the cache index matrix, and read the second data pointer to initiate a data read request for the target data.
[0062] Step S108: writing the read target data into the data cache, and recording the information of the used second pointers; if all the second pointers have been read, clearing the corresponding cache management vector.
[0063] In step S101, the "first-in-first-out queue of the submission queue doorbell" refers to the Submission Queue in the NVMe (Non-Volatile Memory Express) storage protocol, which contains a doorbell (Doorbell) for triggering operations, and a command queue arranged according to the first-in-first-out (FIFO) principle. The "Submission Queue" is used to send commands or requests to the NVMe SSD to perform various operations, such as reading, writing, erasing, etc. Its function is to allow the host system to submit commands to the SSD asynchronously to improve I / O performance and reduce latency. Each element in the submission entry queue is generally referred to as a Submission Queue Entry (SQE), that is, the pending submission queue entry instruction mentioned in this application, and each SQE contains a specific NVMe command (for example, reading data from a sector) and related parameters. In this embodiment, the pending submission queue entry instruction is a write command, that is, the host writes data outward.
[0064] In step S102, when parsing the data pointer in the SQE, the data pointer type is first distinguished, and the data pointer type may include a PRP address type, an SGL data block descriptor, an SGL segment descriptor, or an SGL end segment descriptor.
[0065] The value of the PRP field in the PRP address type is used to indicate the address of the target data in the host memory. The address field in the SGL data block descriptor is used to indicate the address of the target data in the host memory. In the SGL segment descriptor or the SGL last segment descriptor, the address field is used to indicate the address of the SGL data block descriptor in the host memory. The first data pointer obtained by parsing can be one of the above types. For a write command, the first data pointer points to the target data in the host memory.
[0066] Specifically, in SGL, different types of descriptors are often used to manage data blocks. These descriptors include SGL data block descriptors, SGL data segment descriptors, and SGL end segment descriptors. Data block descriptors are usually used to represent the information of a single data block, including the starting memory address of the data block, the length of the data block, and other related information. Data segment descriptors are usually used to represent a data segment composed of multiple data blocks, which are logically adjacent and can be transmitted or processed together. The end segment descriptor is usually used to indicate the end of the SGL, that is, the end of the SGL, so that the operating system and the driver know the end position of the SGL.
[0067] In step S103, a cache management vector is established. When a pending submission queue entry instruction is obtained, a local cache space is applied for, numbered n, and the vector flag corresponding to n is set to 1, indicating that the space is occupied. That is, in the cache management vector, when the element is 1, it indicates that the corresponding cache space is occupied, and when the element is 0, it indicates that the corresponding cache space is not occupied.
[0068] In step S104, after completely reading the first data pointer, the NVMe subsystem converts the first data pointer into an SGL end segment descriptor consisting of one or more SGL data block descriptors as the second data pointer.
[0069] Specifically, if the first data pointer is a PRP address type or an SGL data block descriptor, it is converted into an SGL last segment descriptor composed of one or more SGL data block descriptors and written into the local cache space; if the first data pointer is an SGL segment descriptor or an SGL last segment descriptor, a read request is initiated to the host according to the address pointed to by the segment descriptor or the last segment descriptor, all SGL descriptors are read, and then all the read SGL data block descriptors are combined into a new SGL last segment descriptor and stored in the local cache space.
[0070] Furthermore, the corresponding cache space number is marked, and the number of stored data block descriptors is recorded.
[0071] In step S105, a cache index matrix is established to associate the pending submission queue entry instructions with the second data pointer for easy management.
[0072] In steps S106 to S108, based on the write command, the NVMe subsystem first receives the current available data amount fed back by the storage controller, and applies for a cache from the network sender. The cache space number corresponding to the second data pointer is queried from the cache index matrix, and the second data pointer is read to initiate a data read request for the target data, and the target data is written into the data cache applied from the network sender.
[0073] In some embodiments, the method further comprises: when the data cache is larger than the target data corresponding to the current data block descriptor of the second data pointer, continuously and automatically updating to the next data block descriptor, reading data and writing data into the data cache. The cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor of the data read-out completed in the second data pointer, and the reading is continued from the record position when a new data cache is applied next time.
[0074] In some embodiments, the method also includes: when the data cache is smaller than the target data corresponding to the current data block descriptor of the second data pointer, after writing stops, the cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor of the completed data read, and the reading is resumed from the record position when a new data cache is applied next time.
[0075] On the other hand, the present invention also provides a scatter-gather list query and reading method based on hardware offloading, referring to Figure 1 The method is used to be executed on an NVMe subsystem, the NVMe subsystem is connected to a host via a PCIe bus and to a storage controller via a network, and the method includes the following steps S201 to S208:
[0076] Step S201: read and query the first-in-first-out queue of the submission queue doorbell, obtain the location information of the pending submission queue entry instruction, and read the pending submission queue entry instruction from the host; the pending submission queue entry instruction is a read command.
[0077] Step S202: determine the data pointer type of the to-be-processed submission queue entry instruction, and read and parse a third data pointer according to the type of the corresponding data pointer; the third data pointer points to a target storage address in the host memory.
[0078] Step S203: a cache management vector is established locally, and a plurality of local cache spaces are applied for. Each element in the cache management vector is marked to indicate whether the corresponding cache space is occupied.
[0079] Step S204: read the third data pointer completely, convert it into an SGL end segment descriptor composed of one or more SGL data block descriptors as the fourth data pointer, store it in the local cache space, mark the cache space number and the number of data block descriptors stored in the corresponding cache space, and mark the storage location through the cache management vector.
[0080] Step S205: Establish a cache index matrix of the pending submitted queue entry instruction and the fourth data pointer, use the queue number and command number of the pending submitted queue entry instruction as the address, and write the cache space number and its corresponding number of data block descriptors into the cache index matrix.
[0081] Step S206: forward the pending submission queue entry instruction to the storage controller, receive the returned target data, and store it in the data cache.
[0082] Step S207: query the cache space number corresponding to the fourth data pointer from the cache index matrix, read the fourth data pointer, initiate a data write request to the host, and write the data in the data cache to the host address pointed to by the fourth pointer.
[0083] Step S208: Record the information of the used fourth pointer. If all the data blocks pointed to by the fourth pointer have been written, clear the cache management vector.
[0084] In steps S201 to S205, the description of the corresponding steps can refer to steps S101 to S105, wherein the pending submission queue entry instruction in this application is a read command, and data needs to be written to the host. Here, the data pointer contained in the pending submission queue entry instruction points to the location in the host from which data needs to be written.
[0085] In some embodiments, the data pointer type is a PRP address type, wherein the value of the PRP field is used to indicate the address of the target data in the host memory. Or, the data pointer type is an SGL data block descriptor, wherein the address field is used to indicate the address of the target data in the host memory. Or, the data pointer type is an SGL segment descriptor or an SGL last segment descriptor, wherein the address field is used to indicate the address of the SGL data block descriptor in the host memory.
[0086] In steps S206 to S208, based on the data required in the instruction of the pending submission queue entry, the data is acquired and written into the target storage address of the host memory through the memory.
[0087] In some embodiments, the method further includes: when the capacity of the target storage address is less than the amount of target data, automatically updating to the address corresponding to the next data block descriptor in the second data pointer after the target storage address is full to continue storing. The cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor of the currently completed data writing, and the next new data is continued to be written from the recording position.
[0088] The method also includes: when the capacity of the target storage address is greater than the data volume of the target data, updating the cache index matrix according to the sequence number and address corresponding to the data block descriptor of the currently completed data writing in the fourth data pointer, waiting for the next new data to be written from the recording position.
[0089] On the other hand, the present invention also provides a scatter-gather list query read-write device based on hardware offloading, comprising a processor and a memory, wherein the memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the above method.
[0090] On the other hand, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.
[0091] The present invention is described below in conjunction with a specific embodiment:
[0092] This embodiment provides an SGL query, parsing and storage method based on hardware implementation.
[0093] The first step of the method is SQE query, and its main operations include: reading the submission queue DB FIFO, parsing SQE storage address information, and reading SQE from the host memory.
[0094] The composition diagram of the NVMe oF system is as follows Figure 1 As shown, the NVMe subsystem is connected to the host through PCIe and to the storage controller through the network. The NVMe subsystem provides a multiplexer MUX for external connection. When there is a new SQE command on the host side, the DB queue will be updated. The NVMe subsystem obtains the location information of the SQE to be processed by reading the DB FIFO and querying the queue RAM. Since the SQE is stored in the host memory, it is necessary to initiate a read request to the host to obtain the SQE data, including parsing the SQE storage address information and queue number, and reading the SQE from the host memory. The SQE contains the command number (CID, Command Identity).
[0095] The second step of the method is SGL parsing, and its main operations include: judging the data pointer type in the SQE, if it is a PRP address type or an SGL data block descriptor, the value of the PRP field or the address field in the SGL data block descriptor is the address of the data in the host memory; if it is an SGL segment descriptor or an SGL last segment descriptor, the address in the descriptor is the address of the SGL data block descriptor in the memory.
[0096] The third step of the method is SGL storage, and its main operations include: the hardware-based SGL solution composition diagram is as follows Figure 2 As shown, SGL is parsed from the field in the host SQE data structure. It can be the address of a data block or the address of an SGL segment descriptor, and this segment descriptor points to one or more data block addresses in the host memory.
[0097] like Figure 3 As shown, an SGL cache management vector is established. When an SQE is obtained, an SGL cache space (cache number is n) is applied for, and the vector flag position corresponding to n is set to 1, indicating that the space is occupied.
[0098] Since the SGL data blocks are stored in multiple SGL segments in the host memory, after each SGL segment access is completed, it is necessary to query the next SGL segment according to the segment descriptor, and only after the SGL segment is queried can the data blocks in the segment be accessed. In order to reduce the access frequency between the NVMe subsystem and the host, it is necessary to read all the SGL descriptors on the host side at once, extract the data block descriptors and store them in RAM, and form a new SGL end segment descriptor based on these SGL data block descriptors and write them into RAM.
[0099] The RAM address where the SGL is about to be stored is determined by the requested SGL cache space vector n. If the data pointer is a PRP or SGL data block descriptor, it is converted into an SGL end segment descriptor composed of one or more SGL data block descriptors and written to the RAM; if the data pointer is an SGL segment descriptor or an SGL end segment descriptor, a read request is initiated to the host according to the address pointed to by the segment descriptor or the end segment descriptor, all SGL descriptors are read, and then all the read SGL data block descriptors are combined into a new SGL end segment descriptor and stored in the RAM. During the storage period, the total number of SGL data block descriptors written in the current cache space n is counted.
[0100] Establish an SQE-SGL cache index matrix, use the queue number and CID to which the SQE belongs as the address, and write the requested SGL cache space number and the number of descriptors in the cache space n into the matrix.
[0101] The fourth step of the method is SGL data transmission. The task operation includes: transferring data between the host memory and the NVMe subsystem according to the SQE command. If the SQE command is a write command, the storage controller will feedback the current amount of data that can be received after receiving the write command forwarded by the NVMe subsystem.
[0102] The NVMe subsystem applies for a cache from the network sending port based on the amount of data that the storage controller can receive, and obtains the address of the SGL stored in the data block descriptor cache RAM from the SQE-SGL index matrix. Then, the SGL data block descriptor is read from the data block descriptor cache RAM, and an SGL data read request is initiated to the host at the address pointed to by the descriptor, and then the read data is written to the RAM cache requested from the network sending end; if the amount of data that the storage controller and the network sending end can receive requires multiple SGL data to fill, it needs to be automatically updated to the next SGL address after reading one SGL data.
[0103] If the cache space requested from the network sending port is not enough to consume the space specified by all SGL descriptors, record the current used space position (including the number of SGL descriptors and the address position used by a single descriptor) and update it to the SQE-SGL cache index matrix, and continue from the recorded position when applying next time.
[0104] If the SQE command is a read command, the storage controller will return the corresponding amount of data after receiving the read command forwarded by the NVMe subsystem.
[0105] The NVMe subsystem stores the data received by the storage controller through the network into RAM, and obtains the address of the SGL stored in the data block descriptor cache RAM from the SQE-SGL index matrix. Then read the SGL data block descriptor from the data block descriptor cache RAM, and initiate an SGL data write request to the host with the address pointed to by the description. If the amount of data sent by the controller requires multiple SGLs to store, it needs to be automatically updated to the next SGL address after writing one SGL data.
[0106] If the amount of data currently sent from the controller is not enough to consume the space specified by all SGL descriptors, the currently used space position (including the number of SGL descriptors and the address position used by a single descriptor) is recorded and updated to the SQE-SGL cache index matrix, and the next time data from the same queue and the same command is received, it continues from the recorded position.
[0107] When all the contents pointed to by SGL in SQE are transmitted, the flag of the currently used SGL cache management vector is cleared.
[0108] An embodiment of the present invention further provides a computer device, which may include a processor and a memory, wherein the processor and the memory may be connected via a bus or in other ways.
[0109] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0110] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as the program instructions / modules corresponding to the key shielding method of the vehicle-mounted display device in the embodiment of the present invention. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory.
[0111] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0112] The one or more modules are stored in the memory, and when executed by the processor, the method described in this embodiment is performed.
[0113] In summary, the method and device for querying, writing and reading the dispersed-gather list based on hardware offloading described in the present invention, by constructing an NVMe subsystem, queries, parses, reads and writes the dispersed-gather list independently of the host, and does not require software intervention when large amounts of data are transmitted, thereby greatly reducing system latency and software load; by establishing a dynamic cache management method, the cache space required for storing the dispersed-gather list is greatly reduced.
[0114] The embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned edge computing server deployment method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0115] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0116] It should be clear that the present invention is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present invention is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present invention.
[0117] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or replace features of other embodiments.
[0118] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the embodiments of the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A scatter-gather list query writing method based on hardware offloading, characterized in that: The method is used to be executed on an NVMe subsystem, wherein the NVMe subsystem is connected to a host via a PCIe bus and to a storage controller via a network, and the method comprises the following steps: Reading and querying the first-in-first-out queue of the submission queue doorbell, obtaining the position information of the pending submission queue entry instruction, and reading the pending submission queue entry instruction from the host according to the position information; the pending submission queue entry instruction is a write command; Determine the data pointer type of the to-be-processed submission queue entry instruction, and read and parse a first data pointer according to the type of the corresponding data pointer; the first data pointer points to target data in the host memory; Establishing a cache management vector locally and applying for multiple local cache spaces, wherein each element in the cache management vector is marked to indicate whether the corresponding cache space is occupied; The first data pointer is completely read, converted into an SGL end segment descriptor composed of one or more SGL data block descriptors as a second data pointer, stored in the local cache space, and the cache space number and the number of data block descriptors stored in the corresponding cache space are marked, and the storage position is marked by the cache management vector; Establishing a cache index matrix of the pending submission queue entry instruction and the second data pointer, using the queue number and command number of the pending submission queue entry instruction as the address, and writing the cache space number and the corresponding number of data block descriptors into the cache index matrix; Receiving the current receivable data amount fed back by the storage controller based on the pending submission queue entry instruction, and applying for corresponding data cache to the network sending port; Querying the cache space number corresponding to the second data pointer from the cache index matrix, and reading the second data pointer to initiate a data read request for the target data; The read target data is written into the data cache, and the information of the used second pointer is recorded; if all the data blocks pointed to by the second pointer are read, the corresponding cache management vector is cleared.
2. The scatter-gather list query writing method based on hardware offloading according to claim 1, characterized in that: The method further comprises: When the data cache is larger than the target data corresponding to the current data block descriptor of the second data pointer, it is automatically updated to the next data block descriptor continuously to read and write data into the data cache; the cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor of the data read-out completed in the second data pointer, and the reading is continued from the record position when a new data cache is applied next time.
3. The scatter-gather list query writing method based on hardware offloading according to claim 1, characterized in that: The method further comprises: In the case that the data cache is smaller than the target data corresponding to the current data block descriptor of the second data pointer, after writing stops, the cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor of the completed data read, and reading is resumed from the record position when a new data cache is applied next time.
4. The scatter-gather list query writing method based on hardware offloading according to claim 1, characterized in that: The data pointer type is a PRP address type, wherein the value of the PRP field is used to indicate the address of the target data in the host memory; Or, the data pointer type is an SGL data block descriptor, wherein the address field is used to indicate the address of the target data in the host memory; Or, the data pointer type is an SGL segment descriptor or an SGL end segment descriptor, wherein the address field is used to indicate the address of the SGL data block descriptor in the host memory.
5. The scatter-gather list query writing method based on hardware offloading according to claim 1, characterized in that: Each element in the cache management vector marks whether the corresponding cache space is occupied, including: when the element is 1, it indicates that the corresponding cache space is occupied, and when the element is 0, it indicates that the corresponding cache space is not occupied.
6. A scatter-gather list query and reading method based on hardware offloading, characterized in that: The method is used to be executed on an NVMe subsystem, wherein the NVMe subsystem is connected to a host via a PCIe bus and to a storage controller via a network, and the method comprises the following steps: Read and query the first-in-first-out queue of the submission queue doorbell, obtain the location information of the pending submission queue entry instruction, and read the pending submission queue entry instruction from the host; the pending submission queue entry instruction is a read command; Determine the data pointer type of the to-be-processed submission queue entry instruction, and read and parse a third data pointer according to the type of the corresponding data pointer; the third data pointer points to a target storage address in the host memory; Establishing a cache management vector locally and applying for multiple local cache spaces, wherein each element in the cache management vector is marked to indicate whether the corresponding cache space is occupied; The third data pointer is completely read, converted into an SGL end segment descriptor composed of one or more SGL data block descriptors as a fourth data pointer, stored in the local cache space, and the cache space number and the number of descriptors stored in the corresponding cache space are marked, and the storage position is marked by the cache management vector; Establishing a cache index matrix of the pending submission queue entry instruction and the fourth data pointer, using the queue number and command number of the pending submission queue entry instruction as the address, and writing the cache space number and the corresponding number of data block descriptors into the cache index matrix; forwarding the pending submission queue entry instruction to the storage controller, receiving the returned target data, and storing it in the data cache; Querying the cache space number corresponding to the fourth data pointer from the cache index matrix, reading the fourth data pointer, initiating a data write request to the host, and writing the data in the data cache to the host address pointed to by the fourth pointer; The information of the used fourth pointer is recorded, and if all the data blocks pointed to by the fourth pointer are written, the cache management vector is cleared.
7. The scatter-gather list query and reading method based on hardware offloading according to claim 6, characterized in that: The data pointer type is a PRP address type, wherein the value of the PRP field is used to indicate the address of the target data in the host memory; Or, the data pointer type is an SGL data block descriptor, wherein the address field is used to indicate the address of the target data in the host memory; Or, the data pointer type is an SGL segment descriptor or an SGL end segment descriptor, wherein the address field is used to indicate the address of the SGL data block descriptor in the host memory.
8. The scatter-gather list query and reading method based on hardware offloading according to claim 6, characterized in that: The method further comprises: When the capacity of the target storage address is less than the data volume of the target data, the target storage address is automatically updated to the address corresponding to the next data block descriptor in the fourth data pointer to continue storing after the target storage address is full; the cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor of the currently completed data writing, and the next new data is continued to be written from the recording position; The method further comprises: When the capacity of the target storage address is greater than the amount of target data, the cache index matrix is updated according to the sequence number and address corresponding to the data block descriptor to which data writing has been completed in the fourth data pointer, and the next time new data is written, it is continued to be written from the recording position.
9. A scatter-gather list query read-write device based on hardware offloading, comprising a processor and a memory, characterized in that: The memory stores computer instructions, and the processor is used to execute the computer instructions stored in the memory. When the computer instructions are executed by the processor, the device implements the steps of the method as claimed in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Method and device for reducing read command processing delay
CN111258491A
Solid state drive, device, and operation method of solid state drive
CN115756311A
