Forwarding method, computer device and medium for data processor

Through bidirectional verification and feature handshake in virtualization technology, the delay and storage resource occupation problems caused by the difference in queue resource management methods between virtual devices and data processors are solved, and efficient traffic forwarding and resource management are achieved.

CN118331747BActive Publication Date: 2024-08-23ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410752787.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-12
Publication Date
2024-08-23
Estimated Expiration
2044-06-12

AI Technical Summary

Technical Problem

In virtualization technology, when software and hardware collaborate to implement traffic forwarding, it may cause large delay overhead and occupy large storage resources, especially due to the differences in queue resource management methods between virtual devices and data processors. compatibility.

Method used

Through bidirectional verification on the driver side and logical side of the host, the virtual device driver and the virtual device controller of the data processor are used to perform feature handshakes to determine whether the virtual device has hardware queue index access capabilities, and selectively forward based on the results. process to reduce the delay overhead and storage resource usage caused by table lookup conversion.

Benefits of technology

It effectively saves the delay overhead and storage resource occupation caused by queue conversion, is compatible with different versions of virtualization architecture and device characteristics, supports customized requirements for input and output resources, and realizes the dynamic issuance and recycling of PCIe devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118331747B
    Figure CN118331747B
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides a forwarding method, computer device and medium for a data processor. The method includes: loading a first virtual device through a virtual device driver; performing a feature handshake with the first virtual device according to a first input-output virtualization protocol through a virtual device controller to determine whether it has a first feature; when the first feature is not present, sending a queue conversion table entry to a queue conversion module through a virtual device controller, and then converting the virtual queue index into a hardware queue index; when the first feature is present, the virtual device driver obtains the hardware queue index, and through the virtual device driver, the doorbell notification carries the hardware queue index. In this way, storage resource usage is reduced and input-output processing delay is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a forwarding method, computer equipment and medium for a data processor. Background Art

[0002] Virtualization technology abstracts and transforms various physical resources (such as processors, memory, hard disks, network adapters and other input and output devices) to obtain a virtual computer environment that can be divided and reassembled. Virtualization technology can be divided into full virtualization technology that provides a complete virtual platform, and semi-virtualization technology that customizes and modifies the operating system and schedules access to hardware resources. With the development of cloud computing, data centers and other applications, it is necessary to allocate input and output resources such as input and output queue resources according to customer needs. Considering the differences between various virtualization technology frameworks, virtual devices, and the impact of dynamic device issuance and dynamic device recovery, the coordination of software and hardware to achieve traffic forwarding may result in large latency overhead and occupy large storage resources. For example, the device driver on the virtual machine used to drive the virtual device may adopt a queue resource management method different from that of the data processing unit (DPU).

[0003] To this end, the present application provides a forwarding method, computer device and medium for a data processor, which are used to address the technical difficulties in the prior art. Summary of the invention

[0004] In the first aspect, the present application provides a forwarding method for a data processor. The forwarding method includes: loading a first virtual device through a virtual device driver on the driver side of a host machine; performing a feature handshake with the first virtual device according to a first input-output virtualization protocol through a virtual device controller of a data processor on the logical side of the host machine to determine whether the first virtual device has a first feature, wherein the first feature is an extension of a standard feature specified by the first input-output virtualization protocol and is used to indicate hardware queue index access capability; when the first virtual device does not have the first feature, the queue conversion table entry is sent to the queue conversion module of the data processor through the virtual device controller, and then, through the queue conversion module, based on the queue conversion table entry, the virtual queue index carried by the doorbell notification of the first virtual device is converted into the hardware queue index of the data processor; when the first virtual device has the first feature, the virtual device driver obtains the hardware queue index of the data processor, and through the virtual device driver, the doorbell notification of the first virtual device carries the hardware queue index of the data processor.

[0005] Through the first aspect of the present application, it is applied to application scenarios such as cloud computing, data centers, and high-performance servers, and two-way verification is performed from the driver side and the logic side. The virtual device controller of the data processor on the logic side verifies whether the first virtual device has the first characteristic, that is, the ability to indicate the hardware queue index access capability, and the virtual device driver on the driver side verifies whether the data processor has the ability to directly provide the hardware queue index. According to whether the first virtual device has the first characteristic, the corresponding forwarding process is selectively adopted, thereby saving the delay overhead caused by the table lookup conversion and the storage resources required for the queue conversion; by utilizing the characteristic handshake mechanism and two-way verification, combined with the queue conversion module of the data processor, it can be compatible with different versions of virtualization architectures and various device characteristics and input and output customization requirements; by utilizing the existing virtual device loading process and characteristic handshake process between the data processor and the first input and output virtualization protocol, it supports users to customize input and output resources and supports the dynamic issuance and dynamic recovery of PCIe devices, effectively coping with the impact of the queue resource management method of the device driver being different from the queue resource management method of the data processor on the coordination of software and hardware.

