Method, device and equipment for reading and writing DPU (Data Processing Unit) data supporting multi-para-virtualization equipment
By setting the target register and the target processing unit in the DPU, decoupling the hardware and data input/output logic, the problem that the DPU hardware unit can only support one type of device is solved, and the flexible configuration and data reading and writing of most virtualized devices are realized.
Patent Information
- Application Number
- CN202510390551.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2045-03-31
AI Technical Summary
The hardware units in existing DPUs can only support one type of device and cannot be flexibly configured to different types, resulting in the hardware being logically coupled to the data input/output logic, and cannot adapt to the needs of multiple device types.
By setting the target register in the DPU, direct memory data access is initiated in response to the change of register value, metadata is obtained and device type is determined, and the target processing unit is used to perform read and write requests, realizing the decoupling of hardware and data input/output logic, allowing the same hardware unit to be flexibly configured as different types of devices.
It realizes that under the unchanged hardware configuration, the DPU hardware unit can be flexibly configured as different types of devices, supporting data read and write operations of multiple device types, improving device adaptability and flexibility.
Smart Images

Figure CN120295577A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of data processing technologies, and in particular, to a DPU data reading and writing method, apparatus, and device supporting semi-virtualized devices. Background Art
[0002] Currently, a Data Processing Unit (DPU) supports network and storage functions and provides support for different types of devices in terms of storage. Among them, the interaction between the host and the DPU depends on a set of registers on the DPU and driver programs on the host side for different types of devices. In the DPU hardware design, for different device types, the registers based on PF / VF are different, and thus on the host side, there are fixed driver programs corresponding to specific types of devices.
[0003] In existing DPU, both receiving data access requests sent from the host side and implementing data transfer between the DPU and the host side are based on hardware implementation, that is, there is a strong coupling between the hardware and the data input / output logic (i.e., IO logic). However, different hardware units in the DPU can only implement data access logics for their corresponding specific types of devices. Only by changing the hardware configuration can the device type be switched. That is to say, in the DPU, the same hardware unit can only support one type of device without changing the hardware configuration, and there is a problem that the same hardware unit cannot be flexibly configured into different types of devices. Summary of the Invention
[0004] To solve the above technical problems, the present disclosure provides a DPU data reading and writing method, apparatus, and device supporting semi-virtualized devices.
[0005] The first aspect of the embodiments of the present disclosure provides a DPU data reading and writing method supporting semi-virtualized devices, which is applied to a DPU and includes:
[0006] In response to a change in the value in the target register, initiate a direct memory data access operation to obtain metadata corresponding to the target read / write request from the host side. The value of the target register is used to notify the DPU that there is a new data read / write request to be processed, and the target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register;
[0007] Determine the request type corresponding to the target read / write request, and determine the device type corresponding to the target read / write request based on the target register;
[0008] Based on the device type, determine the target processing unit for executing the target read / write request, and send the target read / write request and the metadata to the target processing unit, and execute the target read / write request based on the request type and the target processing unit.
[0009] The second aspect of the embodiments of the present disclosure provides a DPU data reading and writing device supporting semi-virtualized devices, which is applicable to DPU and includes:
[0010] A metadata acquisition module, configured to initiate a direct memory data access operation in response to a change in the value in the target register, and acquire the metadata corresponding to the target read / write request from the host side. The value of the target register is used to notify the DPU that there is a new data read / write request to be processed, and the target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register;
[0011] A type determination module, configured to determine the request type corresponding to the target read / write request and determine the device type corresponding to the target read / write request based on the target register;
[0012] A data reading and writing module, configured to determine the target processing unit for executing the target read / write request based on the device type, and send the target read / write request and the metadata to the target processing unit, and execute the target read / write request based on the request type and the target processing unit.
[0013] The third aspect of the embodiments of the present disclosure provides an electronic device, including:
[0014] A processor;
[0015] A memory, configured to store executable instructions;
[0016] Wherein, the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the DPU data reading and writing method for supporting semi-virtualized devices provided in the first aspect above.
[0017] The technical solution provided by the embodiments of the present disclosure has the following advantages compared with the prior art:
[0018] The DPU data reading and writing method, device, and equipment supporting semi-virtualized devices provided by the embodiments of the present disclosure can initiate a direct memory data access operation in response to a change in the value in the target register, obtain metadata corresponding to the target read / write request from the host side. The value in the target register is used to notify the DPU that there is a new data read / write request to be processed. The target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register. After obtaining the metadata, determine the request type corresponding to the target read / write request, determine the device type corresponding to the target read / write request based on the target register, determine the target processing unit used to execute the target read / write request based on the device type, and send the target read / write request and the metadata to the target processing unit. Based on the target processing unit executing the target read / write request, thus, by setting the target register, setting a queue for storing read / write requests in the target register, and notifying the DPU through the value in the target register when there is a new read / write request, so that the DPU initiates a direct memory data access operation to implement data copying between the host side and the DPU. Then, the software on the DPU side implements specific data input / output logic according to different device types, realizing the decoupling between the hardware and the data input / output logic, and further realizing that the same hardware unit can be flexibly configured into different types of devices without changing the hardware configuration in the DPU. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.
[0020] To more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0021] Figure 1 is a flowchart of a DPU data reading and writing method supporting semi-virtualized devices provided by the embodiments of the present disclosure;
[0022] Figure 2 is a schematic diagram of an improvement effect provided by the embodiments of the present disclosure;
[0023] Figure 3 is a flowchart of another DPU data reading and writing method supporting semi-virtualized devices provided by the embodiments of the present disclosure;
[0024] Figure 4 is a flowchart of yet another DPU data reading and writing method supporting semi-virtualized devices provided by the embodiments of the present disclosure;
[0025] Figure 5 It is a schematic structural diagram of a DPU data reading and writing device supporting semi-virtualized devices provided by an embodiment of the present disclosure;
[0026] Figure 6 It is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners
[0027] In order to be able to more clearly understand the above objects, features and advantages of the present disclosure, the solutions of the present disclosure will be further described below. It should be noted that, without conflict, the embodiments of the present disclosure and the features in the embodiments may be combined with each other.
[0028] In the following description, many specific details are set forth in order to fully understand the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present disclosure, rather than all of the embodiments.
[0029] It should be understood that the various steps recorded in the method implementation manners of the present disclosure may be executed in different orders and / or executed in parallel. In addition, the method implementation manners may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.
[0030] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, method, article or device including the said element.
[0031] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that, unless clearly specified otherwise in the context, it should be understood as "one or more".
[0032] Generally, in existing DPU, receiving data access requests sent from the host side and implementing data transfer between the DPU and the host side are both based on hardware. In a DPU, the same hardware unit can only support one type of device when the hardware configuration remains unchanged, and there is a problem that the same hardware unit cannot be flexibly configured into different types of devices. To address this problem, the embodiments of the present disclosure provide a DPU data reading and writing method supporting multi para-virtualized devices, and the method will be introduced below in combination with specific embodiments.
[0033] Figure 1 FIG. is a flowchart of a DPU data reading and writing method supporting multi para-virtualized devices provided by the embodiments of the present disclosure. This method can be executed by a DPU data reading and writing device supporting multi para-virtualized devices. The DPU data reading and writing device supporting multi para-virtualized devices can be implemented in a software and / or hardware manner, and the DPU data reading and writing device supporting multi para-virtualized devices can be configured in an electronic device, such as a server or a terminal. Specifically, the terminal includes a mobile phone, a computer, a tablet computer, etc.
[0034] As Figure 1 shown, the DPU data reading and writing method supporting multi para-virtualized devices provided by the embodiments of the present disclosure is applied to a DPU, that is, a Data Processing Unit. Among them, as a new type of computing architecture, the DPU has advantages such as efficient data processing, low latency, enhanced security, and flexible scalability, providing strong computing support for various application scenarios. The DPU data reading and writing method supporting multi para-virtualized devices includes the following steps.
[0035] S110. In response to a change in the value in the target register, initiate a direct memory data access operation to obtain metadata corresponding to the target read / write request from the host side. The value of the target register is used to notify the DPU that there is a new data read / write request to be processed, and the target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register.
[0036] In the embodiments of the present disclosure, the target register can be a register for transmitting signals or commands between software such as a host or a driver and hardware such as a PCIe device. Exemplarily, the target register can be a doorbell register.
[0037] The number of target registers can be one or more. Each target register is provided with a queue for storing read / write requests of the target device corresponding to the target register. The read / write requests stored in the queue correspond to one device type. It can be understood that the queue of each target register corresponds to one device type.
[0038] The target device may be a paravirtualized device, such as a paravirtualized device based on the virtio protocol. Exemplarily, the target device may include virtio-fs, virtio-blk, virtio-net, virtio-sock, virtio-GPU, etc., which is not limited herein.
[0039] The direct memory data access operation is the DMA operation. There is a PF / VF-based hardware unit in the DPU. This hardware unit has the function of DMA data transfer and command registers for control plane negotiation such as virtio control plane negotiation, and it corresponds to the target driver on the host side. Among them, the command registers are used to store the commands sent by the host side.
[0040] In the embodiments of the present disclosure, the metadata may include information such as the read data corresponding to the target read / write request or the storage address corresponding to the write data.
[0041] Specifically, the DPU will periodically or in real time read the value in the target register. When responding to the change in the value in the target register, that is, when there is an increment in the value of the target register, it initiates a direct memory data access operation. The PF / VF-based hardware unit obtains the metadata corresponding to the target read / write request corresponding to the value in the changed register from the host side.
[0042] S120. Determine the request type corresponding to the target read / write request, and determine the device type corresponding to the target read / write request based on the target register.
[0043] In the embodiments of the present disclosure, the request types include read requests and write requests.
[0044] The device type can be distinguished according to the functions, characteristics, etc. of the paravirtualized device. For example, the paravirtualized device may include multiple types such as virtio-fs, virtio-blk, virtio-net, virtio-sock, virtio-GPU, etc.
[0045] Specifically, after the DPU obtains the metadata corresponding to the target read / write request, it determines the request type corresponding to the target read / write request based on the metadata, and according to the corresponding relationship between the queue and the device type, determines the target device type corresponding to the queue of the target register, and determines this target device type as the device type corresponding to the target read / write request. For example, the device type corresponding to this target device type is virtio-fs, etc.
[0046] S130. Determine the target processing unit for executing the target read / write request based on the device type, and send the target read / write request and the metadata to the target processing unit, and execute the target read / write request based on the request type and the target processing unit.
[0047] In the embodiments of the present disclosure, the target processing units corresponding to different device types are different. Exemplarily, when the device type is virtio-fs, the target processing unit is the file system layer; when the device type is virtio-blk, the target processing unit is the general block device layer in the user space; when the device type is virtio-net, the target processing unit is the virtio-net module in the kernel of the DPU; when the device type is virtio-sock, the target processing unit is the virtio-sock module in the kernel of the DPU. Among them, when the device type is virtio-net or virtio-sock, the target read / write request can be sent to the target processing unit by means of shared memory.
[0048] Specifically, after determining the request type and device type corresponding to the target read / write request, the DPU determines the target processing unit for executing the target read / write request according to the device type, and sends the target read / write request and metadata to the target processing unit, so that the target processing unit executes the target read / write request based on the metadata and the request type.
[0049] In the embodiments of the present disclosure, it is possible to initiate a direct memory data access operation in response to a change in the value in the target register, obtain the metadata corresponding to the target read / write request from the host side. The value in the target register is used to notify the DPU that there is a new data read / write request to be processed. The target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register. After obtaining the metadata, determine the request type corresponding to the target read / write request, and determine the device type corresponding to the target read / write request based on the target register. Determine the target processing unit for executing the target read / write request based on the device type, and send the target read / write request and metadata to the target processing unit. Based on the execution of the target read / write request by the target processing unit, thus, by setting the target register, setting a queue for storing read / write requests in the target register, and notifying the DPU through the value in the target register when there is a new read / write request, so that the DPU initiates a direct memory data access operation to implement data copying between the host side and the DPU. Then, the software on the DPU side implements specific data input / output logic according to different device types, achieving decoupling between the hardware and the data input / output logic, and further realizing that the same hardware unit can be flexibly configured into different types of devices without changing the hardware configuration in the DPU.
[0050] Figure 2 It is a schematic diagram of an improved effect provided by the embodiments of the present disclosure. As Figure 2 shown, Figure 2The schematic diagram on the left is the prior art. All PF / VFs can only be fixedly exposed as the same type of para-virtualized device, and different types of para-virtualized devices cannot exist simultaneously. That is, the same PF / VF-based hardware unit can only support one type of device at the same time; Figure 2 The schematic diagram on the right is the solution of the present invention. Each PF / VF can be exposed as any type of para-virtualized device, and different types of para-virtualized devices can exist simultaneously. That is, the same PF / VF-based hardware unit can be flexibly configured as different types of devices at the same time.
[0051] Figure 3 It is a flowchart of another DPU data reading and writing method for supporting multiple para-virtualized devices provided by an embodiment of the present disclosure. As Figure 3 shown, the DPU data reading and writing method for supporting multiple para-virtualized devices may specifically include the following steps:
[0052] S310. In response to a change in the value in the target register, initiate a direct memory data access operation to obtain the metadata corresponding to the target read / write request from the host side. The value of the target register is used to notify the DPU that there is a new data read / write request to be processed, and the target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register.
[0053] S320. Determine the request type corresponding to the target read / write request, and determine the device type corresponding to the target read / write request based on the target register.
[0054] S330. Determine the target processing unit for executing the target read / write request based on the device type.
[0055] It should be noted that the specific implementation manners of steps S310 - S330 are similar to those of the relevant steps in the above embodiment, and will not be elaborated here.
[0056] In the embodiment of the present disclosure, after determining the target processing unit, when the request type is a read request, executing the target read / write request based on the request type and the target processing unit specifically includes steps S340 - S350; when the request type is a write request, executing the target read / write request based on the request type and the target processing unit specifically includes steps S360 - S370.
[0057] S340. When the request type is a write request, initiate a direct memory data access operation to obtain the write data corresponding to the target read / write request from the host side.
[0058] In the embodiment of the present disclosure, a write request can be understood as a request to write data from the host side to the DPU side; a read request can be understood as a request to read data from the DPU side to the host side.
[0059] Specifically, when the DPU determines that the request type is a write request, it initiates a direct memory data access operation, determines the target storage location corresponding to the write data on the host side based on the information in the metadata, and then obtains the write data corresponding to the target read / write request from the target storage location on the host side based on the hardware units of the PF / VF.
[0060] S350. Send the target read / write request, metadata, and write data to the target processing unit, so that the target processing unit determines the first storage location corresponding to the write data based on the metadata and writes the write data to the first storage location.
[0061] Specifically, after the DPU obtains the write data, it sends the target read / write request, metadata, and write data to the target processing unit. The target processing unit executes the specific IO logic, that is, the target processing unit determines the first storage location corresponding to the write data according to the information in the metadata and writes it to the first storage location.
[0062] S360. When the request type is a read request, obtain the read data based on the target processing unit and metadata, determine the second storage location corresponding to the read data, and write the read data to the second storage location.
[0063] The metadata also includes the data acquisition rules corresponding to the data read / write request, such as where to obtain the data and where to store the obtained data, etc.
[0064] Specifically, when the DPU determines that the request type is a read request, the target processing unit obtains the read data corresponding to the target read / write request based on the data acquisition rules in the metadata, determines the second storage location corresponding to the read data, and writes the read data to the second storage location.
[0065] S370. Initiate a direct memory data access operation and write the read data from the second storage location to the host side.
[0066] Specifically, when the DPU writes the read data to the second storage location, it initiates a direct memory data access operation and writes the read data from the second storage location to the host side based on the hardware units of the PF / VF.
[0067] In the embodiments of the present disclosure, different target processing units can be determined according to different device types, and different read / write request execution logics can be determined according to different request types, thereby realizing data read / write operations. It realizes that the same hardware unit can be flexibly configured into different types of devices without changing the hardware configuration in the DPU.
[0068] Figure 4 It is a flowchart of another DPU data read / write method supporting semi-virtualized devices provided by the embodiments of the present disclosure, as Figure 4As shown in the figure, the DPU data reading and writing method that supports semi-virtualized devices may specifically include the following steps:
[0069] S410. In response to a change in the value in the target register, initiate a direct memory data access operation to obtain the metadata corresponding to the target read / write request from the host side. The value of the target register is used to notify the DPU that there is a new data read / write request to be processed, and the target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register.
[0070] S420. Determine the request type corresponding to the target read / write request, and determine the device type corresponding to the target read / write request based on the target register.
[0071] S430. Determine the target processing unit for executing the target read / write request based on the device type, and send the target read / write request and the metadata to the target processing unit, and execute the target read / write request based on the request type and the target processing unit.
[0072] It should be noted that the specific implementation manners of steps S410 - S430 are similar to those of the relevant steps in the above embodiments, and will not be elaborated here.
[0073] In the embodiments of the present disclosure, after executing the target read / write request based on the request type and the target processing unit, the DPU returns the status of the target read / write request to the host side according to the result of the target read / write request, specifically as steps S440 and S450.
[0074] S440. When the request type is a write request, obtain the first request processing status returned by the target processing unit, update the metadata based on the first request processing status, and return the updated metadata to the host side.
[0075] In the embodiments of the present disclosure, the first request processing status is used to indicate whether the target read / write request is processed and whether the processing is successful.
[0076] Specifically, when the request type is a write request, when the target processing unit writes the write data to the first storage location of the DPU, it will return the first request processing status to the DPU. After the DPU obtains the first request processing status, it parses the first request processing status to determine whether the target read / write request is processed successfully. If the processing is successful, it directly updates the metadata information of the target read / write request and returns the updated metadata to the host side; if the processing fails, it determines the reason for the failure and the error code, updates the reason for the failure and the error code to the metadata to obtain the updated metadata, and returns the updated metadata to the host side.
[0077] S450. When the request type is a read request, determine the second request processing status corresponding to the target read / write request, update the metadata based on the second request processing status, and return the updated metadata to the host side.
[0078] Specifically, when the request type is a read request, after the DPU writes the read data from the second storage location to the host side based on the hardware units of PF / VF, determine the second request processing status corresponding to the target read / write request, that is, determine whether the write is successful. If the write is successful, directly update the metadata information of the target read / write request and return the updated metadata to the host side; if the write fails, determine the reason for the failure and the error code, update the reason for the failure and the error code to the metadata to obtain the updated metadata, and return the updated metadata to the host side.
[0079] In the embodiments of the present disclosure, after executing the target read / write request, it is possible to determine the processing status of the target read / write request and return the processing status of the target read / write request to the host side, so that the host side can timely understand the processing status of the target read / write request.
[0080] Further, after returning the updated metadata to the host side, the DPU data read / write method supporting the semi-virtualized device may further include: injecting an interrupt event to the host side to further notify the host side of the processing result of the target read / write request.
[0081] In the embodiments of the present disclosure, the metadata is generated by the target driver in the host side based on the target read / write request.
[0082] Among them, the target driver can be understood as a driver program that interacts with the DPU and is used to implement the control plane function of semi-virtualized devices such as virtio devices in the DPU according to the VDPA framework and virtio protocol specifications. The target driver can be loaded onto various types of semi-virtualized devices, expose the PF / VF as a device corresponding to a target driver such as a VDPA device, and finally expose different types of semi-virtualized devices. Exemplarily, when the semi-virtualized device is a virtio device, the target driver can be a Virtio Data Path Acceleration (VDPA) driver, and the device corresponding to the target driver can be a VDPA device.
[0083] When an application program in the host side issues a read / write request or an IO request to a semi-virtualized device such as a virtio device in the DPU, the target driver will convert the information of the read / write request or IO request into metadata corresponding to the protocol supported by the semi-virtualized device based on a preset conversion rule, fill the metadata into the memory of the host side, and then increase the value of a target register such as a doorbell register to notify the DPU.
[0084] In the embodiments of the present disclosure, before initiating a direct memory data access operation in response to a change in the value in the target register and obtaining the metadata corresponding to the target read / write request from the host side, the DPU data read / write method for supporting a para-virtualized device may further include: receiving a target command sent by the host side, and returning target data to the host side based on the target command, so that the host side performs a loading operation of the target driver based on the target data.
[0085] The target command can be understood as being used to negotiate the control plane of the target protocol set on the host side, where the target protocol may be the virtio protocol.
[0086] The target command includes a control register and a data register. The control register is used to specify the type of the initiated command; the data register is used to transfer data between the host side and the DPU. During the execution of the loading of the target driver, by writing a specific command type in the control register and transferring and copying the data corresponding to the command type between the host side and the DPU through the data register, the loading of the target driver can be achieved. Thus, the requirement of supporting operations related to different types of para-virtualized devices can be realized without relying on hardware, that is, without being affected by the hardware configuration. Through the customized target command, the requirements for related operations of different types of para-virtualized devices can be met even if it is not on the hardware of the para-virtualized device.
[0087] Among them, it receives the target command sent by the host side, and returns the target data to the host side based on the target command, so that the host side performs the loading operation of the target driver based on the target data. Specifically, it may include: receiving the first acquisition command sent by the host side, determining the first data corresponding to the first acquisition command, and returning the first data to the host side, so that the host side determines the configuration information corresponding to the target driver based on the first data and registers the configuration information into the kernel of the host side. Among them, the first data includes at least one target device type supported by the DPU and at least one instance identifier corresponding to each target device type; receiving the device reset command sent by the host side, performing a reset operation on at least one para-virtualized device in the DPU based on the device reset command, and returning the reset status information to the host side, so that the host side sets the device status corresponding to at least one para-virtualized device based on the reset status information; receiving the second acquisition command sent by the host side, determining the second data corresponding to the second acquisition command, and returning the second data to the host side. The second data includes the configuration items corresponding to each para-virtualized device, so that the host side determines the target configuration items supported by both the host side and the DPU based on the second data and sends the target configuration items to the DPU; receiving the target configuration items sent by the host side, and returning the configuration values corresponding to each target configuration item to the host side, so that the host side sets the queue parameters corresponding to each para-virtualized device based on the configuration values to complete the loading operation of the target driver.
[0088] In the embodiments of the present disclosure, at least one instance identifier corresponding to each target device type can be understood as the number of devices of each type supported by the DPU can be determined according to the instance identifier, that is, instanceid.
[0089] The reset operation may include resetting the para-virtualized device and information such as the queue status corresponding to the para-virtualized device.
[0090] When the host side sets the device status corresponding to at least one para-virtualized device based on the reset status information, it is implemented based on a set of custom commands. Among them, the custom commands include a control register and a data register. The control register is used to specify the type of the command initiated; the data register is used to transfer data between the host side and the DPU. Therefore, when setting the device status, only need to fill in the type of the device command in the control register, which is the command for setting the device status of the para-virtualized device, and fill in the specific status, such as the ACKNOWLEDGE status, in the data register, then the operation of setting the device status can be realized.
[0091] The configuration items vary according to different device types and can be set according to the actual usage and application scenarios. Exemplarily, when the device type is virtio-blk, the configuration items may include block size, whether multi-queue is supported, supported version numbers, etc.; when the device type is virtio-net, the configuration items may include the maximum transmission unit, MAC address, etc., which are not limited herein.
[0092] The queue parameters may include information such as the number of queues used by each para-virtualized device to transfer data, the maximum number of requests for each queue, and the base address of the queue. Among them, a para-virtualized device may correspond to multiple queues, and each queue corresponds to a target register.
[0093] Specifically, the host side obtains the register addresses based on PF / VF in the DPU with the help of the PCI driver of the kernel based on the mapping relationship between the kernel and the registers, and initializes the interrupt of the para-virtualized device, that is, establishes the association relationship between the interrupt handler of the target driver and the interrupt in the DPU, so that the target driver can respond to and process the interrupt events sent by the DPU; further, the host side sends a first acquisition command to the DPU, and after receiving the first acquisition command, the DPU determines the first data corresponding to the first acquisition command and returns the first data to the host side; after receiving the first data, the host side determines the configuration information corresponding to the target driver based on the first data and registers the configuration information into the kernel of the host side; then, the host side sends a device reset command to the DPU, the DPU receives the device reset command sent by the host side, and performs a reset operation on at least one para-virtualized device in the DPU, and returns the reset status information to the host side after the reset operation is completed, so that the host side sets the device status corresponding to at least one para-virtualized device based on the reset status information, including setting the status of at least one para-virtualized device to the first status, where the first status indicates that the operating system has found the device and recognized it as a valid para-virtualized device.
[0094] Further, after setting the state of the device, the host side sends a second acquisition command to the DPU. The DPU receives the second acquisition command sent by the host side, determines the second data corresponding to the second acquisition command, and returns the second data to the host side. After receiving the second data, the host side determines the target configuration items supported by both itself and the DPU based on the second data and the configuration items it supports, and sends the target configuration items to the DPU to notify the DPU. Then, the DPU returns the configuration values corresponding to each target configuration item to the host side. Further, the host side sets the queue parameters corresponding to each semi-virtualized device based on the configuration values to complete the loading operation of the target driver. Finally, the host side sets the state of at least one semi-virtualized device in the DPU to the second state, where the second state indicates that at least one semi-virtualized device has successfully loaded the relevant driver, such as the virtio-related driver or the VDPA driver.
[0095] In the embodiments of the present disclosure, the loading of the target driver can be achieved through commands, overcoming the existing method of loading the target driver by using registers in the DPU. Thus, even when the hardware design of the DPU is not a semi-virtualized device, the hardware can be loaded with a driver based on the semi-virtualization protocol on the host side, realizing the decoupling between the hardware and the data input / output logic. Further, the same hardware unit can be flexibly configured into different types of devices without changing the hardware configuration in the DPU.
[0096] Figure 5 It is a schematic structural diagram of a DPU data reading and writing device supporting multiple semi-virtualized devices provided by the embodiments of the present disclosure.
[0097] In the embodiments of the present disclosure, the DPU data reading and writing device supporting multiple semi-virtualized devices can be set in an electronic device and is understood as part of the functional modules in the above-mentioned electronic device. Specifically, the electronic device can be a server or a terminal, where the terminal specifically includes a mobile phone, a computer, a tablet computer, etc., which are not limited herein.
[0098] As Figure 5 shown, the DPU data reading and writing device 500 supporting multiple semi-virtualized devices is applicable to the DPU. Among them, the DPU data reading and writing device 500 supporting multiple semi-virtualized devices can include a metadata acquisition module 510, a type determination module 520, and a data reading and writing module 530.
[0099] The metadata acquisition module 510 can be used to initiate a direct memory data access operation in response to a change in the value in the target register, and obtain the metadata corresponding to the target read / write request from the host side. The value of the target register is used to notify the DPU that there is a new data read / write request to be processed, and the target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register.
[0100] The type determination module 520 can be used to determine the request type corresponding to the target read / write request and determine the device type corresponding to the target read / write request based on the target register.
[0101] The data read / write module 530 can be used to determine the target processing unit for executing the target read / write request based on the device type, send the target read / write request and metadata to the target processing unit, and execute the target read / write request based on the request type and the target processing unit.
[0102] In the embodiments of the present disclosure, it is possible to initiate a direct memory data access operation in response to a change in the value in the target register, obtain the metadata corresponding to the target read / write request from the host side. The value of the target register is used to notify the DPU that there is a new data read / write request to be processed. The target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register. After obtaining the metadata, determine the request type corresponding to the target read / write request, determine the device type corresponding to the target read / write request based on the target register, determine the target processing unit for executing the target read / write request based on the device type, and send the target read / write request and metadata to the target processing unit, and execute the target read / write request based on the target processing unit. Thus, by setting the target register, setting a queue for storing read / write requests in the target register, and notifying the DPU through the value in the target register when there is a new read / write request, so that the DPU initiates a direct memory data access operation to implement data copying between the host side and the DPU. Then, the software on the DPU side implements specific data input / output logic according to different device types, realizing the decoupling between the hardware and the data input / output logic, and further realizing that the same hardware unit can be flexibly configured into different types of devices without changing the hardware configuration in the DPU.
[0103] In some embodiments of the present disclosure, the request types include read requests and write requests.
[0104] The DPU data read / write device 500 that supports semi-virtualized devices may further include a data transfer module.
[0105] The data transfer module can be used to initiate a direct memory data access operation to obtain the write data corresponding to the target read / write request from the host side before sending the target read / write request and metadata to the target processing unit when the request type is a write request.
[0106] The data read / write module 530 can specifically be used to send the target read / write request, metadata, and write data to the target processing unit when the request type is a write request, so that the target processing unit determines the first storage location corresponding to the write data based on the metadata and writes the write data into the first storage location.
[0107] In some embodiments of the present disclosure, the data reading and writing module 530 may specifically be further configured to, when the request type is a read request, obtain read data based on the target processing unit and metadata, determine a second storage location corresponding to the read data, and write the read data to the second storage location;
[0108] Initiate a direct memory data access operation to write the read data from the second storage location to the host side.
[0109] In some embodiments of the present disclosure, the DPU data reading and writing device 500 supporting semi-virtualized devices may further include a status update module.
[0110] The status update module may be configured to, after the target read / write request and metadata are sent to the target processing unit and the target read / write request is executed based on the request type and the target processing unit, when the request type is a write request, obtain a first request processing status returned by the target processing unit, update the metadata based on the first request processing status, and return the updated metadata to the host side;
[0111] When the request type is a read request, determine a second request processing status corresponding to the target read / write request, update the metadata based on the second request processing status, and return the updated metadata to the host side.
[0112] In some embodiments of the present disclosure, the DPU data reading and writing device 500 supporting semi-virtualized devices may further include an interrupt injection module.
[0113] The interrupt injection module may be configured to, after the updated metadata is returned to the host side, inject an interrupt event into the host side to notify the host side of the processing result of the target read / write request.
[0114] In some embodiments of the present disclosure, the metadata is generated by a target driver in the host side based on the target read / write request.
[0115] The DPU data reading and writing device 500 supporting semi-virtualized devices may further include a command execution module.
[0116] The command execution module may be configured to, before initiating a direct memory data access operation in response to a change in the value in the target register and obtaining the metadata corresponding to the target read / write request from the host side, receive a target command sent by the host side, and return target data to the host side based on the target command, so that the host side performs a loading operation of the target driver based on the target data.
[0117] In some embodiments of the present disclosure, the command execution module may be specifically configured to receive a first acquisition command sent by the host side, determine first data corresponding to the first acquisition command, and return the first data to the host side, so that the host side determines configuration information corresponding to the target driver based on the first data and registers the configuration information into the kernel of the host side. The first data includes at least one target device type supported by the DPU and at least one instance identifier corresponding to each target device type.
[0118] Receive a device reset command sent by the host side, perform a reset operation on at least one para-virtualized device in the DPU based on the device reset command, and return reset status information to the host side, so that the host side sets the device status corresponding to at least one para-virtualized device based on the reset status information.
[0119] Receive a second acquisition command sent by the host side, determine second data corresponding to the second acquisition command, and return the second data to the host side. The second data includes configuration items corresponding to each para-virtualized device, so that the host side determines target configuration items supported by both the host side and the DPU based on the second data and sends the target configuration items to the DPU.
[0120] Receive target configuration items sent by the host side and return configuration values corresponding to each target configuration item to the host side, so that the host side sets queue parameters corresponding to each para-virtualized device based on the configuration values to complete the loading operation of the target driver.
[0121] In some embodiments of the present disclosure, an association relationship is established between the interrupt handler of the target driver in the host side and the interrupt in the DPU, so that the target driver can respond to and process interrupt events sent by the DPU.
[0122] It should be noted that Figure 5 The DPU data reading and writing device 500 supporting multiple para-virtualized devices shown can execute each step in the above method embodiments and implement each process and effect in the above method embodiments, which will not be elaborated here.
[0123] Figure 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
[0124] In the embodiments of the present disclosure, Figure 6 The electronic device shown may be a server or a terminal. Among them, the terminal specifically includes a mobile phone, a computer, a tablet computer, etc., which are not limited here.
[0125] Such as Figure 6 shown, the electronic device may include a processor 610 and a memory 620 storing computer program instructions.
[0126] Specifically, the above-mentioned processor 610 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured as one or more integrated circuits for implementing the embodiments of the present disclosure.
[0127] The memory 620 may include a mass storage for information or instructions. By way of example and not limitation, the memory 620 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disc, a magneto-optical disc, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In a suitable case, the memory 620 may include removable or non-removable (or fixed) media. In a suitable case, the memory 620 may be inside or outside the integrated gateway device. In a specific embodiment, the memory 620 is a non-volatile solid state memory. In a specific embodiment, the memory 620 includes a read-only memory (ROM). In a suitable case, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM), or a flash memory, or a combination of two or more of these.
[0128] The processor 610 reads and executes the computer program instructions stored in the memory 620 to perform the steps of the DPU data reading and writing method for supporting a mostly virtualized device provided by the embodiments of the present disclosure.
[0129] In one example, the electronic device may further include a transceiver 630 and a bus 640. Among them, as Figure 6 shown, the processor 610, the memory 620, and the transceiver 630 are connected through the bus 640 and complete communication with each other.
[0130] The bus 640 includes hardware, software, or both. By way of example and not limitation, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side BUS (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable bus or a combination of two or more of these. Where appropriate, the bus 640 may include one or more buses.
[0131] Embodiments of the present disclosure also provide a computer-readable storage medium that may store a computer program, which, when executed by a processor, enables the processor to implement the DPU data reading and writing method for supporting semi-virtualized devices provided by the embodiments of the present disclosure.
[0132] The above storage medium may include, for example, a memory 620 storing computer program instructions, and the above instructions may be executed by a processor 610 of an electronic device to complete the DPU data reading and writing method for supporting semi-virtualized devices provided by the embodiments of the present disclosure. Optionally, the storage medium may be a non-transitory computer-readable storage medium. For example, the non-transitory computer-readable storage medium may be a ROM, a Random Access Memory (RAM), a Compact Disc ROM (CD-ROM), a magnetic tape, a floppy disk, and an optical data semi-virtualized storage device, etc.
[0133] The above are only specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments described herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A DPU data reading and writing method for supporting semi-virtualized devices, characterized in that, Applied to the DPU, including: In response to a change in the value in the target register, initiate a direct memory data access operation to obtain metadata corresponding to the target read / write request from the host side. The value in the target register is used to notify the DPU that there is a new data read / write request to be processed. The target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register. Determine the request type corresponding to the target read / write request and determine the device type corresponding to the target read / write request based on the target register. Based on the device type, determine the target processing unit for executing the target read / write request, and send the target read / write request and the metadata to the target processing unit, and execute the target read / write request based on the request type and the target processing unit.
2. The method according to claim 1, wherein The request type includes a read request and a write request; when the request type is a write request, before sending the target read / write request and the metadata to the target processing unit, the method further includes: Initiate a direct memory data access operation to obtain write data corresponding to the target read / write request from the host side. Sending the target read / write request to the target processing unit and executing the target read / write request based on the request type and the target processing unit includes: Send the target read / write request, the metadata, and the write data to the target processing unit, so that the target processing unit determines the first storage location corresponding to the write data based on the metadata and writes the write data to the first storage location.
3. The method according to claim 1, wherein When the request type is a read request, sending the target read / write request and the metadata to the target processing unit and executing the target read / write request based on the request type and the target processing unit includes: Obtain read data based on the target processing unit and the metadata, determine the second storage location corresponding to the read data, and write the read data to the second storage location. Initiate a direct memory data access operation to write the read data from the second storage location to the host side.
4. The method according to claim 1, characterized in that, After sending the target read / write request and the metadata to the target processing unit and executing the target read / write request based on the request type and the target processing unit, the method further includes: When the request type is a write request, obtain the first request processing status returned by the target processing unit, update the metadata based on the first request processing status, and return the updated metadata to the host side. When the request type is a read request, determine the second request processing status corresponding to the target read / write request, update the metadata based on the second request processing status, and return the updated metadata to the host side.
5. The method according to claim 4, characterized in that, After returning the updated metadata to the host side, the method further includes: Inject an interrupt event into the host side to notify the host side of the processing result of the target read / write request.
6. The method according to claim 1, wherein The metadata is generated by a target driver in the host side based on the target read / write request. Before initiating a direct memory data access operation in response to a change in the value in the target register and obtaining metadata corresponding to the target read / write request from the host side, the method further includes: Receiving a target command sent by the host side, and returning target data to the host side based on the target command, so that the host side performs a loading operation of the target driver based on the target data.
7. The method according to claim 6, characterized in that The receiving a target command sent by the host side, and returning target data to the host side based on the target command, so that the host side performs a loading operation of the target driver based on the target data includes: Receiving a first acquisition command sent by the host side, determining first data corresponding to the first acquisition command, and returning the first data to the host side, so that the host side determines configuration information corresponding to the target driver based on the first data and registers the configuration information into the kernel of the host side, where the first data includes at least one target device type supported by the DPU and at least one instance identifier corresponding to each target device type; Receiving a device reset command sent by the host side, performing a reset operation on at least one para-virtualized device in the DPU based on the device reset command, and returning reset status information to the host side, so that the host side sets the device status corresponding to the at least one para-virtualized device based on the reset status information; Receiving a second acquisition command sent by the host side, determining second data corresponding to the second acquisition command, and returning the second data to the host side, where the second data includes configuration items corresponding to each para-virtualized device, so that the host side determines target configuration items supported by both the host side and the DPU based on the second data and sends the target configuration items to the DPU; Receiving target configuration items sent by the host side, and returning configuration values corresponding to each target configuration item to the host side, so that the host side sets queue parameters corresponding to each para-virtualized device based on the configuration values to complete the loading operation of the target driver.
8. The method according to claim 6, wherein An association relationship is established between an interrupt handler of the target driver in the host side and an interrupt in the DPU, so that the target driver can respond to and process interrupt events sent by the DPU.
9. A DPU data reading and writing device supporting semi-virtualized devices, characterized in that, Applicable to the DPU, including: A metadata acquisition module, configured to initiate a direct memory data access operation in response to a change in the value in the target register, and obtain metadata corresponding to the target read / write request from the host side, where the value of the target register is used to notify the DPU that there is a new data read / write request to be processed, and the target read / write request is the read / write request that was most recently placed in the queue corresponding to the target register; A type determination module, configured to determine a request type corresponding to the target read / write request and determine a device type corresponding to the target read / write request based on the target register; A data reading and writing module, configured to determine a target processing unit corresponding to executing the target read / write request based on the device type, and send the target read / write request and the metadata to the target processing unit, and execute the target read / write request based on the request type and the target processing unit.
10. An electronic device, characterized in that, It includes: A processor; A memory for storing executable instructions; Wherein, the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the DPU data reading and writing method for supporting semi-virtualized devices according to any one of claims 1-8 above.
Citation Information
Patent Citations
Virtualization method and device
CN105700826A
Virtualized storage device data processing method and device of data processor
CN115617270A
Method and device for processing access request, storage equipment and storage medium
CN115686341A
Direct memory access controller, heterogeneous device, memory access method and medium
CN116069711A
Data processing method, device and equipment and readable storage medium
CN116260711A