A Transmission Optimization Method for a Virtual Storage Controller
By optimizing the data transmission method of the virtio_blk controller and using the modules in the intelligent network card to optimize data processing, the performance bottlenecks and storage packet loss problems of the virtio-blk controller under the virtualization platform are solved, and efficient storage data transmission and reliable breakpoint continuous transmission are achieved.
Patent Information
- Application Number
- CN202311712774.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-13
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2043-12-13
AI Technical Summary
The existing virtio-blk controllers have a large number of trapped and trapped operations under the virtualized KVM platform, resulting in reduced access performance and remote disk mapping lead to inefficient network transmission.
The virtio_blk controller in the smart network card is adopted to optimize data transmission through the virtio_csr, virtio_adaptor, fetch_index, fetch_ring, fetch_desc, fetch_pkt, mate_builder, slot_adaptor, data_parser and updata_pkt modules to realize the merge, splitting and processing of data packets, combining the breakpoint continuous transmission mechanism and TCP protocol retransmission to solve the problem of storage packet loss.
It improves the transmission efficiency of storage data, saves CPU core overhead, and solves the problem of storage packet loss caused by soc-side exceptions, and has good scalability and maintainability.
Smart Images

Figure CN117851301B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data communication technologies, and more particularly, to a method for optimizing the transmission of a virtual storage controller. Background Art
[0002] A virtual storage controller is an important component in a computer system. It is mainly responsible for managing the virtual memory system and implementing the function of virtual memory. Currently, the most widely used one is the virtio-blk controller.
[0003] The virtio-blk controller is an implementation method of a virtual disk under the virtualization KVM platform. In the KVM platform, the qemu program is responsible for simulating the entire working process of a PC. The simulation of devices by qemu can be divided into full simulation and semi-simulation. Among them, full simulation does not require a device driver specifically for the virtualization scenario and can reuse the driver program in the physical environment. However, during full simulation, the internal driver of the virtual machine will frequently access the IO ports of the virtual machine, and a large number of trap and untrap operations will occur under the KVM platform. In addition, when transferring data inside and outside the virtual machine, the copy method can only be carried out in units of bytes and cannot directly adopt the shared memory method, so the access performance is greatly reduced. In the semi-simulation technology, the virtualization device cooperates with the front-end driver and adopts a new event notification and data transfer mechanism, thereby greatly improving the performance. For example, in the behavior of accessing the disk implemented by the virtio-blk controller, io_event_fd is used for front-end to back-end notification, interrupt injection is used for back-end to front-end notification, and data sharing is carried out through the IO ring (Vring).
[0004] In the prior art, it is a common practice in the industry to accelerate Virtio through hardware. Therefore, it is also an inevitable trend to implement virtio_blk hardware acceleration in intelligent network cards. However, mapping the virtio-blk controller to the remote disk at the back end requires mounting many remote disks in the host system, which reduces the network transmission efficiency. Summary of the Invention
[0005] In order to overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a method for optimizing the transmission of a virtual storage controller to solve the problems proposed in the above background art.
[0006] To achieve the above object, the present invention provides the following technical solutions: A method for optimizing the transmission of a virtual storage controller, which is applied to a virtio_blk controller. The virtio_blk controller includes virtio_csr, virtio_adaptor, fetch_index, fetch_ring, fetch_desc, fetch_pkt, mate_builder, slot_adaptor, data_parser, and updata_pkt;
[0007] When a storage packet is lost in the link between the virtio_blk controller and the soc side, the virtio_blk controller processes it;
[0008] When the forwarding of a storage packet is lost due to an exception on the soc side, the virtio_blk controller processes it;
[0009] When there is an abnormal read / write operation on the remote disk and no completion packet is returned, resulting in the loss of a storage packet, the soc side processes it.
[0010] Further, the virtio_csr is a register module of virtio, which is used to cache the common configuration registers and specific configuration registers of the queue corresponding to PF or VF; the virtio_csr is used for register interaction between the driver on the client host side and the device on the FPGA side, and is used for the control channel of the entire virtio;
[0011] The virtio_adaptor is a data channel merging and selection module, which selects channels for multiple dma read / write requests. When the virtio_blk controller initiates a dma read / write request to the client host, multiple request channels are merged into one channel to interact with the client host in a RR polling manner; when the client host responds to the read request of the virtio_blk controller, the returned response data is split and correctly returned to the corresponding channel according to the previously recorded read request order.
[0012] Further, the fetch_index: obtains the notify notification mechanism on the client host side to obtain the headindex in the shared ring of the virtual queue on the client host side; when the notify signal of the corresponding queue is received, the fetch_index obtains the index of the corresponding queue on the client host side and transmits the obtained headindex to the fetch_ring;
[0013] The fetch_ring: obtains the corresponding array value in the shared ring of the virtual queue on the client host side. The index of the array value is headindex, and the content is the index of the first descriptor linked list corresponding to index. When fetch_index inputs information related to index, the fetch_ring obtains the array value, that is, the position index of the first descriptor, from the client host and transfers it to fetch_desc.
[0014] Further, the fetch_desc: obtains the descriptor corresponding to the current headindex in the virtual queue on the client host side, and is driven by the array information transmitted through the fetch_ring. The array contains the first label of the first descriptor in the descriptor linked list. According to the first label, the first descriptor corresponding to index is found. The first descriptor includes the second label of the second descriptor, and the second descriptor is found according to the second label. The second descriptor also includes the third label of the position of the third descriptor, and so on. According to the third label, all descriptor linked lists corresponding to index are found. The linked list composed of the complete descriptors corresponding to the same index of the same virtual queue is arranged in the order of acquisition before and after and is transmitted to mate_builder for processing in one go;
[0015] The mate_builder is the packet header and classifies and transmits the descriptor linked list corresponding to the same index of the same queue. The mate_builder is driven by the descriptor linked list information transmitted through the fetch_desc. When the complete descriptor linked list is received, it will be divided into two parts according to the flag bit in the descriptor. The first part is the descriptor for the write-only client host. The descriptors in the first part form a packet header and are transmitted to fetch_pkt. The second part is the descriptor for the read-only client host, which is also transmitted to fetch_pkt, and the descriptors for the read-only client host need to be consumed by the fetch_pkt.
[0016] Further, the fetch_pkt: obtains the read-only data on the client host side and assembles packets. The fetch_pkt is driven by the two parts of descriptor information transmitted through the mate_builder. The fetch_pkt disassembles and analyzes the descriptors for the read-only client host, obtains the descriptor data on the client host side according to the address + data length in the descriptor, and splices and combines the descriptor data with the packet header composed of the descriptors for the write-only client host to form a storage packet of packet header + data and transmits it to the slot_adaptor;
[0017] The slot_adaptor is an input / output module for the virtio_blk controller to interface with a remote disk. The slot_adaptor has two functions. The first function is to add a first tag to the first storage packet input by the fetch_pkt to indicate that the storage packet is for the virtual queue of the corresponding PF or VF, so that the output storage packet is a complete packet. The second function is to receive the completion packet returned by the remote disk, parse the information of the corresponding PF or VF queue, and transmit the parsed result and the corresponding completion packet information to the data_parser module for processing.
[0018] Furthermore, the data_parser: parses the completion packet from the slot_adaptor. The data_parser is driven by information such as the completion packet transmitted through the slot_adaptor. When receiving the completion packet, in the first step, it strips the packet header and the data part. In the second step, it parses the information such as the write-only client host descriptor carried in the packet header to obtain the parsed information. In the third step, it transmits the parsed information and the remaining data part after stripping to the updata_pkt.
[0019] The updata_pkt is used to monitor the uploaded data, update the used_index on the client host side, and initiate interrupt information. The updata_pkt is driven by information such as the parsed packet transmitted through the data_parser. When the updata_pkt receives the parsed information and the data, according to the write-only client host descriptor in the parsed information, it segments the data and writes it to the client host side memory. After writing the data, it updates the used_index of the shared ring on the client host side and initiates an interrupt instruction to the client host to notify the client host that there is new data update.
[0020] Furthermore, when a storage packet is lost in the link between the virtio_blk controller and the soc side, the processing procedure of the virtio_blk controller includes:
[0021] When the processing on the SOC side is busy and unable to receive the storage packets sent by the virtio_blk controller, the storage packets are hierarchically back-pressured inside the FPGA to the client host side. If the SOC side accidentally resets the transmission channel corresponding to virtio_net_blk, making the transmission channel invalid, the storage packets transmitted from the virtio_blk controller are lost. After virtio_net_blk is received by the SOC side again, the storage packets continue to be transmitted. For this reason, breakpoint processing is performed inside the FPGA. Specifically, before restarting virtio_net_blk, the SOC side actively sends a breakpoint message to the virtio_blk controller. The virtio_blk controller determines that packet loss has occurred for the storage packets. Then, the virtio_blk controller determines the position of the breakpoint through used_index, determines to re-initiate the transmission of the discarded IO, and at the same time, the SOC side has to re-detect the position of the breakpoint.
[0022] Further, when packet loss of the forwarded storage packets is caused by an exception on the SOC side, the processing procedure of the virtio_blk controller includes:
[0023] The SOC side uses the TCP protocol to forward the storage packets and re-establishes the link for transmission. When packet loss of the forwarded storage packets is caused by an exception on the SOC side, the SOC side issues a retransmission instruction.
[0024] Further, when disk read / write at the remote end is abnormal and no completion packet is returned, resulting in packet loss of the storage packets, the processing procedure of the SOC side includes:
[0025] A timeout mechanism is set on the SOC side. If the remote disk does not reply whether the read / write operation is completed within the preset time, the SOC side can actively construct a completion packet and return it to the virtio_blk controller, and mark the status value at the corresponding packet tail as an exception message. After the host receives the corresponding exception message, it processes it by itself, so that the entire transmission is not stuck. If the preset time is exceeded and the remote disk returns a completion message, at the same time, the SOC side deletes the exception message to avoid causing unnecessary errors repeatedly.
[0026] In a second aspect, the present invention provides an electronic device, including: a processor and a memory, wherein a computer program that can be called by the processor is stored in the memory;
[0027] The processor executes the above-mentioned transmission optimization method of a virtual storage controller by calling the computer program stored in the memory.
[0028] In a third aspect, the present invention provides a computer-readable storage medium storing instructions, which when run on a computer, cause the computer to execute the above-mentioned transmission optimization method of a virtual storage controller.
[0029] Technical effects and advantages of the present invention:
[0030] 1. Based on the design of the virtio_blk controller of the intelligent network card, the overall system design framework is optimized. Compared with the pure software implementation, the transmission efficiency of stored data is improved, and the core number overhead of the CPU is saved, achieving multiple benefits at once;
[0031] 2. Based on the breakpoint resumption mechanism of the virtio_blk controller, the problem of lost storage data packets after the abnormal restart of the soc side is ingeniously solved;
[0032] 3. The present invention has good scalability, is compatible with the development of other functions, such as storage live migration, etc. The implemented architecture is clear and has good maintainability. Moreover, it has been successfully developed and tested in practice, and thus needs to be protected even more. Description of the Drawings
[0033] Figure 1 Schematic diagram of the structure of the storage data transmission module implemented in the intelligent network card;
[0034] Figure 2 Schematic diagram of the front-end and back-end structures of virtio_blk in Embodiment 1;
[0035] Figure 3 Schematic diagram of the internal virtio_blk controller structure in the FPGA in Embodiment 1;
[0036] Figure 4 Schematic diagram of the format of the storage request packet output by the virtio_blk controller in Embodiment 2;
[0037] Figure 5 Schematic diagram of the format of the storage completion packet received by the virtio_blk controller from the remote end in Embodiment 2;
[0038] Figure 6 Schematic diagram of an electronic device in Embodiment 3;
[0039] Figure 7 Schematic diagram of a computer-readable storage medium in Embodiment 4. Detailed Embodiments
[0040] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0041] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. The functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor methods and / or microcontroller methods.
[0042] It should be understood that although terms such as "first" and "second" may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, without departing from the scope of the exemplary embodiments, the first unit may be referred to as the second unit, and similarly the second unit may be referred to as the first unit. The term "and / or" used herein includes any and all combinations of one or more of the listed associated items.
[0043] Please refer to Figure 1 as shown, the architecture in the DPU intelligent network card where the virtio_blk controller is located:
[0044] In the intelligent network card, the virtio_blk controller is connected to the client host through a PCIE controller, etc. The read or write operation instructions initiated by the client host are forwarded by the virtio_blk controller, transparently transmitted through the FPGA, and transmitted to the soc side outside the FPGA through the virit_net_blk module. The soc side mainly disassembles, merges, sequences, and forwards storage packets, and then uses the TCP protocol to forward them to the optical port through the virtio_net module, and is connected to the remote switch and disk through an optical fiber to perform read and write operations on block storage.
[0045] Embodiment 1
[0046] The present embodiment discloses and provides a method for optimizing the transmission of a virtual storage controller, including:
[0047] Please refer to Figure 2 as shown, the working principle of the virtio_blk controller:
[0048] It should be noted that when the client host needs to send data packets such as read and write instructions, the data packets are constructed into a logical buffer, filled into the virtqueue, and notified to the back-end through the notify mechanism;
[0049] When the backend receives the notification, if it is not processing other data packets at present, it processes the requests in the first queue; otherwise, it waits for being idle. After the backend becomes idle, it takes out the bufferheadindex from the shared avail_ring of the first queue, finds the corresponding descriptor position in the descriptor table for the address, and obtains the starting information such as the starting address and length of the data to be sent from the corresponding descriptor.
[0050] Based on the starting information, the backend reads the data packet from the client host side, forwards and transmits it to the remote disk for operations such as reading and writing. After the disk read and write operations are completed, the corresponding completion information is returned. The backend fills the completion information into the corresponding buffer of the client host and updates the used_ring. The client host is notified in an interrupt manner. After receiving the interrupt, the client host obtains the updated index from the used_ring, determines whether there is corresponding return information in the buffer. If there is return information, it directly takes it away and releases the buffer space.
[0051] Please refer to Figure 3 As shown, it is the architecture block diagram of the viriot_blk controller implemented inside the FPGA. In the figure, the pcie part is the internal design module of the FPGA, serving as the bridging module between the client host driver and the virtio_blk controller, which will not be elaborated here. This embodiment focuses on the virtio_blk controller;
[0052] The main function of the virtio_blk controller is to interact between the backend device and the frontend, organize and forward a series of read and write operations initiated by the client host to the remote disk system, and move the read and write data of the client host to the remote disk;
[0053] The virtio_blk controller includes modules such as virtio_csr, virtio_adaptor, fetch_index, fetch_ring, fetch_desc, fetch_pkt, mate_builder, slot_adaptor, data_parser, and updata_pkt;
[0054] The virtio_csr is a register module of virtio, which is used to cache the public configuration registers and specific configuration registers of the queue corresponding to the PF or VF. The virtio_csr is used for register interaction between the client host-side driver and the FPGA-side device, and is used for the control channel of the entire virtio. For example, virtio initialization, notify, interrupt, index, ring ring, descriptor corresponding to each virtual queue, and statistical debugging registers, etc., are all handled and connected by the virtio_csr.
[0055] The virtio_adaptor is a data channel merging and selection module that selects channels for multiple DMA read and write requests. When the virtio_blk controller initiates a DMA read and write request to the client host, it merges multiple request channels into one channel using RR polling to interact with the client host. When the client host responds to the read request of the virtio_blk controller, it splits the returned response data and returns it to the corresponding channel in the order of the previously recorded read requests.
[0056] The fetch_index function obtains the notify notification mechanism on the client host side to obtain the headindex in the shared ring of the virtual queue on the client host side; when a notify signal from the corresponding queue is received, the fetch_index function obtains the index of the corresponding queue on the client host side and transmits the obtained headindex to the fetch_ring;
[0057] fetch_ring: obtains the corresponding array value in the shared ring of the virtual queue on the client host side, the index of the array value is headindex, and the content is the index of the first descriptor linked list corresponding to index; when fetch_index inputs index related information, fetch_ring obtains the array value from the client host, that is, the position index of the first descriptor, and passes it to fetch_desc;
[0058] The fetch_desc: Obtain the descriptor corresponding to the current headindex in the virtual queue on the client host side. It is driven by the array information transmitted through the fetch_ring. The array contains the first label of the first descriptor in the descriptor linked list. Find the first descriptor corresponding to the index according to the first label. The first descriptor includes the second label of the second descriptor. Find the second descriptor in the linked list according to the second label. The second descriptor also includes the third label of the position of the third descriptor, and so on. Find all the descriptor linked lists corresponding to the index according to the third label. Arrange the linked list composed of the complete descriptors corresponding to the same index of the same virtual queue in the order of acquisition before and after, and transmit them to the mate_builder for processing in one go;
[0059] The mate_builder is the packet header group, and classifies and transmits the descriptor linked list corresponding to the same index of the same queue. The mate_builder is driven by the descriptor linked list information transmitted through the fetch_desc; when receiving the complete descriptor linked list, it will be divided into two parts according to the flag bits in the descriptor; the first part is the descriptor of the write-only client host. The descriptors in the first part form a packet header and are transmitted to the fetch_pkt; the second part is the descriptor of the read-only client host, which is also transmitted to the fetch_pkt, and the descriptors of the read-only client host need to be consumed by the fetch_pkt;
[0060] The fetch_pkt: Obtain the read-only data on the client host side and packetize it. The fetch_pkt is driven by the two parts of descriptor information transmitted through the mate_builder. The fetch_pkt disassembles and analyzes the descriptors of the read-only client host, obtains the descriptor data on the client host side according to the address + data length in the descriptor, and splices and combines the descriptor data with the packet header composed of the write-only client host descriptors to form a storage packet of packet header + data, and transmits it to the slot_adaptor.
[0061] The slot_adaptor is the input / output module for the virtio_blk controller to dock with the remote disk. The slot_adaptor has two functions. The first function is to add a first mark to the first storage packet input by the fetch_pkt to indicate that a storage packet is the storage packet of the virtual queue corresponding to the corresponding PF or VF, so that the output storage packet is a complete packet; the second function is to receive the completion packet returned by the remote disk, parse the information of the corresponding PF or VF queue, and transmit the parsed result and the corresponding completion packet information to the data_parser module for processing.
[0062] The said data_parser: parses the completion packet from the slot_adaptor. The data_parser is driven by information such as the completion packet transmitted through the slot_adaptor. When receiving the completion packet, in the first step, it strips the packet header and the data part. In the second step, it parses information such as the write-only client host descriptor carried in the packet header to obtain the parsed information. In the third step, it transmits the parsed information and the remaining data part after stripping to updata_pkt.
[0063] The said updata_pkt is used to monitor the uploaded data, update the used_index on the client host side, and initiate interrupt information. The updata_pkt is driven by information such as the parsed packet transmitted through the data_parser. When the updata_pkt receives the parsed information and the data, according to the write-only client host descriptor in the parsed information, it writes the data in segments to the memory on the client host side. After writing the data, it updates the used_index of the shared ring on the client host side, and issues an interrupt instruction to the client host to notify the client host that there is new data update.
[0064] Starting from the initialization configuration of virtio_csr, fetch_index receives the notify notification from the client host, until the updata_pkt issues an interrupt instruction to notify the client host that the read and write are completed, the virtio_blk controller completes a complete forwarding work of an IO.
[0065] When the storage packet is lost between the virtio_blk controller and the soc side, the processing process of the virtio_blk controller includes:
[0066] When the soc side is busy and unable to receive the storage packet sent by the virtio_blk controller, the storage packet is hierarchically back-pressured to the client host side inside the FPGA. If the soc side accidentally resets the transmission channel corresponding to the virtio_net_blk, making the transmission channel invalid, the storage packet transmitted from the virtio_blk controller is lost. After the virtio_net_blk is received by the soc side again, the storage packet continues to be transmitted. For this reason, breakpoint processing is carried out inside the FPGA. Specifically, before the soc side restarts the virtio_net_blk, it actively sends a breakpoint message to the virtio_blk controller. The virtio_blk controller determines that the storage packet is lost. Then the virtio_blk controller determines the position of the breakpoint through the used_index, determines to re-initiate the transmission of the discarded IO, and at the same time the soc side has to re-detect the position of the breakpoint;
[0067] When the forwarding storage packet is lost due to an exception on the SOC side, the processing procedure of the virtio_blk controller includes:
[0068] The SOC side uses the TCP protocol to forward the storage packet and rebuilds the link for transmission. When the forwarding storage packet is lost due to an exception on the SOC side, the SOC side issues a retransmission instruction.
[0069] When the remote disk has abnormal read and write operations and no completion packet is returned, resulting in the loss of the storage packet, the processing procedure on the SOC side includes:
[0070] Set a timeout mechanism on the SOC side. If the remote disk does not reply whether the read and write operations are completed within the preset time, the SOC side can actively construct a completion packet and return it to the virtio_blk controller, and mark the status value of the corresponding packet tail as an exception message. After the host receives the corresponding exception message, it processes it by itself, so that the entire transmission does not get stuck. If the preset time is exceeded and the remote disk returns a completion message, at the same time, the SOC side deletes the exception message to avoid causing unnecessary errors repeatedly;
[0071] This embodiment is based on the design and optimization of the virtio_blk controller of the smart network card. Compared with the prior art, in this embodiment, some functions of the storage backend are implemented on the FPGA, which has high practicability, ingenious design, solves the industry problem of lost I / O, and has a clear and concise design architecture, consuming less FPGA on-chip resources.
[0072] Embodiment 2
[0073] Based on Embodiment 1, this embodiment sets the storage packet format in the viriio_blk controller.
[0074] It should be noted that due to the characteristics of storage I / O operations, for each read or write request, there must be a corresponding return notification to indicate whether the request command data is successfully operated, and carry the data information read back. The packet composed of the request command data, etc. is the storage request packet, and the packet composed of the return notification is the storage completion packet.
[0075] Please refer to Figure 4 as shown, the format of the storage request packet output by the virtio_blk controller;
[0076] Please refer to Figure 5 as shown, the format of the storage completion packet returned by the remote end received by the virtio_blk controller; where the format address starts from the upper right corner, increases from right to left until the lower left corner, and each line is aligned with 512 bits for easy processing inside the FPGA, and the 512-bit bit width corresponding to a line is filled and padded by rsv and padding.
[0077] Specifically, the format information of the storage packet is described as follows:
[0078] As Figure 1 shown, virtio_net_head: a reserved 96-bit space, which is filled by virtio_net_blk when the storage packet is transmitted through virtio_net_blk, enabling interaction between virtio_net_blk and the soc side;
[0079] PF+VF+qid: 32-bit width, indicating which queue in the corresponding PF or VF on the client host side the storage packet belongs to, equivalent to the identity tag of the storage packet;
[0080] Rsv: Reserved bit, with no actual function;
[0081] Information: The indication information carried by the storage packet, where the indication information includes indicating that the storage packet carries n descriptors for the write-only client host, the index value corresponding to the storage packet, and the packet length information, etc.
[0082] desc_0 to desc_n: Descriptors for the write-only client host, and the specific number is specified by the information in information;
[0083] Padding: Padding invalid bits to make up a 512-bit data width;
[0084] Type: Indicates whether the storage packet is used for read disk operation or write disk operation;
[0085] Sector: Indicates the starting position of the sector for reading and writing the disk;
[0086] write_data: Data for writing to the disk, with a size that is an integer multiple of 512 bytes, placed at the end of the storage packet;
[0087] read_data: Data read from the disk, with a size that is an integer multiple of 512 bytes;
[0088] Status: Status indication signal, indicating whether the operation is successful.
[0089] Embodiment 3
[0090] Please refer to Figure 6 shown, this embodiment provides an electronic device, including: a processor and a memory, where a computer program that can be called by the processor is stored in the memory;
[0091] The processor executes the transmission optimization method of a virtual storage controller according to Embodiment 1 by calling a computer program stored in the memory.
[0092] Embodiment 4
[0093] Please refer to Figure 7 As shown, this embodiment provides a computer-readable storage medium storing instructions that, when run on a computer, cause the computer to execute the transmission optimization method of a virtual storage controller according to Embodiment 1.
[0094] The formulas involved above are all calculated by removing the dimension and taking their numerical values. They are obtained by collecting a large amount of data for software simulation to get a formula closest to the actual situation. The weight factors in the formula and each preset threshold in the analysis process are set by those skilled in the art according to the actual situation or obtained through a large amount of data simulation; the size of the weight factor is a specific value obtained by quantifying each parameter, which is convenient for subsequent comparison. Regarding the size of the weight factor, it depends on the amount of sample data and the processing coefficients initially set by those skilled in the art for each group of sample data; as long as the proportional relationship between the parameters and the quantified values is not affected.
[0095] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired network. The computer-readable storage medium can be any available medium that the computer can access or a data storage device such as a server or data center including one or more collections of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
[0096] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0097] Those skilled in the art can clearly understand that for the convenience and conciseness of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0098] In several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only one way, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.
[0099] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0100] In addition, the functional units in each embodiment of this application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0101] When the above-mentioned functions are implemented in the form of software function units and sold or used as independent products, they 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 this 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 for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks, or optical discs.
[0102] As described above, the above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.
[0103] Finally: The above is only the preferred embodiment of the present invention and is not used to limit the present invention. Any modifications, equivalent substitutions, improvements, 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 transmission optimization method for a virtual storage controller, characterized in that Applied to the virtio_blk controller, the virtio_blk controller includes virtio_csr, virtio_adaptor, fetch_index, fetch_ring, fetch_desc, fetch_pkt, mate_builder, slot_adaptor, data_parser, and updata_pkt; the virtio_csr is a register module of virtio, used to cache the common configuration registers and specific configuration registers of the queue corresponding to PF or VF; the virtio_adaptor is a data channel merging and selection module, which selects channels for multiple dma read and write requests; the fetch_index: obtains the notify notification mechanism on the client host side; the fetch_ring obtains the corresponding array values in the shared ring of the virtual queue on the client host side; the fetch_desc obtains the descriptor corresponding to the current headindex in the virtual queue on the client host side; the mate_builder forms a group header and classifies and transmits the descriptor linked list corresponding to the same index of the same queue; the fetch_pkt obtains the read-only data on the client host side and forms a packet; the slot_adaptor is an input / output module for the virtio_blk controller to interface with the remote disk; the data_parser: parses the completion packet from the slot_adaptor; the updata_pkt is used to monitor the uploaded data, update the used_index on the client host side, and initiate interrupt information; When storage packets are lost in the link between the virtio_blk controller and the soc side, the virtio_blk controller processes them; When the soc side exception causes the forwarding storage packets to be lost, the virtio_blk controller processes them; When the remote disk has abnormal read and write operations and no completion packet is returned, resulting in the loss of storage packets, the soc side processes them.
2. The transmission optimization method of a virtual storage controller according to claim 1, characterized in that The virtio_csr is used for register interaction between the client host side driver and the FPGA side device and is used for the control channel of the entire virtio; When the virtio_blk controller initiates a dma read and write request to the client host, multiple request channels are merged into one channel to interact with the client host in a RR polling manner; when the client host responds to the read request of the virtio_blk controller, the returned response data is split and correctly returned to the corresponding channels according to the previously recorded read request order.
3. The transmission optimization method of a virtual storage controller according to claim 2, wherein, To obtain the head index in the shared ring of the virtual queue on the client host side; when receiving the notify signal corresponding to the queue, fetch_index obtains the index of the corresponding queue on the client host side and transmits the obtained head index to the fetch_ring; The index of the array value is the head index, and the content is the index of the first descriptor linked list corresponding to the index; when fetch_index inputs the index-related information, fetch_ring obtains the array value from the client host, that is, the position index of the first descriptor, and passes it to fetch_desc.
4. The transmission optimization method of a virtual storage controller according to claim 3, characterized in that Driven by the array information transmitted through fetch_ring, the array contains the first label of the first descriptor in the descriptor linked list. According to the first label, the first descriptor corresponding to the index is found. The first descriptor includes the second label of the second descriptor. According to the second label, the second descriptor of the linked list is found. The second descriptor also includes the third label of the position of the third descriptor. According to the third label, all descriptor linked lists corresponding to the index are found. The linked list composed of the complete descriptors corresponding to the same index of the same virtual queue is arranged in the order of acquisition before and after and transmitted to mate_builder for processing in one go; mate_builder is driven by the descriptor linked list information transmitted through fetch_desc; When receiving the completed descriptor linked list, it will be divided into two parts according to the flag bits in the descriptor; the first part is the descriptor that only writes to the client host. The descriptors of the first part form a packet header and are transmitted to fetch_pkt; the second part is the descriptor that only reads from the client host, which is also transmitted to fetch_pkt, and the descriptor that only reads from the client host needs to be consumed by fetch_pkt.
5. The transmission optimization method of a virtual storage controller according to claim 4, characterized in that, fetch_pkt is driven by the two parts of descriptor information transmitted through mate_builder. fetch_pkt disassembles and analyzes the descriptor that only reads from the client host, obtains the descriptor data on the client host side according to the address + data length in the descriptor, and splices and combines the descriptor data with the packet header composed of the descriptor that only writes to the client host to form a storage packet of packet header + data and transmits it to slot_adaptor; slot_adaptor has two functions. The first function is to add a first mark to the first storage packet input by fetch_pkt to indicate that a storage packet is the storage packet of the virtual queue corresponding to the PF or VF, so that the output storage packet is a complete packet; The second function is to receive the completion packet returned by the remote disk, parse the information of the corresponding PF or VF queue, and transmit the parsed result and the corresponding completion packet information to the data_parser module for processing.
6. The transmission optimization method of a virtual storage controller according to claim 5, characterized in that The data_parser is driven by the completion packet information transmitted through the slot_adaptor. When a completion packet is received, in the first step, the packet header and the data part are stripped. In the second step, the write-only client host descriptor information carried in the packet header is parsed to obtain the parsed information. In the third step, the parsed information and the remaining data part after stripping are transmitted to updata_pkt. updata_pkt is driven by the parsed information transmitted by the data_parser. When updata_pkt receives the parsed information and the data, according to the write-only client host descriptor in the parsed information, the data is segmented and written to the client host side memory. After writing the data, the used_index of the shared ring on the client host side is updated, and an interrupt instruction is sent to the client host to notify the client host that there is new data update.
7. The transmission optimization method of a virtual storage controller according to claim 6, characterized in that When the storage packets are lost in the link between the virtio_blk controller and the soc side, the processing process of the virtio_blk controller includes: When the soc side is busy processing and cannot receive the storage packets sent by the virtio_blk controller, the storage packets are hierarchically back-pressured to the client host side inside the FPGA. If the soc side accidentally resets the transmission channel corresponding to virtio_net_blk, making the transmission channel invalid and causing the storage packets transmitted from the virtio_blk controller to be lost, when virtio_net_blk is received by the soc side again, the storage packets continue to be transmitted. For this reason, breakpoint processing is performed inside the FPGA. Specifically, before the soc side restarts virtio_net_blk, it actively sends a breakpoint message to the virtio_blk controller. The virtio_blk controller determines that the storage packets are lost. Then, the virtio_blk controller determines the position of the breakpoint through the used_index, determines to re-initiate the transmission of the discarded IO, and at the same time, the soc side has to re-detect the position of the breakpoint.
8. The transmission optimization method of a virtual storage controller according to claim 7, characterized in that, When the soc side anomaly causes the forwarded storage packets to be lost, the processing process of the virtio_blk controller includes: The soc side forwards the storage packets using the TCP protocol and re-establishes the link for transmission. When the soc side anomaly causes the forwarded storage packets to be lost, the soc side issues a retransmission instruction.
9. The transmission optimization method of a virtual storage controller according to claim 8, characterized in that, When the remote disk has abnormal read and write operations and no completion packet is returned, resulting in the loss of storage packets, the processing process of the soc side includes: A timeout mechanism is set on the soc side. If the remote disk does not reply whether the read and write operations are completed within the preset time, the soc side can actively construct a completion packet and return it to the virtio_blk controller, and mark the status value of the corresponding packet tail as an abnormal message. After the host receives the corresponding abnormal message, it processes it by itself, so that the entire transmission is not stuck. If the preset time is exceeded and the remote disk returns the completion information, at the same time, the soc side deletes the abnormal message to avoid causing unnecessary errors repeatedly.
10. An electronic device, characterized in that, Including: A processor and a memory, wherein, computer programs that can be called by the processor are stored in the memory; The processor executes a transmission optimization method of a virtual storage controller according to any one of claims 1-9 by calling a computer program stored in the memory.
Citation Information
Patent Citations
Chip simulation verification system
CN114818599A