[0006] In a possible implementation manner of the first aspect of the present application, when the first virtual device does not have the first characteristic, the data path between the first virtual device and the data processor includes the queue conversion module.

[0007] In a possible implementation of the first aspect of the present application, when the first virtual device has the first characteristic, the data path between the first virtual device and the data processor does not pass through the queue conversion module, and the data processor uses the hardware queue index of the data processor carried by the doorbell notification of the first virtual device to forward traffic.

[0008] In a possible implementation manner of the first aspect of the present application, when the first virtual device has the first characteristic, the doorbell notification of the first virtual device does not carry the virtual queue index of the first virtual device.

[0009] In a possible implementation manner of the first aspect of the present application, the hardware queue index of the data processor is determined based on an input and output queue resource pool of the data processor.

[0010] In a possible implementation manner of the first aspect of the present application, the virtual queue index of the first virtual device is determined based on virtualized input and output queue resources of the first virtual device.

[0011] In a possible implementation of the first aspect of the present application, the forwarding method also includes: through the virtual device controller, performing a feature handshake with the first virtual device in accordance with the first input-output virtualization protocol to determine whether the first virtual device has a second feature, wherein the second feature is an extension of the standard feature specified by the first input-output virtualization protocol and is used to indicate a security isolation requirement; when the first virtual device has the second feature, determining through the security verification module of the data processor whether the hardware queue index of the data processor is used by another virtual device different from the first virtual device, if so, determining that the security isolation requirement of the first virtual device is not met, and if not, determining that the security isolation requirement of the first virtual device is met.

[0012] In a possible implementation of the first aspect of the present application, through the security verification module of the data processor, when the peripheral component interconnect address of the message header of the doorbell notification of the first virtual device does not match the peripheral component interconnect address of the hardware queue index of the data processor, it is judged that the security isolation requirement of the first virtual device is not met, and when the peripheral component interconnect address of the message header of the doorbell notification of the first virtual device matches the peripheral component interconnect address of the hardware queue index of the data processor, it is judged that the security isolation requirement of the first virtual device is met.

[0013] In a possible implementation of the first aspect of the present application, when the first virtual device has the first characteristic and the second characteristic, the data path between the first virtual device and the data processor does not pass through the queue conversion module and includes the security verification module.

[0014] In a possible implementation of the first aspect of the present application, when the security isolation requirement of the first virtual device is met, the data processor uses the hardware queue index of the data processor carried by the doorbell notification of the first virtual device to forward traffic.

[0015] In a possible implementation of the first aspect of the present application, whether the first virtual device has the first characteristic depends on the version of the virtual device driver, the version of the server operating system of the host machine, and the manufacturer of the data processor.

[0016] In a possible implementation manner of the first aspect of the present application, the first input and output virtualization protocol is a Virtio protocol.

[0017] In a possible implementation manner of the first aspect of the present application, the first virtual device supports single-root input and output virtualization.

[0018] In a second aspect, an embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method according to any one of the implementation modes of any of the above aspects when executing the computer program.

[0019] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects.

[0020] In a fourth aspect, an embodiment of the present application further provides a computer program product, which includes instructions stored on a computer-readable storage medium, and when the instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 A flowchart of a forwarding method for a data processor provided in an embodiment of the present application;

[0023] Figure 2 A schematic diagram of a data processor provided in an embodiment of the present application;

[0024] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0026] It should be understood that, in the description of this application, "at least one" means one or more, and "a plurality of" means two or more. In addition, unless otherwise specified, the words "first", "second", etc. are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.

[0027] Figure 1 A flow chart of a forwarding method for a data processor provided in an embodiment of the present application. Figure 1As shown, the forwarding method for a data processor includes the following steps.

[0028] Step S110: loading the first virtual device through the virtual device driver on the driver side of the host machine.

[0029] Step S120: Through the virtual device controller of the data processor on the logical side of the host machine, a feature handshake is performed with the first virtual device in accordance with a first input-output virtualization protocol to determine whether the first virtual device has a first feature, wherein the first feature is an extension of a standard feature specified by the first input-output virtualization protocol and is used to indicate hardware queue index access capability.

[0030] Step S130: When the first virtual device does not have the first characteristic, the queue conversion table entry is sent to the queue conversion module of the data processor through the virtual device controller, and then, through the queue conversion module, based on the queue conversion table entry, the virtual queue index carried by the doorbell notification of the first virtual device is converted into the hardware queue index of the data processor.

[0031] Step S140: When the first virtual device has the first characteristic, the virtual device driver obtains the hardware queue index of the data processor, and through the virtual device driver, the doorbell notification of the first virtual device carries the hardware queue index of the data processor.

