US-12619569-B2 - IO processing method and apparatus
Abstract
This application provides an IO request processing method, used in an external device. The external device includes a processor and a first hardware interface, and the first hardware interface is an interface that supports a PCIe protocol. The external device communicates with a physical host through the first hardware interface. The method includes: The processor synchronizes, through the first hardware interface, queue information in storage space of a virtual machine running on the physical host to storage space of the external device, where the queue information includes one or more input/output IO requests; and the processor sends the one or more IO requests to a storage server or a network server for processing. According to this application, all hardware resources of the physical host can be used to provide virtual machine services for users, thereby improving utilization of hardware resources of the physical host.
Inventors
- Bin Wu
- Jinsong Liu
Assignees
- HUAWEI TECHNOLOGIES CO., LTD.
Dates
- Publication Date
- 20260505
- Application Date
- 20240711
- Priority Date
- 20190629
Claims (20)
- 1 . A method for input/output (IO) request processing, wherein the method is used in an external device, the external device comprises at least one processor and a first hardware interface, the first hardware interface supports a high-speed serial computer extended bus standard peripheral component interconnect express (PCIe) protocol, the external device communicates with a physical host through the first hardware interface, and the method comprises: receiving, by the at least one processor, a configuration message, wherein the configuration message is used to indicate to configure a protocol type of a first IO interface of the external device to a first IO protocol, the first IO interface is run on the first hardware interface, the first IO interface is a virtual interface of the first hardware interface, the first IO interface corresponds to a virtual machine and is adapted to process one or more IO requests sent by the virtual machine to the first IO interface, and at least one of a data type or a data size of at least one IO request in a storage space of the virtual machine is associated with the first IO protocol; and configuring, by the at least one processor, the protocol type of the first IO interface to the first IO protocol based on the configuration message; synchronizing, by the at least one processor through the first hardware interface, queue information in the storage space of the virtual machine running on the physical host to storage space of the external device, wherein the queue information comprises the one or more IO requests sent by the virtual machine; and sending, by the at least one processor, the one or more IO requests to a storage server or a network server for processing.
- 2 . The method according to claim 1 , wherein the synchronizing comprises determining, based on the first IO protocol corresponding to the first IO interface, a data size of one of the at least one IO request in the storage space of the virtual machine.
- 3 . The method according to claim 1 , wherein before the synchronizing, by the at least one processor through the first hardware interface, queue information in the storage space of the virtual machine running on the physical host to storage space of the external device, the method further comprises: receiving, by the first hardware interface, a PCIe message sent by the physical host, wherein the PCIe message is used to indicate to the external device that there is a to-be-processed IO request; and sending, by the first hardware interface, an interrupt request to the at least one processor; wherein the synchronizing includes synchronizing, by the at least one processor through the first hardware interface, the queue information in the storage space of the virtual machine to the storage space of the external device based on the interrupt request.
- 4 . The method according to claim 1 , wherein the synchronizing, by the at least one processor through the first hardware interface, queue information in the storage space of the virtual machine running on the physical host to storage space of the external device comprises: indicating, by the at least one processor by using a direct memory access (DMA) technology, the first hardware interface to synchronize the queue information in the storage space of the virtual machine to the storage space of the external device.
- 5 . The method according to claim 1 , wherein the method further comprises: after the synchronizing, invoking an IO protocol processing module corresponding to the first IO protocol of the IO interface to read synchronized queue information from the storage space of the external device; and determining whether there is a to-be-processed IO request.
- 6 . The method according to claim 1 , wherein the method further comprises: obtaining, from the storage server or the network server by the at least one processor, an IO response corresponding to one of the one or more IO requests; and storing, by the at least one processor, the IO response into the storage space of the virtual machine through the first hardware interface.
- 7 . The method according to claim 6 , wherein the storing, by the at least one processor, the IO response into the storage space of the virtual machine through the first hardware interface comprises: indicating, by the at least one processor by using a direct memory access (DMA) technology, the first hardware interface to store the IO response into the storage space of the virtual machine.
- 8 . The method according to claim 6 , wherein the method further comprises: storing, by the at least one processor through the first hardware interface, IO responses corresponding to a plurality of the one or more IO requests into the storage space of the virtual machine, and sending a notification message to the physical host through the first hardware interface, wherein the notification message is used to notify the physical host that the plurality of the one or more IO requests have been processed.
- 9 . An external device, wherein the external device comprises at least one processor, a receiver, a transmitter, and a first hardware interface, wherein: the receiver is adapted to receive a configuration message, wherein the configuration message is used to indicate to configure a protocol type of a first input/output (IO) interface of the external device to a first IO protocol, the first IO interface is run on the first hardware interface, the first IO interface is a virtual interface of the first hardware interface, the first IO interface corresponds to a virtual machine and is adapted to process one or more IO requests sent by the virtual machine to the first IO interface, and at least one of a data type or a data size of at least one IO request in a storage space of the virtual machine is associated with the first IO protocol; and the at least one processor is adapted to configure the protocol type of the first IO interface to the first IO protocol based on the configuration message; the first hardware interface is adapted to communicate with a physical host, and the first hardware interface supports a high-speed serial computer extended bus standard peripheral component interconnect express (PCIe) protocol; the at least one processor is adapted to synchronize, through the first hardware interface, queue information in the storage space of the virtual machine running on the physical host to storage space of the external device, wherein the queue information comprises the one or more IO requests sent by the virtual machine; and the transmitter is adapted to send the one or more IO requests to a storage server or a network server for processing.
- 10 . The external device according to claim 9 , wherein the first hardware interface is further adapted to: receive a PCIe message sent by the physical host, wherein the PCIe message is used to indicate to the external device that there is a to-be-processed IO request; and send an interrupt request to the at least one processor in the external device based on the PCIe message; and the receiver is adapted to: synchronize, through the first hardware interface, the queue information in the storage space of the virtual machine to the storage space of the external device based on the interrupt request.
- 11 . The external device according to claim 9 , wherein the receiver is adapted to: indicate, by using a direct memory access (DMA) technology, the first hardware interface to synchronize the queue information in the storage space of the virtual machine to the storage space of the external device.
- 12 . An external device, comprising: at least one processor, a first hardware interface, and at least one memory, wherein the at least one memory is coupled to the at least one processor and stores instructions that, when executed by the at least one processor, cause the at least one processor to perform operations comprising: receiving, by the at least one processor, a configuration message, wherein the configuration message is used to indicate to configure a protocol type of a first input/output (IO) interface of the external device to a first IO protocol, the first IO interface is run on the first hardware interface, the first IO interface is a virtual interface of the first hardware interface, the first IO interface corresponds to a virtual machine and is adapted to process one or more IO requests sent by the virtual machine to the first IO interface, and at least one of a data type or a data size of at least one IO request in a storage space of the virtual machine is associated with the first IO protocol; and configuring, by the at least one processor, the protocol type of the first IO interface to the first IO protocol based on the configuration message; synchronizing, through the first hardware interface, queue information in the storage space of the virtual machine running on a physical host to storage space of the external device, wherein the queue information comprises the one or more IO requests sent by the virtual machine; and sending the one or more IO requests to a storage server or a network server for processing.
- 13 . The external device according to claim 12 , wherein the synchronizing comprises determining, based on the first IO protocol corresponding to the first IO interface, a data size of one of the at least one IO request in the storage space of the virtual machine.
- 14 . The external device according to claim 12 , wherein before the synchronizing, the operations further comprise: receiving a PCIe message sent by the physical host, wherein the PCIe message is used to indicate to the external device that there is a to-be-processed IO request; and sending an interrupt request to the at least one processor; and synchronizing, through the first hardware interface, the queue information in the storage space of the virtual machine to the storage space of the external device based on the interrupt request.
- 15 . The external device according to claim 12 , wherein the synchronizing comprises: indicating, by using a direct memory access (DMA) technology, the first hardware interface to synchronize the queue information in the storage space of the virtual machine to the storage space of the external device.
- 16 . The external device according to claim 12 , wherein the operations comprise: obtaining, from the storage server or the network server by the at least one processor, an IO response corresponding to one of the one or more IO requests; and storing the IO response into the storage space of the virtual machine through the first hardware interface.
- 17 . The external device according to claim 16 , wherein the storing the IO response into the storage space of the virtual machine through the first hardware interface comprises: indicating, by using a direct memory access (DMA) technology, the first hardware interface to store the IO response into the storage space of the virtual machine.
- 18 . The external device according to claim 16 , wherein the operations comprise: storing, through the first hardware interface, IO responses corresponding to a plurality of the one or more IO requests into the storage space of the virtual machine, and sending a notification message to the physical host through the first hardware interface, wherein the notification message is used to notify the physical host that the plurality of the one or more IO requests have been processed.
- 19 . The external device according to claim 12 , wherein the operations comprise: after the synchronizing, invoking an IO protocol processing module corresponding to the first IO protocol of the IO interface to read synchronized queue information from the storage space of the external device; and determining whether there is a to-be-processed IO request.
- 20 . The external device according to claim 12 , wherein the first hardware interface is an end point (EP) chip, and the operations comprise: synchronizing a mapping relationship between the first IO interface and a corresponding IO protocol to a register in the EP chip.
Description
CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation of U.S. patent application Ser. No. 17/564,064, filed on Dec. 28, 2021, which is a continuation of International Application No. PCT/CN2020/095899, filed on Jun. 12, 2020, which claims priority to Chinese Patent Application No. 201910582537.6, filed on Jun. 29, 2019. All of the aforementioned patent applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD This application relates to the virtualization field, and more specifically, to an IO processing method and apparatus, and a computer-readable storage medium. BACKGROUND A virtualization technology is used to virtualize hardware resources of a computer device to share virtualized hardware resources to a plurality of users, so that users can conveniently and flexibly use the hardware resources of the computer device on the premise of secure isolation, and utilization of the hardware resources can be greatly improved. A computing virtualization technology may be used to convert hardware computing resources of the computer device into virtual computing resources to share the virtual computing resources to users of a plurality of virtual machines. An IO virtualization technology is used to convert a physical storage resource and a physical network resource into a virtual storage resource and a virtual network resource, to process IO requests delivered by virtual machines running on the computer device. During virtualization for the computer device, some hardware computing resources are required for IO virtualization, and therefore, not all hardware resources of the computer device can be shared to users. In addition, by using the IO virtualization technology, more hardware resources are required as a quantity of IO requests of virtual machines increases. Therefore, in a multi-user scenario such as a public cloud scenario, when there are a large quantity of IO requests of a plurality of users, resource contention occurs when hardware resources are insufficient. As a result, service performance greatly fluctuates and user experience deteriorates. Therefore, currently, how to share all hardware resources of the computer device to users to avoid contention between hardware resources of the computer device becomes a problem that needs to be urgently resolved. SUMMARY This application provides an IO request processing method and an apparatus, so that all hardware resources of a physical host can be used to provide virtual machine services for users, to improve utilization of the hardware resources of the physical host. According to a first aspect, an IO request processing method is provided, where the method is used in an external device. The external device includes a processor and a first hardware interface, and the first hardware interface is an interface that supports a high-speed serial computer extended bus standard PCIe protocol. The external device communicates with a physical host through the first hardware interface. The method includes: The first processor synchronizes, through the first hardware interface, queue information in storage space of a virtual machine running on the physical host to storage space of the external device. The queue information includes one or more input/output IO requests sent by the virtual machine. The processor sends the one or more IO requests to a storage server or a network server for processing. In the foregoing technical solution, the physical host is connected to the external device, and the external device processes the IO request sent by the virtual machine running on the physical host. In this way, the IO request delivered by the virtual machine is directly transmitted to the external device of the physical host for processing, so that physical computing resource consumption resulting from IO virtualization for the physical host can be avoided, and all hardware resources of the physical host are used to provide virtual machine services for users. This improves utilization of the hardware resources of the physical host. In a possible implementation, the method further includes: The processor receives a configuration message, where the configuration message is used to indicate to configure a protocol type of a first IO interface of the external device to a first IO protocol. A plurality of first IO interfaces are run on the first hardware interface. The first IO interface is a virtual interface of the first hardware interface. The first IO interface corresponds to the virtual machine and is adapted to process the one or more IO requests sent by the virtual machine to the first IO interface. A data type and/or a data size of the one or more IO requests in the storage space of the virtual machine are associated with the first IO protocol. The first processor configures the protocol type of the first IO interface to the first IO protocol based on the configuration message. In the foregoing technical solution, the IO int