[0032] Figure 1The forwarding method for a data processor shown is suitable for application scenarios such as cloud computing, data centers, high-performance servers, etc., where various virtualization technologies and paravirtualization technologies are applied. Among them, virtualization technology abstracts and transforms various physical resources (such as processors, memory, hard disks, network adapters and other input and output devices) to obtain a virtual computer environment that can be divided and reassembled. Virtualization technology can be divided into full virtualization technology that provides a complete virtual platform and paravirtualization technology that customizes and modifies the operating system and schedules hardware resource access. In the application field of cloud computing and data centers, Virtio belongs to paravirtualization technology, which is used in network virtualization, including network device virtualization, link virtualization, etc. It is a common technical framework and technical standard. The paravirtualization solution provided by Virtio adopts technologies such as Data Plane Development Kit (DPDK), hardware offload, and single-root input and output virtualization, providing hardware offload and acceleration of the data plane, as well as separation of the data plane and the control plane. Taking the Virtio protocol as an example of an input and output virtualization protocol, the Virtio protocol unifies the front-end drivers of different devices through a common framework and standard interface for the input and output of virtual devices, and then cooperates with the back-end driver, so that there is no need to define a set of interfaces for each device, which improves the input and output performance. Specifically, according to the relevant specifications of the Virtio protocol, the Virtio virtualization architecture includes a front-end driver, a back-end device, and a transmission protocol. The front-end driver is a device driver on the virtual machine, which is used to receive user-mode requests and encapsulate them according to the transmission protocol; the back-end device can be, for example, a system simulator (Quick EMUlator, QEMU) on a data processing unit (DPU), which is used to receive requests sent from the front-end driver and then parse and operate the physical device according to the transmission protocol. The transmission protocol corresponds to multiple Virtio queues, and each Virtio device can have multiple queues for processing different data transmissions. The Virtio queue can be implemented in a ring buffer (vring), and the interaction between the front-end driver and the back-end device is realized by reading and writing data to the ring buffer. The layer where the Virtio queue is located can be understood as a virtual queue interface. A front-end driver can support one or more Virtio queues, such as one for receiving and another for sending, and the ring buffer can be understood as the implementation method of data stream forwarding of the virtual queue interface. The virtual queue interface, also known as the Virtio queue, requires the client operating system (guest OS) and the back-end device such as QEMU on the DPU to follow certain standards, including encapsulation and parsing according to the transmission protocol, so that they can match each other.Therefore, before officially starting the virtual machine, QEMU on the DPU needs to create a Virtio device. Then, after the virtual machine is started, the kernel's Virtio device driver is called to load the Virtio device and create shared memory for data transmission, so that QEMU can subsequently obtain input and output requests submitted through the Virtio queue through vring. Generally, the virtual queue data structure includes a descriptor for describing the physical address and length, available flag, and used flag associated with the cache. In contrast to the virtual queue interface used by Virtio, that is, the Virtio queue, the DPU also pools the input and output queue resources, and the hardware uses the internal hardware queue index. Therefore, according to the front-end driver, back-end device, and transmission protocol specified by the Virtio protocol, software and hardware collaboration is required to achieve collaboration between the virtual queue interface of the Virtio device and the input and output queue resources of the DPU, thereby improving overall performance and efficiency. On the one hand, considering that there are different versions of the Virtio virtualization architecture, different manufacturers will also make customizations, there are differences between different virtualization technology architectures, and the differences in the device characteristics and input and output customization requirements of each virtual device, the data processor, as an intelligent hardware that provides network transmission functions, needs to consider how to achieve adaptation between software and hardware in terms of adaptability, especially how to adapt the queue resource management method adopted by the device driver on the virtual machine used to drive the virtual device; on the other hand, the data processor itself may also adopt register optimization, computing power optimization, storage optimization and other technologies to adopt specific queue resource management methods for the input and output queue resources provided by the data processor, that is, the local hardware queue resources; when the queue resource management method adopted by the device driver on the virtual machine used to drive the virtual device is different from the queue resource management method adopted by the data processor for the local hardware queue resources, it will bring about delay overhead and storage resource usage in queue conversion. In addition, the data processor interacts with the host through a bus such as the Peripheral Component Interconnect Express (PCIe) bus and implements the PCIe switch topology to achieve dynamic issuance and dynamic recovery of PCIe devices using hot-swap capabilities, which supports users to customize input and output resources. Therefore, it is necessary to consider the impact of dynamic issuance and dynamic recovery of devices on software and hardware collaboration. The following is combined. Figure 1 A detailed description is given of how a forwarding method, computer device and medium for a data processor provided in an embodiment of the present application address these challenges.

[0033] See also Figure 1, in step S110, the first virtual device is loaded through the virtual device driver on the driver side of the host machine. In step S120, the virtual device controller of the data processor on the logical side of the host machine performs a feature handshake with the first virtual device in accordance with the first input-output virtualization protocol to determine whether the first virtual device has the first feature. Among them, the first feature is an extension of the standard feature specified by the first input-output virtualization protocol and is used to indicate the hardware queue index access capability. In this way, on the basis of the basic content of the first input-output virtualization protocol, that is, the standard feature specified by the first input-output virtualization protocol is extended, so that a new device feature, namely the first feature, is established. The first feature can be confirmed when loading a new virtual device, or it can be confirmed through the handshake process. As described above, taking the Virtio protocol as an example, the first input-output virtualization protocol unifies the front-end drivers of different devices through a common framework and standard interface for the input and output of virtual devices, and then cooperates with the back-end driver. Therefore, the virtual device driver on the driver side of the host machine loads the first virtual device, which means confirming the input and output customization requirements of the first virtual device, such as whether the first virtual device supports single root input and output virtualization (SRIOV). In this way, through the virtual device controller of the data processor, it is possible to perform a feature handshake with the first virtual device in accordance with the handshake process specified by the first input and output virtualization protocol, and further confirm whether the first virtual device has the first feature on the basis of confirming whether the first virtual device has the standard features specified by the first input and output virtualization protocol. For example, a feature can be added to the feature table of the Virtio device. When loading the Virtio device, the Virtio controller on the DPU performs a feature handshake with the Virtio device, and then determines whether the host or client operating system has the ability to directly access the hardware queue index. In some embodiments, on the basis of determining whether the first virtual device has the first feature through the virtual device controller of the data processor on the logical side of the host machine, it is also possible to additionally determine whether the data processor has the ability to directly provide the hardware queue index through the virtual device driver. In other words, by using the handshake process specified by the first input and output virtualization protocol, two-way verification can be performed from the driver side and the logic side. On the one hand, from the logical side, through the virtual device controller of the data processor, it is verified whether the first virtual device has the first characteristic, that is, the ability to indicate hardware queue index access; on the other hand, from the driver side, through the virtual device driver on the driver side of the host machine, it is verified whether the data processor has the ability to directly provide the hardware queue index.On the premise that both bidirectional verifications are passed, the driver side, such as the front-end driver, traverses all queues in the data processor's hardware resource pool, that is, the input and output queue resource pool, to obtain all hardware queue indexes. In this way, for Virtio devices with the first characteristic, when performing related input and output operations, it is not necessary to follow the standard procedures specified by the Virtio protocol, that is, not to use Virtio queues and ring buffers, but to directly use hardware queue indexes. In this way, when the doorbell is rung to notify the hardware, the doorbell notification carries not the information of the virtual queue but the hardware queue index, which saves the DPU the latency overhead caused by the table lookup conversion and the storage resources required for the queue conversion. In addition, by utilizing the characteristic handshake mechanism and bidirectional verification, it can be compatible with old software drivers and old Virtio devices, as well as old DPU products.

[0034] Continue reading Figure 1As mentioned above, the virtual device controller of the data processor on the logical side of the host machine determines whether the first virtual device has the first characteristic, and the first characteristic is an extension of the standard characteristic specified by the first input and output virtualization protocol and is used to indicate the hardware queue index access capability. Therefore, depending on whether the first virtual device has the first characteristic, the corresponding forwarding process can be selectively adopted, thereby saving the delay overhead caused by the table lookup conversion and saving the storage resources required for the queue conversion. Specifically, in step S130, when the first virtual device does not have the first characteristic, the queue conversion table entry is sent to the queue conversion module of the data processor through the virtual device controller, and then, through the queue conversion module, based on the queue conversion table entry, the virtual queue index carried by the doorbell notification of the first virtual device is converted into the hardware queue index of the data processor. Here, the queue conversion module is located in the data processor, on the logical side of the host machine, and is used to convert the local queue index of the virtual device virtualized by the host machine into the hardware queue index for the data processor. Therefore, the queue conversion module needs to store the queue conversion table entry sent by the virtual device controller, which occupies a certain amount of hardware storage resources, and the queue conversion operation will also increase the input and output processing delay. For earlier versions of software drivers, Virtio devices, etc., the queue conversion module can provide support for customized input and output requirements of these devices, that is, it can be compatible with old software drivers and old Virtio devices, etc., as well as compatible with old DPU products. In contrast, in step S140, when the first virtual device has the first feature, the virtual device driver obtains the hardware queue index of the data processor, and through the virtual device driver, the doorbell notification of the first virtual device carries the hardware queue index of the data processor. In this way, by extending the standard features specified by the first input and output virtualization protocol, the first feature is added, and the virtual device driver can determine whether the first device has the first feature during initialization, similar to determining whether the first virtual device supports standard features such as SRIOV. Through the virtual device controller of the data processor, according to the handshake process specified by the first input and output virtualization protocol, by performing a feature handshake with the first virtual device, on the basis of confirming whether the first virtual device has the standard features specified by the first input and output virtualization protocol, it is further confirmed whether the first virtual device has the first feature. Here, when the virtual device controller determines that the first virtual device has the first characteristic, the virtual device driver obtains the hardware queue index of the data processor. Therefore, this means that the virtual device driver uses the data processor to obtain the hardware queue index of the data processor, which means that it is determined through the virtual device driver that the data processor has the ability to directly provide the hardware queue index.Therefore, by using the handshake process specified by the first input-output virtualization protocol, bidirectional verification is realized from the driver side and the logic side. On the one hand, from the logic side, through the virtual device controller of the data processor, it is verified whether the first virtual device has the first characteristic, that is, the ability to indicate the hardware queue index access; on the other hand, from the driver side, through the virtual device driver of the driver side of the host machine, it is verified whether the data processor has the ability to directly provide the hardware queue index. On the premise that both bidirectional verifications are passed, the driver side, such as the front-end driver, traverses all queues in the hardware resource pool of the data processor, that is, the input-output queue resource pool, so as to obtain all hardware queue indexes. In this way, by expanding the standard characteristics specified by the first input-output virtualization protocol, the first characteristic is added, and the virtual device driver determines whether the first device has the first characteristic during initialization, and after the virtual device controller determines that the first virtual device has the first characteristic through the characteristic handshake, the virtual device driver obtains the hardware queue index of the data processor, so that when the subsequent virtual device driver issues a doorbell notification, the doorbell notification can carry the hardware queue index. In other words, through the virtual device driver, the doorbell notification of the first virtual device carries the hardware queue index of the data processor, thus saving the data processor's occupation of hardware storage resources and reducing input and output processing delays.

[0035] In conclusion, Figure 1 The forwarding method for a data processor shown is applied to application scenarios such as cloud computing, data centers, and high-performance servers. Bidirectional verification is performed from the driver side and the logic side. The virtual device controller of the data processor on the logic side verifies whether the first virtual device has the first characteristic, that is, the ability to indicate hardware queue index access, and the virtual device driver on the driver side verifies whether the data processor has the ability to directly provide the hardware queue index. According to whether the first virtual device has the first characteristic, the corresponding forwarding process is selectively adopted, thereby saving the delay overhead caused by table lookup conversion and the storage resources required for queue conversion. By utilizing the characteristic handshake mechanism and bidirectional verification, combined with the queue conversion module of the data processor, different versions of virtualization architectures and various device characteristics and input and output customization requirements can be compatible. By utilizing the existing virtual device loading process and characteristic handshake process between the data processor and the first input and output virtualization protocol, users are supported to customize input and output resources and the dynamic issuance and dynamic recovery of PCIe devices are supported, effectively coping with the impact of the queue resource management method of the device driver being different from the queue resource management method of the data processor on software and hardware collaboration.

[0036] In a possible implementation, when the first virtual device does not have the first feature, the data path between the first virtual device and the data processor includes the queue conversion module. In this way, by utilizing the feature handshake mechanism and bidirectional verification, combined with the queue conversion module of the data processor, different versions of virtualization architectures and various device features as well as input and output customization requirements can be compatible.

[0037] In some embodiments, when the first virtual device has the first characteristic, the data path between the first virtual device and the data processor does not pass through the queue conversion module, and the data processor uses the hardware queue index of the data processor carried by the doorbell notification of the first virtual device to forward traffic. In this way, the virtual device driver on the driver side verifies whether the data processor has the ability to directly provide the hardware queue index, and selectively adopts the corresponding forwarding process according to whether the first virtual device has the first characteristic, thereby saving the delay overhead caused by the table lookup conversion and saving the storage resources required for the queue conversion.

[0038] In some embodiments, when the first virtual device has the first characteristic, the doorbell notification of the first virtual device does not carry the virtual queue index of the first virtual device. In this way, the occupation of hardware storage resources by the data processor is saved and the input and output processing delay is reduced.

[0039] In a possible implementation, the hardware queue index of the data processor is determined based on the input and output queue resource pool of the data processor. On the premise that both bidirectional verifications are passed, the driver side, such as the front-end driver, traverses all queues in the hardware resource pool of the data processor, that is, the input and output queue resource pool, so as to obtain all hardware queue indexes. In this way, by extending the standard characteristics specified by the first input and output virtualization protocol, a first characteristic is added, and the virtual device driver determines whether the first device has the first characteristic during initialization, and after the virtual device controller determines that the first virtual device has the first characteristic through a characteristic handshake, the virtual device driver obtains the hardware queue index of the data processor, so that when the subsequent virtual device driver issues a doorbell notification, the doorbell notification can carry the hardware queue index. In other words, through the virtual device driver, the doorbell notification of the first virtual device carries the hardware queue index of the data processor, so that the occupation of hardware storage resources by the data processor is saved and the input and output processing delay is reduced.

[0040] In a possible implementation, the virtual queue index of the first virtual device is determined based on the virtualized input and output queue resources of the first virtual device. In this way, different versions of virtualization architectures and various device characteristics and input and output customization requirements can be compatible.

[0041] Figure 2 A schematic diagram of a data processor provided in an embodiment of the present application. Figure 2 As shown, the virtual device driver 202 on the driver side of the host machine includes three virtual devices, each of which includes a virtual queue. Specifically, virtual device A210 includes virtual queue A212 and virtual queue B214, virtual device B220 includes virtual queue C222 and virtual queue D224, and virtual device C230 includes virtual queue E232 and virtual queue F234. The virtual device controller 204 of the data processor on the logical side of the host machine includes multiple hardware queues, specifically, hardware queue A241, hardware queue B242, hardware queue C243, hardware queue D244, hardware queue E245, and hardware queue F246. Figure 2 The data processor shown, reference Figure 1 Specifically, through the virtual device driver 202 on the driver side of the host machine, the first virtual device (for example Figure 2 ); through the virtual device controller 204 of the data processor on the logical side of the host machine, perform a feature handshake with the first virtual device according to the first input-output virtualization protocol to determine whether the first virtual device has the first feature. The first feature is an extension of the standard feature specified by the first input-output virtualization protocol and is used to indicate the hardware queue index access capability; when the first virtual device does not have the first feature, the queue conversion table entry is sent to the queue conversion module 260 of the data processor through the virtual device controller 204, and then, based on the queue conversion table entry, the virtual queue index carried by the doorbell notification of the first virtual device is converted into the hardware queue index of the data processor through the queue conversion module 260; when the first virtual device has the first feature, the virtual device driver 202 obtains the hardware queue index of the data processor, and through the virtual device driver 202, the doorbell notification of the first virtual device carries the hardware queue index of the data processor.

[0042] Continue reading Figure 2The forwarding method also includes: through the virtual device controller 204, performing a feature handshake with the first virtual device in accordance with the first input-output virtualization protocol to determine whether the first virtual device has a second feature, wherein the second feature is an extension of the standard feature specified by the first input-output virtualization protocol and is used to indicate a security isolation requirement; when the first virtual device has the second feature, through the security verification module 262 of the data processor, determining whether the hardware queue index of the data processor is used by another virtual device different from the first virtual device, if so, determining that the security isolation requirement of the first virtual device is not met, and if not, determining that the security isolation requirement of the first virtual device is met.

[0043] Continue reading Figure 2 , Figure 2, it is exemplarily shown that virtual device A210 has the first characteristic, so the doorbell notification of virtual device A210 carries the hardware queue index of the data processor. Among them, considering the parallelism and isolation requirements between multiple threads, each virtual queue, whether the same virtual device or different virtual devices, corresponds to a different separate hardware queue. Here, virtual device A210, virtual device B220 and virtual device C230 together include six virtual queues, so these six virtual queues correspond one by one to the six hardware queues managed by the virtual device controller 204. It can be seen that because virtual device A210 has the first characteristic, the data path A280 between virtual device A210 and virtual device controller 204 does not pass through the queue conversion module 260. In addition, virtual device A210 does not have the second characteristic, so the data path A280 between virtual device A210 and virtual device controller 204 does not pass through the queue conversion module 260 or the security verification module 262. The virtual device B220 has the first characteristic, so the doorbell notification of the virtual device B220 carries the hardware queue index of the data processor, and the data path B282 between the virtual device B220 and the virtual device controller 204 does not pass through the queue conversion module 260. In addition, the virtual device B220 has the second characteristic, so the data path B282 between the virtual device B220 and the virtual device controller 204 does not pass through the queue conversion module 260 but passes through the security verification module 262. The virtual device C230 does not have the first characteristic, and the virtual queue index carried by the doorbell notification of the virtual device C230 needs to be converted by the queue conversion module 260. Therefore, the data path C284 between the virtual device C230 and the virtual device controller 204 passes through the queue conversion module 260. It can be seen that by judging whether the virtual device has the first characteristic and whether the virtual device has the second characteristic, the corresponding data path construction method can be selected to establish the data path between the virtual device and the virtual device controller 204, so that the hardware queue resources can be fully utilized to realize traffic forwarding, while minimizing the occupation of hardware storage resources and shortening the input and output processing delay. In this way, by utilizing the characteristic handshake mechanism and two-way verification, combined with the queue conversion module 260 of the data processor, different versions of virtualization architectures and various device characteristics and input and output customization requirements can be compatible; by utilizing the existing virtual device loading process and characteristic handshake process between the data processor and the first input and output virtualization protocol, users are supported to customize input and output resources and the dynamic issuance and dynamic recovery of PCIe devices are supported, effectively coping with the impact of the queue resource management method of the device driver being different from the queue resource management method of the data processor on the coordination of software and hardware.Furthermore, by utilizing the security verification module 262, the parallelism and isolation requirements between multiple threads are effectively met, and it is ensured that the specific hardware queue index of the data processor is only used by a specific virtual device, thereby achieving security isolation between modules and also helping to prevent virtual device attacks.

[0044] See also Figure 1 and Figure 2 In a possible implementation, through the security verification module 262 of the data processor, when the peripheral component interconnect address of the message header of the doorbell notification of the first virtual device does not match the peripheral component interconnect address of the hardware queue index of the data processor, it is judged that the security isolation requirement of the first virtual device is not met, and when the peripheral component interconnect address of the message header of the doorbell notification of the first virtual device matches the peripheral component interconnect address of the hardware queue index of the data processor, it is judged that the security isolation requirement of the first virtual device is met. In this way, for the security consideration of the virtual device, the matching of the peripheral component interconnect address can ensure that a specific hardware queue resource can only be used by a specific virtual device instance, so that the security isolation between modules is realized, and it is also helpful to prevent virtual device attacks.

[0045] In a possible implementation, when the first virtual device has the first characteristic and the second characteristic, the data path between the first virtual device and the data processor does not pass through the queue conversion module 260 and includes the security verification module 262. In this way, by judging whether the virtual device has the first characteristic and whether the virtual device has the second characteristic, a corresponding data path construction method can be selected to establish a data path between the virtual device and the virtual device controller 204, so that the hardware queue resources can be fully utilized to realize traffic forwarding, while minimizing the occupation of hardware storage resources and shortening the input and output processing delay.

[0046] In some embodiments, when the security isolation requirement of the first virtual device is met, the data processor uses the hardware queue index of the data processor carried by the doorbell notification of the first virtual device to forward traffic. In this way, by judging whether the virtual device has the first characteristic and whether the virtual device has the second characteristic, a corresponding data path construction method can be selected to establish a data path between the virtual device and the virtual device controller 204, so that the hardware queue resources can be fully utilized to realize traffic forwarding, while minimizing the occupation of hardware storage resources and shortening the input and output processing delay.

[0047] In a possible implementation, whether the first virtual device has the first feature depends on the version of the virtual device driver, the version of the server operating system of the host machine, and the manufacturer of the data processor. In this way, by utilizing the feature handshake mechanism and two-way verification, combined with the queue conversion module 260 of the data processor, different versions of virtualization architectures and various device features and input and output customization requirements can be compatible.

[0048] In a possible implementation, the first input / output virtualization protocol is the Virtio protocol. Thus, by utilizing the characteristic handshake mechanism and bidirectional verification, combined with the queue conversion module 260 of the data processor, different versions of virtualization architectures and various device characteristics and input / output customization requirements can be compatible.

[0049] In a possible implementation, the first virtual device supports single-root input and output virtualization. Thus, by utilizing the characteristic handshake mechanism and bidirectional verification, combined with the queue conversion module 260 of the data processor, different versions of virtualization architectures and various device characteristics and input and output customization requirements can be compatible.

[0050] Figure 3 3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 300 includes: one or more processors 310, a communication interface 320 and a memory 330. The processor 310, the communication interface 320 and the memory 330 are interconnected via a bus 340. Optionally, the computing device 300 may also include an input / output interface 350, and the input / output interface 350 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 300 can be used to implement some or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processor 310 can also be used to implement some or all of the operating steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the various operations performed by the computing device 300 can refer to the specific details in the above-mentioned embodiments, such as the processor 310 is used to perform some or all of the steps in the above-mentioned method embodiment or some or all of the operations in the above-mentioned method embodiment. For another example, in an embodiment of the present application, the computing device 300 may be used to implement part or all of the functions of one or more components in the above-mentioned apparatus embodiment. In addition, the communication interface 320 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 310 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.

[0051] It should be understood that Figure 3The computing device 300 may include one or more processors 310, and the multiple processors 310 may provide processing capabilities in a parallel connection mode, a serial connection mode, a serial-parallel connection mode, or any connection mode, or the multiple processors 310 may form a processor sequence or a processor array, or the multiple processors 310 may be divided into a main processor and an auxiliary processor, or the multiple processors 310 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 3 The computing device 300 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 300 may include Figure 3 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.

[0052] The processor 310 may have a variety of specific implementation forms. For example, the processor 310 may include a central processing unit (CPU), a graphic processing unit (GPU), a neural-network processing unit (NPU), a tensor processing unit (TPU) or a data processing unit (DPU), etc., and the embodiment of the present application does not specifically limit it. The processor 310 may also be a single-core processor or a multi-core processor. The processor 310 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processor 310 may also be implemented using a logic device with built-in processing logic alone, such as an FPGA or a digital signal processor (DSP). The communication interface 320 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface may be a cellular network interface or a wireless local area network interface, etc.

[0053] The memory 330 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 330 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 330 may also be used to store program codes and data, so that the processor 310 calls the program codes stored in the memory 330 to execute some or all of the operation steps in the above method embodiment, or to execute the corresponding functions in the above device embodiment. Figure 3 Show more or fewer components, or have different component configurations.

[0054] The bus 340 may be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 340 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 340 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0055] The method and device provided in the embodiments of the present application are based on the same inventive concept. Since the principles of solving the problems in the methods and devices are similar, the embodiments, implementation methods, examples or implementation methods of the methods and devices can refer to each other, and the repeated parts will not be repeated. The embodiments of the present application also provide a system, which includes multiple computing devices, and the structure of each computing device can refer to the structure of the computing device described above. The functions or operations that can be implemented by the system can refer to the specific implementation steps in the above method embodiments and / or the specific functions described in the above device embodiments, which will not be repeated here.

[0056] The present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer device (such as one or more processors), the method steps in the above method embodiment can be implemented. The specific implementation of the processor of the computer-readable storage medium in executing the above method steps can refer to the specific operations described in the above method embodiment and / or the specific functions described in the above device embodiment, which will not be repeated here.

[0057] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems, or computer program products. The present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. The embodiments of the present application may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. Computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media. Available media can be magnetic media (such as floppy disks, hard disks, tapes), optical media, or semiconductor media. Semiconductor media can be solid-state hard disks, random access memory, flash memory, read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, or any other form of suitable storage media.

[0058] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. Each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0059] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. The steps in the method of the embodiment of the present application can be adjusted in order, merged or deleted according to actual needs; the modules in the system of the embodiment of the present application can be divided, merged or deleted according to actual needs. If these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. A forwarding method for a data processor, characterized in that: The forwarding method comprises: Loading the first virtual device through a virtual device driver on a driver side of the host machine; By means of a virtual device controller of a data processor on the logic side of the host machine, a characteristic handshake is performed with the first virtual device according to a first input-output virtualization protocol to thereby determine whether the first virtual device has a first characteristic, wherein the first characteristic is an extension of a standard characteristic specified by the first input-output virtualization protocol and is used to indicate a hardware queue index access capability; When the first virtual device does not have the first characteristic, the queue conversion table entry is sent to the queue conversion module of the data processor through the virtual device controller, and then, based on the queue conversion table entry, the queue conversion module converts the virtual queue index carried by the doorbell notification of the first virtual device into the hardware queue index of the data processor; When the first virtual device has the first characteristic, the virtual device driver obtains the hardware queue index of the data processor, and through the virtual device driver, the doorbell notification of the first virtual device carries the hardware queue index of the data processor.

2. The forwarding method according to claim 1, characterized in that: When the first virtual device does not have the first characteristic, the data path between the first virtual device and the data processor includes the queue conversion module.

3. The forwarding method according to claim 2, characterized in that: When the first virtual device has the first characteristic, the data path between the first virtual device and the data processor does not pass through the queue conversion module, and the data processor uses the hardware queue index of the data processor carried by the doorbell notification of the first virtual device to forward traffic.

4. The forwarding method according to claim 3, characterized in that: When the first virtual device has the first characteristic, the doorbell notification of the first virtual device does not carry the virtual queue index of the first virtual device.

5. The forwarding method according to claim 1, characterized in that: The hardware queue index of the data processor is determined based on an input and output queue resource pool of the data processor.

6. The forwarding method according to claim 1, characterized in that: The virtual queue index of the first virtual device is determined based on virtualized input and output queue resources of the first virtual device.

7. The forwarding method according to claim 1, characterized in that: The forwarding method further comprises: By means of the virtual device controller, performing a characteristic handshake with the first virtual device according to the first input-output virtualization protocol to thereby determine whether the first virtual device has a second characteristic, wherein the second characteristic is an extension of a standard characteristic specified by the first input-output virtualization protocol and is used to indicate a security isolation requirement; When the first virtual device has the second characteristic, the security verification module of the data processor is used to determine whether the hardware queue index of the data processor is used by another virtual device different from the first virtual device. If so, it is determined that the security isolation requirement of the first virtual device is not met. If not, it is determined that the security isolation requirement of the first virtual device is met.

8. The forwarding method according to claim 7, characterized in that: Through the security verification module of the data processor, when the peripheral component interconnect address of the message header of the doorbell notification of the first virtual device does not match the peripheral component interconnect address of the hardware queue index of the data processor, it is judged that the security isolation requirement of the first virtual device is not met, and when the peripheral component interconnect address of the message header of the doorbell notification of the first virtual device matches the peripheral component interconnect address of the hardware queue index of the data processor, it is judged that the security isolation requirement of the first virtual device is met.

9. The forwarding method according to claim 7, characterized in that: When the first virtual device has the first characteristic and the second characteristic, the data path between the first virtual device and the data processor does not pass through the queue conversion module and includes the security verification module.

10. The forwarding method according to claim 9, characterized in that: When the security isolation requirement of the first virtual device is met, the data processor uses the hardware queue index of the data processor carried by the doorbell notification of the first virtual device to forward traffic.

11. The forwarding method according to claim 1, characterized in that: Whether the first virtual device has the first characteristic depends on the version of the virtual device driver, the version of the server operating system of the host machine, and the manufacturer of the data processor.

12. The forwarding method according to claim 1, characterized in that: The first input and output virtualization protocol is the Virtio protocol.

13. The forwarding method according to claim 1, characterized in that: The first virtual device supports single-root input and output virtualization.

14. A computer device, characterized in that: The computer device comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 13 when executing the computer program.

15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 13.