Address conversion method, computer equipment and medium
By introducing the address translation cache on the device side, the mapping relationship from IOVA to HPA is established in advance, which solves the problem of low IOMMU address translation efficiency, improves DMA data transmission efficiency and reduces IOMMU hardware load.
Patent Information
- Application Number
- CN202411224332.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2044-09-03
AI Technical Summary
In heterogeneous computing, data centers and cloud services, address translation through IOMMU results in inefficient DMA operations. Especially as the scale of data transmission increases, multiple memory accesses and address translation reduce transmission efficiency.
By introducing the address translation cache (ATC) on the device side, the mapping relationship from IOVA to HPA is established in advance during the device loading process, reducing dependence on IOMMU, and performing address translation directly on the device side to avoid multiple page table queries.
It improves the efficiency of DMA data transmission, reduces the workload of IOMMU hardware, and retains the restriction of device access range and physical address space isolation function.
Smart Images

Figure CN118760628A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an address conversion method, computer equipment and medium. Background Art
[0002] In heterogeneous computing, data centers, cloud services and other applications, direct memory access (DMA) is widely used to improve data access efficiency. In theory, the DMA operation of the device can access the entire physical address space, including access to memory areas such as the code segment and data segment storing the operating system. In order to protect the system and achieve isolation in address space, the input / output memory management unit (IOMMU) is used to restrict the device to access only the specified memory area, and to aggregate multiple scattered DMA operations into continuous DMA operations. However, address conversion through IOMMU increases the access time of DMA operations. As the scale of data transfer increases, the size of the data block to be moved for a data transfer performed by DMA operation may exceed the maximum bandwidth of the data channel, which may result in multiple memory accesses and multiple address conversions for a data transfer, thereby reducing the transmission efficiency.
[0003] To this end, the present application provides an address conversion method, a computer device and a medium, which can improve the efficiency of DMA data transmission, reduce the adverse effects of address conversion, and reduce the workload of IOMMU hardware. Summary of the invention
[0004] In a first aspect, the present application provides an address conversion method. The address conversion method includes: receiving a first memory access request from a first device, wherein the first memory access request includes a first input-output virtual address, the first device is deployed on the logical side of the host machine and connected to the driver side of the host machine through a first port, the driver side loads the first device in response to an address conversion request message initiated by the first device and includes: querying whether the first input-output memory management unit associated with the first port located on the driver side contains a first host machine physical address corresponding to the first input-output virtual address, and if the first input-output memory management unit contains the first host machine physical address, the driver side sends a message containing the first input-output virtual address and the first host machine physical address. An address translation completion message is sent to the first device; a first address translation cache located on the logical side is retrieved to determine whether there is a first address translation table entry containing the first host physical address corresponding to the first input / output virtual address in the first address translation cache, wherein the first device, in response to receiving the address translation completion message, saves the first input / output virtual address and the first host physical address into the first address translation cache; if the first address translation table entry exists in the first address translation cache, the first host physical address is used to execute the first memory access request; if the first address translation table entry does not exist in the first address translation cache, a page table query is performed using the first input / output virtual address.
[0005] Through the first aspect of the present application, by optimizing the design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through the IOMMU is retained, and on the other hand, the problem of low transmission efficiency caused by address conversion through the IOMMU is effectively overcome; it does not rely on the DMA request initiated by the device to update the table entries stored in the ATC table, and a large number of TLP requests for page table search through the IOMMU can be intercepted at the source of the device; the DMA data transmission efficiency is improved, and the workload of the system IOMMU hardware is reduced.
[0006] In a possible implementation manner of the first aspect of the present application, the first memory access request is a direct memory access request or a remote direct memory access request.
[0007] In a possible implementation manner of the first aspect of the present application, the first input-output memory management unit is used to provide an address translation function for all devices connected to the first port.
[0008] In a possible implementation of the first aspect of the present application, the address conversion method further includes: if the first address conversion table entry does not exist in the first address conversion cache, using the first input-output virtual address to perform a page table query to determine the first host machine physical address corresponding to the first input-output virtual address, and then using the first host machine physical address to execute the first memory access request.
[0009] In a possible implementation of the first aspect of the present application, after the driver side completes loading the first device, all address translation table entries in the first address translation cache are independent of the execution process of the memory access request from the first device.
[0010] In a possible implementation of the first aspect of the present application, all address translation table entries in the first address translation cache are independent of the execution result of the memory access request from the first device, including: during the execution of the memory access request from the first device, all address translation table entries in the first address translation cache remain unchanged.
[0011] In a possible implementation of the first aspect of the present application, the first input-output memory management unit, in response to receiving a first data request processing layer protocol message corresponding to the first memory access request from the first device, detects the address type field in the message header of the first data request processing layer protocol message to determine whether the first data request processing layer protocol message carries the first host machine physical address or the first input-output virtual address. Then, if the first data request processing layer protocol message carries the first host machine physical address, the first input-output memory management unit uses the first host machine physical address to execute the first memory access request; if the first data request processing layer protocol message carries the first input-output virtual address, the first input-output memory management unit uses the first input-output virtual address to perform a page table query.
[0012] In a possible implementation manner of the first aspect of the present application, if the first address translation table entry exists in the first address translation cache, in response to uninstallation of the first device, the first address translation table entry in the first address translation cache is deleted.
[0013] In a possible implementation of the first aspect of the present application, all devices mounted under the first port include the first device and a second device different from the first device, and the second memory access request of the second device includes a second input / output virtual address, wherein the driver side loads the second device in response to an address translation request message initiated by the second device and includes: querying whether the first input / output memory management unit includes a second host physical address corresponding to the second input / output virtual address, and if the first input / output memory management unit includes the second host physical address, the driver side sends an address translation completion message including the second input / output virtual address and the second host physical address to the second device, so that the second device saves the second input / output virtual address and the second host physical address in a second address translation cache located on the logical side that is different from the first address translation cache.
[0014] In a possible implementation of the first aspect of the present application, multiple address translation table entries in the first address translation cache are allocated to the first device for executing all memory access requests of the first device, and the multiple address translation table entries are determined based on the queue resources of the first device and the device priority of the first device. The device priority of the first device is determined based on whether the first device is a remote direct memory access device and the user customization requirements of the first device.
[0015] In a possible implementation of the first aspect of the present application, the first address translation cache is used to provide address translation resources located on the logic side to the first device, and the first input-output memory management unit is used to provide address translation resources located on the driver side to the first device.
[0016] 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.
[0017] 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.
[0018] 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
[0019] 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.
[0020] Figure 1 A flowchart of an address conversion method provided in an embodiment of the present application; Figure 2 A reference provided for the embodiments of this application Figure 1 A schematic diagram of a data processing unit of the address conversion method shown; Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0022] 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.
[0023] Figure 1 A flowchart of an address conversion method provided in an embodiment of the present application. Figure 1 As shown, the address conversion method includes the following steps.
[0024] Step S110: receiving a first memory access request of a first device, wherein the first memory access request includes a first input / output virtual address, the first device is deployed on a logical side of a host machine and connected to a driver side of the host machine through a first port, the driver side loads the first device in response to an address conversion request message initiated by the first device and includes: querying whether a first input / output memory management unit associated with the first port located on the driver side includes a first host machine physical address corresponding to the first input / output virtual address, and if the first input / output memory management unit includes the first host machine physical address, the driver side sends an address conversion completion message including the first input / output virtual address and the first host machine physical address to the first device.
[0025] Step S120: Retrieve the first address translation cache located on the logical side to determine whether there is a first address translation table entry in the first address translation cache that contains the first host physical address corresponding to the first input / output virtual address, wherein the first device, in response to receiving the address translation completion message, saves the first input / output virtual address and the first host physical address into the first address translation cache.
[0026] Step S130: If the first address translation table entry exists in the first address translation cache, use the first host physical address to execute the first memory access request; if the first address translation table entry does not exist in the first address translation cache, use the first input and output virtual address to execute a page table query.
[0027] Figure 1The address conversion method shown can be applied to technical fields such as heterogeneous computing, data centers, and cloud services. In these technical fields, direct memory access (DMA) is widely used to improve data access efficiency. In order to limit the access range of the device and achieve isolation in the address space, the input / output memory management unit (IOMMU) is generally used as a bridge for DMA operations between the host and the device. The IOMMU can perform address conversion between the input / output virtual address (IOVA) and the host physical address (HPA), so that the device can perform DMA operations through the IOMMU. In this way, the device can be restricted from accessing certain memory areas, such as the code segment and data segment of the operating system. In addition, the address conversion between IOVA and HPA is realized through the mapping of the IOMMU, which can improve the DMA capability of the device, for example, allowing a device with only 32-bit DMA capability to access a memory address space greater than 4 gigabytes (GB), and can also aggregate multiple scattered DMA operations into a continuous DMA operation. The basic process of a device performing a DMA operation through the IOMMU includes the device including a source identifier (Source Identifier), such as a Bus-Device-Function (BFD) identifier, in the DMA request. Then, the IOMMU uses the source identifier to query the page table, find the page table header address of the corresponding device, and use the page table to convert the IOVA in the device's DMA request into an HPA, so that the device can access the host's physical address space through the HPA. However, using the IOMMU to perform address conversion increases the access time of DMA operations. As the scale of data transfer increases, the size of the data block that needs to be moved for a data transfer performed through a DMA operation may exceed the maximum bandwidth of the data channel, which may result in multiple memory accesses and multiple address conversions for a single data transfer, thereby reducing transmission efficiency. For this reason, Figure 1 The address translation method shown, on the one hand, retains the function of limiting the access range of the device and realizing the isolation of the physical address space on the host through the IOMMU, and on the other hand, effectively overcomes the problem of low transmission efficiency caused by address translation through the IOMMU, which is further described in detail below. It should be understood that Figure 1The address conversion method shown can be applied to real devices attached to the root port, and can also be applied to various types of standard peripheral component interconnect express (PCIE) devices simulated by a data processing unit (DPU). The operating system on the host side enumerates the PCIE topology and PCIE devices, and then drives different types of PCIE devices through corresponding types of drivers on the host side.
[0028] See also Figure 1In the steps shown, the driver side loads the first device in response to the address translation request message initiated by the first device and includes: querying whether the first input-output memory management unit associated with the first port located on the driver side contains the first host physical address corresponding to the first input-output virtual address, and if the first input-output memory management unit contains the first host physical address, the driver side sends an address translation completion message containing the first input-output virtual address and the first host physical address to the first device. Here, the first device is deployed on the logical side of the host and connected to the driver side of the host through the first port. And, the first device, in response to receiving the address translation completion message, saves the first input-output virtual address and the first host physical address into the first address translation cache. Therefore, in response to the address translation request message initiated by the first device, when the driver side loads the first device, it queries whether the first input / output memory management unit associated with the first port located on the driver side contains the first host physical address corresponding to the first input / output virtual address. If the first input / output memory management unit contains the first host physical address, the driver side sends an address translation completion message containing the first input / output virtual address and the first host physical address to the first device. Then, in response to receiving the address translation completion message, the first device saves the first input / output virtual address and the first host physical address to the first address translation cache. In this way, by optimizing the design of the device loading process, a foundation is established for the processing optimization of the DMA request of subsequent devices. In step S110, a first memory access request of the first device is received, wherein the first memory access request includes the first input / output virtual address. Then, in step S120, the first address translation cache located on the logical side is retrieved to determine whether there is a first address translation table entry containing the first host physical address corresponding to the first input / output virtual address in the first address translation cache. Then, in step S130, if the first address translation table entry exists in the first address translation cache, the first host physical address is used to execute the first memory access request; if the first address translation table entry does not exist in the first address translation cache, the first input and output virtual address is used to execute a page table query.
[0029] Continue reading Figure 1, it can be seen that in order to speed up the address conversion efficiency from IOVA to HPA, by adding an Address Translation Cache (ATC) on the device side, it is equivalent to performing the address conversion from IOVA to HPA on the device side, that is, without going through the IOMMU, which reduces the access time of accessing the conversion page table (generally a large page cache) in the IOMMU. In particular, when a data transmission requires multiple memory accesses and multiple address conversions, using the ATC on the device side, that is, the logical side, such as the first address translation cache located on the logical side, can effectively improve the transmission efficiency. In addition, in combination with the PCIE protocol specification, if a device supports ATC, the Address Translation Services (ATS) capability should be marked in the extended capabilities list of the device, and the Address Type (AT) field is defined in the Transaction Layer Specification (TLP) message header to indicate whether the address conversion has been performed, such as HPA that has undergone address conversion or IOVA that has not undergone address conversion. In the application of DPU, a hardware ATC table is provided on the logic side, and the embedded central processing unit (ECPU) of DPU maintains and manages the hardware ATC table. Assuming that the DPU simulates and generates a device (such as the first device) with ATS extension capability, the host configures the memory space information of the device (such as the first input and output virtual address, which may also include information such as length) during the process of loading the device. After receiving the memory space information of the device, the ECPU on the logic side, i.e., the system simulator, may initiate an address conversion request message to the IOMMU on the driver side in advance. In this way, in response to the address conversion request message initiated by the first device, the driver side starts the process of loading the device such as the first device; in this way, after receiving the address conversion request message from the ECPU, the IOMMU on the driver side searches the conversion page table to determine the first host physical address corresponding to the first input and output virtual address, and feeds back the address conversion completion message with the first host physical address to the device; then, the device stores the first input and output virtual address and the first host physical address as table entries in the hardware ATC table. In this way, when the device subsequently initiates a DMA request, the first input / output virtual address can be used to search the hardware ATC table and match it to the first host physical address, and then the first host physical address can be used for DMA data transmission. If there is no matching table entry, the first input / output virtual address is used.When the IOMMU on the driver side receives a TLP message related to a DMA request from the device, it can be determined through the AT field in the message header whether to directly use the first host machine physical address for DMA data operation, or to use the first input / output virtual address to search the translation page table to obtain the first host machine physical address for DMA data operation. In addition, after the host machine driver uninstalls the device, the ECPU receives a request to uninstall the device, and then deletes the table entries of the first input / output virtual address and the first host machine physical address from the hardware ATC table.
[0030] Continue reading Figure 1 , Figure 1The address conversion method shown in the DPU application combines the management capability of the ECPU simulator of the DPU with the requirements of the PCIE protocol specification for PCIE devices with ATS extension capabilities, so that the host machine is not aware of it. For PCIE devices with ATS extension capabilities, instead of waiting until the device makes a DMA request to load the cache, the mapping relationship between IOVA and HPA is stored in the hardware ATC table in advance during the process of loading the device, so that the device can directly look up the table when it makes a DMA request later, thus saving the subsequent table lookup operation initiated to the IOMMU. In this way, through the optimized design of the device loading process, a foundation is established for the subsequent device DMA request processing optimization. In addition, it does not depend on the memory access request made by the device, such as a DMA request or a remote direct memory access (RDMA) request. When loading each PCIE device, the operation of looking up the conversion page table and adding table entries to the hardware ATC table is uniformly implemented through the ECPU simulator of the DPU. Not only can a hardware ATC table be provided for PCIE devices with ATS extension capabilities, such as providing a first address translation cache located on the logical side for the first device, but also, for PCIE devices without ATS extension capabilities, the function of limiting the access range of the device and implementing the isolation of the physical address space on the host machine through IOMMU is retained. Specifically, for PCIE devices without ATS extension capabilities, this means that when these devices are loaded, no corresponding table entries are established in the hardware ATC table, so the corresponding host machine physical address cannot be found when the table is looked up, so it is necessary to use IOMMU to find the conversion page table. Therefore, through the optimized design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through the IOMMU is retained. If the corresponding table entry is not found when the IOMMU is queried during device loading, the address conversion completion message will not be sent to the device. In this way, the corresponding table entry will not be found in the ATC table when the DMA request of the device is subsequently processed, resulting in the use of the input and output virtual addresses to perform page table queries. Therefore, the device's access to the physical memory space of the host machine can be restricted through the IOMMU; on the other hand, the problem of low transmission efficiency caused by address conversion through the IOMMU is effectively overcome. If the corresponding table entry is found when the IOMMU is queried during device loading, for example, the first input and output memory management unit contains the first host physical address, an address conversion completion message is sent to the device, and then the device establishes the corresponding table entry in the address conversion cache, that is, the ATC table. In this way, the corresponding table entry will be found in the ATC table when the DMA request of the device is subsequently processed, so that the real physical address can be used directly to execute the DMA request, thus saving the loss of performing page table queries through the IOMMU.In addition, because the corresponding table entries in the hardware ATC table, such as the first address translation cache, are established during the process of loading the device, it does not rely on the DMA request initiated by the device to update the table entries stored in the ATC table. This means that a large number of TLP requests for page table lookups through the IOMMU can be intercepted at the source of the device, thereby effectively reducing the load on the IOMMU hardware. Furthermore, the access performance bottleneck problem of the IOMMU can be solved through a distributed design concept. The hardware ATC table can be set as a device-level cache optimization, such as providing a separate ATC table for each device, such as providing a first address translation cache for the first device and another address translation cache for another device. Multiple devices can also share an ATC table, and the table entry resources of the ATC table can be dynamically allocated according to the queue resources of the device, such as allocating 64 table entries in the ATC table to devices with 64 queues. In this way, it is possible to better adapt to various combinations and requirements of devices attached to each root port and user requirements for customized input and output.
[0031] In conclusion, Figure 1 The address conversion method shown can be applied to technical fields such as heterogeneous computing, data centers, and cloud services, and can be used in scenarios where various types of standard PCIE devices are simulated by DPU, providing a solution based on the descriptor memory address conversion cache function. For example, the ECPU-side simulator simulates a PCIE device with ATS extension capability enabled; when the PCIE device is loaded by the HOST-side driver, an IOVA to HPA address conversion request for the descriptor memory space is initiated to the IOMMU hardware in advance, and IOVA and HPA are saved in the global hardware ATC table entry; when the PCIE device initiates a DMA request, IOVA is used to search for the global ATC table entry, and if a hit is found, HPA is used for DMA data transmission. Figure 1 The address conversion method shown, through the optimization design of the device loading process, retains the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through the IOMMU on the one hand, and effectively overcomes the problem of low transmission efficiency caused by address conversion through the IOMMU on the other hand; it does not rely on the DMA request initiated by the device to update the table entries stored in the ATC table, and can intercept a large number of TLP requests for page table search through the IOMMU at the device source; improves the DMA data transmission efficiency and reduces the workload of the system IOMMU hardware.
[0032] Figure 2 A reference provided for the embodiments of this application Figure 1 Schematic diagram of a data processing unit of the address conversion method shown. Figure 2As shown, the host machine 200 includes a logic side 202 and a driver side 204. There are port A210 and port B220 between the logic side 202 and the driver side 204. Device A230, device B232 and device C234 are mounted under port A210, and device D236 and device E238 are mounted under port B220. Port A210 corresponds to input-output memory management unit A212, and port B220 corresponds to input-output memory management unit B222. Figure 2 It is also shown that device A230 corresponds to address translation cache A240, device B232 and device C234 both correspond to address translation cache B242, device D236 corresponds to address translation cache C244, and device E238 corresponds to address translation cache D244.
[0033] See also Figure 2 , Figure 2 The data processing unit 206 simulates and generates device A 230, device B 232, device C 234, device D 236, and device E 238. The data processing unit 206 also includes an address translation cache A 240, an address translation cache B 242, an address translation cache C 244, and an address translation cache D 244. Figure 1 The address conversion method shown, Figure 2 The data processing unit 206 shown receives a first memory access request from a first device for a memory access request from device A230, device B232 and device C234, or device D236 and device E238, and then retrieves a first address translation cache located on the logical side 202 to determine whether there is a first address translation table entry containing the first host machine physical address corresponding to the first input / output virtual address in the first address translation cache. For example, the memory access request of device A230 is received, and then the address translation cache A240 corresponding to device A230 located on the logical side 202 is retrieved. If there is a corresponding address translation table entry in the address translation cache corresponding to the device, the memory access request is directly executed using the host machine physical address, and if not, the input / output virtual address is used, thereby executing a page table query through the corresponding input / output memory management unit. For example, for the memory access request of device A230, if there is no corresponding address translation table entry in the address translation cache A240, the input / output virtual address is used, thereby executing a page table query through the corresponding input / output memory management unit A212.
[0034] See also Figure 2It can be seen that the input-output memory management unit A212 and the input-output memory management unit B222 provide address translation resources at the input-output memory management unit level on the driver side 204. However, if the device simulated and generated by the data processing unit 206, such as device A230, is to perform page table query through the corresponding input-output memory management unit A212, it must involve access from the logical side 202 to the driver side 204, which also involves data uplink and downlink. Therefore, through the address translation cache A240, the address translation cache B242, the address translation cache C244 and the address translation cache D244, the device-level address translation resources on the logical side 202 are provided, and a single address translation cache can be provided for a single device, such as device A230 corresponding to address translation cache A240, or multiple devices can share an address translation cache, such as device B232 and device C234 both corresponding to address translation cache B242. In this way, through the device-level address conversion resources on the logical side 202, the access performance bottleneck problem of IOMMU can be solved through a distributed design concept, and the table entry resources of the address conversion cache can be dynamically allocated according to the queue resources of the device. For example, it can be assumed that the device A230 has 64 queues, and the address conversion cache A240 can have 64 entries to meet the memory access requests of the 64 queues. In this way, the various combinations, requirements and user requirements for customized input and output of the devices attached to each root port can be better adapted. In addition, because the corresponding table entries in the address conversion cache are established during the process of loading the device, it is not dependent on the DMA request initiated by the device to update the table entries stored in the address conversion cache, which means that a large number of TLP requests for page table lookups through the IOMMU can be intercepted at the source of the device, thereby effectively reducing the load on the IOMMU hardware.
[0035] See also Figure 1 and Figure 2 In a possible implementation, the first memory access request is a direct memory access request or a remote direct memory access request. In this way, through the optimized design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through IOMMU is retained, and on the other hand, the problem of low transmission efficiency caused by address conversion through IOMMU is effectively overcome; it does not rely on the DMA request initiated by the device to update the table items stored in the ATC table, and a large number of TLP requests for page table lookup through IOMMU can be intercepted at the source of the device; the DMA data transmission efficiency is improved, and the workload of the system IOMMU hardware is reduced.
[0036] In a possible implementation, the first input-output memory management unit is used to provide address translation function to all devices attached to the first port. In this way, through the optimized design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through IOMMU is retained, and on the other hand, the problem of low transmission efficiency caused by address translation through IOMMU is effectively overcome; it does not rely on the DMA request initiated by the device to update the table items stored in the ATC table, and a large number of TLP requests for page table lookup through IOMMU can be intercepted at the source of the device; the DMA data transmission efficiency is improved, and the workload of the system IOMMU hardware is reduced.
[0037] In a possible implementation, the address conversion method further includes: if the first address conversion table entry does not exist in the first address conversion cache, using the first input / output virtual address to perform a page table query to determine the first host machine physical address corresponding to the first input / output virtual address, and then using the first host machine physical address to execute the first memory access request. In this way, through the optimized design of the device loading process, on the one hand, the function of limiting the access range of the device and realizing the isolation of the physical address space on the host machine through the IOMMU is retained, and on the other hand, the problem of low transmission efficiency caused by address conversion through the IOMMU is effectively overcome; it does not rely on the DMA request initiated by the device to update the table entries stored in the ATC table, and a large number of TLP requests for page table lookups through the IOMMU can be intercepted at the source of the device; the DMA data transmission efficiency is improved, and the workload of the system IOMMU hardware is reduced.
[0038] In a possible implementation, after the driver side completes loading the first device, all address translation table entries in the first address translation cache are independent of the execution process of the memory access request from the first device. In some embodiments, all address translation table entries in the first address translation cache are independent of the execution result of the memory access request from the first device, including: during the execution process of the memory access request from the first device, all address translation table entries in the first address translation cache remain unchanged. In this way, through the optimized design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through the IOMMU is retained. If the corresponding table entry is not found when the IOMMU is queried during device loading, the address conversion completion message will not be sent to the device. In this way, the corresponding table entry will not be found in the ATC table when the DMA request of the device is subsequently processed, resulting in the use of the input and output virtual addresses to perform page table queries. Therefore, the device's access to the physical memory space of the host machine can be restricted through the IOMMU; on the other hand, the problem of low transmission efficiency caused by address conversion through the IOMMU is effectively overcome. If the corresponding table entry is found when the IOMMU is queried during device loading, for example, the first input and output memory management unit contains the first host physical address, an address conversion completion message is sent to the device, and then the device establishes the corresponding table entry in the address conversion cache, that is, the ATC table. In this way, the corresponding table entry will be found in the ATC table when the DMA request of the device is subsequently processed, so that the real physical address can be used directly to execute the DMA request, thus saving the loss of performing page table queries through the IOMMU. In addition, because the corresponding table entries in the hardware ATC table, such as the first address translation cache, are established during the process of loading the device, it does not rely on the DMA request initiated by the device to update the table entries stored in the ATC table. This means that a large number of TLP requests for page table lookups through the IOMMU can be intercepted at the source of the device, thereby effectively reducing the load on the IOMMU hardware.
[0039] In one possible implementation, the first input-output memory management unit, in response to receiving a first data request processing layer protocol message corresponding to the first memory access request from the first device, detects an address type field in a message header of the first data request processing layer protocol message to determine whether the first data request processing layer protocol message carries the first host machine physical address or the first input-output virtual address. Then, if the first data request processing layer protocol message carries the first host machine physical address, the first input-output memory management unit uses the first host machine physical address to execute the first memory access request; if the first data request processing layer protocol message carries the first input-output virtual address, the first input-output memory management unit uses the first input-output virtual address to perform a page table query. In this way, through the optimized design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through IOMMU is retained, and on the other hand, the problem of low transmission efficiency caused by address conversion through IOMMU is effectively overcome; it does not rely on the DMA request initiated by the device to update the table entries stored in the ATC table, and a large number of TLP requests for page table search through IOMMU can be intercepted at the source of the device; the DMA data transmission efficiency is improved, and the workload of the system IOMMU hardware is reduced.
[0040] In a possible implementation, if the first address translation table entry exists in the first address translation cache, in response to the unloading of the first device, the first address translation table entry in the first address translation cache is deleted. In this way, through the optimized design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through IOMMU is retained, and on the other hand, the problem of low transmission efficiency caused by address conversion through IOMMU is effectively overcome; it does not rely on the DMA request initiated by the device to update the table entries stored in the ATC table, and a large number of TLP requests for page table lookups through IOMMU can be intercepted at the source of the device; the DMA data transmission efficiency is improved, and the workload of the system IOMMU hardware is reduced.
[0041] In a possible implementation, all devices mounted on the first port include the first device and a second device different from the first device, and a second memory access request of the second device includes a second input / output virtual address, wherein the driver side loads the second device in response to an address translation request message initiated by the second device and includes: querying whether the first input / output memory management unit includes a second host physical address corresponding to the second input / output virtual address, and if the first input / output memory management unit includes the second host physical address, the driver side sends an address translation completion message including the second input / output virtual address and the second host physical address to the second device, so that the second device saves the second input / output virtual address and the second host physical address in a second address translation cache located on the logical side that is different from the first address translation cache. In this way, through the optimized design of the device loading process, on the one hand, the function of limiting the access scope of the device and realizing the isolation of the physical address space on the host machine through IOMMU is retained, and on the other hand, the problem of low transmission efficiency caused by address conversion through IOMMU is effectively overcome; it does not rely on the DMA request initiated by the device to update the table items stored in the ATC table, and a large number of TLP requests for page table search through IOMMU can be intercepted at the source of the device; the DMA data transmission efficiency is improved, and the workload of the system IOMMU hardware is reduced. In addition, the hardware ATC table can be set as a device-level cache optimization, for example, a separate ATC table is provided for each device, such as providing a first address conversion cache for the first device and another address conversion cache for another device, which can better adapt to various combinations and requirements of devices attached to each root port and user customized requirements for input and output.
[0042] In a possible implementation, the plurality of address translation table entries in the first address translation cache are allocated to the first device for executing all memory access requests of the first device, and the plurality of address translation table entries are determined based on the queue resources of the first device and the device priority of the first device, and the device priority of the first device is determined based on whether the first device is a remote direct memory access device and the user customization requirements of the first device. In this way, optimization is performed from two dimensions of device priority and device queue resources, and the limited memory resources on the logic side can be more effectively utilized. Devices with higher device priorities, such as high-performance devices, devices with high response speed requirements, user-specified devices, etc., such as RDMA devices, can be allocated separate ATC tables, while other devices with lower device priorities can share an ATC table. Device queue resources represent the input and output requirements of the device, such as 10 queues, 16 queues, and 64 queues. The ATC table can be allocated according to the queue resources of each device, for example, a device with 10 queues is allocated an ATC table with 10 entries, and a device with 64 queues is allocated an ATC table with 64 entries. The table entry resources of the ATC table can also be allocated on demand according to all queue resources of multiple devices that need to share the same ATC table. Combined with the device priority, sufficient table entry resources can be allocated to high-priority devices to meet the needs of all their queues, while for low-priority devices, table entry resources can be allocated to meet the needs of half of their queues. In this way, the global ATC table is set during the device loading process and is not updated during the processing of DMA requests. In addition, the table entry resources of the ATC table can be allocated in combination with the device priority and queue resources. The ATC table can be provided separately for the device, or multiple devices can share the same ATC table. In this way, user customization needs can be better met and limited memory resources on the DPU side can be used more efficiently. In addition, because it relies on table lookup and downloading of table entries to the ATC table when the device is loaded, and the ATC table is not updated when actually processing DMA requests and RDMA requests, the maintenance and management loss is reduced. It is equivalent to exchanging the memory space on the DPU for higher address conversion efficiency, and it also utilizes the time non-overlap characteristics of device loading and device operation, which helps to improve the system operation efficiency.
[0043] In a possible implementation, the first address translation cache is used to provide address translation resources located on the logic side to the first device, and the first input-output memory management unit is used to provide address translation resources located on the driver side to the first device. In this way, through the device-level address translation resources on the logic side, the access performance bottleneck problem of IOMMU can be solved through a distributed design concept, and the table entry resources of the address translation cache can be dynamically allocated according to the queue resources of the device. For example, it can be assumed that the device has 64 queues, and the address translation cache can have 64 entries to meet the memory access requests of 64 queues. In this way, various combinations, requirements and user customized requirements for input and output of devices attached to each root port can be better adapted. In addition, because the corresponding table entries in the address translation cache are established in the process of loading the device, it does not rely on the DMA request initiated by the device to update the table entries stored in the address translation cache, which means that a large number of TLP requests for page table lookups through IOMMU can be intercepted at the source of the device, thereby effectively reducing the load of the IOMMU hardware.
[0044] 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.
[0045] 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.
[0046] 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.
[0047] 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.
[0048] 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.
[0049] 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.
[0050] 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.
[0051] 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.
[0052] 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.
[0053] 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. An address conversion method, It is characterized in that The address conversion method comprises: receiving a first memory access request of a first device, wherein the first memory access request includes a first input / output virtual address, the first device is deployed on a logical side of a host machine and connected to a driver side of the host machine through a first port, the driver side loads the first device in response to an address translation request message initiated by the first device and includes: querying whether a first input / output memory management unit associated with the first port located on the driver side includes a first host machine physical address corresponding to the first input / output virtual address, and if the first input / output memory management unit includes the first host machine physical address, the driver side sends an address translation completion message including the first input / output virtual address and the first host machine physical address to the first device; searching a first address translation cache located at the logic side to determine whether there is a first address translation table entry in the first address translation cache that includes the first host machine physical address corresponding to the first input / output virtual address, wherein the first device, in response to receiving the address translation completion message, saves the first input / output virtual address and the first host machine physical address in the first address translation cache; If the first address translation table entry exists in the first address translation cache, the first host physical address is used to execute the first memory access request; if the first address translation table entry does not exist in the first address translation cache, the first input and output virtual address is used to execute a page table query.
2. The address conversion method according to claim 1, It is characterized in that The first memory access request is a direct memory access request or a remote direct memory access request.
3. The address conversion method according to claim 1, It is characterized in that The first input-output memory management unit is used to provide an address translation function for all devices connected to the first port.
4. The address conversion method according to claim 1, It is characterized in that The address translation method also includes: if the first address translation table entry does not exist in the first address translation cache, using the first input-output virtual address to perform a page table query to determine the first host machine physical address corresponding to the first input-output virtual address, and then using the first host machine physical address to execute the first memory access request.
5. The address conversion method according to claim 1, It is characterized in that After the driver side completes loading the first device, all address translation table entries in the first address translation cache are independent of the execution process of the memory access request from the first device.
6. The address conversion method according to claim 5, It is characterized in that All address translation table entries in the first address translation cache are independent of the execution result of the memory access request from the first device, including: during the execution of the memory access request from the first device, all address translation table entries in the first address translation cache remain unchanged.
7. The address conversion method according to claim 1, It is characterized in that The first input-output memory management unit, in response to receiving a first data request processing layer protocol message corresponding to the first memory access request from the first device, detects an address type field in a message header of the first data request processing layer protocol message to determine whether the first data request processing layer protocol message carries the first host machine physical address or the first input-output virtual address. Then, if the first data request processing layer protocol message carries the first host machine physical address, the first input-output memory management unit uses the first host machine physical address to execute the first memory access request; if the first data request processing layer protocol message carries the first input-output virtual address, the first input-output memory management unit uses the first input-output virtual address to perform a page table query.
8. The address conversion method according to claim 1, It is characterized in that If the first address translation table entry exists in the first address translation cache, in response to uninstallation of the first device, the first address translation table entry in the first address translation cache is deleted.
9. The address conversion method according to claim 1, It is characterized in that All devices mounted on the first port include the first device and a second device different from the first device, and a second memory access request of the second device includes a second input / output virtual address, wherein the driver side loads the second device in response to an address translation request message initiated by the second device and includes: querying whether the first input / output memory management unit includes a second host machine physical address corresponding to the second input / output virtual address, and if the first input / output memory management unit includes the second host machine physical address, the driver side sends an address translation completion message including the second input / output virtual address and the second host machine physical address to the second device, so that the second device saves the second input / output virtual address and the second host machine physical address in a second address translation cache located on the logical side that is different from the first address translation cache.
10. The address conversion method according to claim 1, It is characterized in that Multiple address translation table entries in the first address translation cache are allocated to the first device for executing all memory access requests of the first device, and the multiple address translation table entries are determined based on the queue resources of the first device and the device priority of the first device. The device priority of the first device is determined based on whether the first device is a remote direct memory access device and the user customization requirements of the first device.
11. The address conversion method according to claim 1, It is characterized in that The first address translation cache is used to provide address translation resources located on the logic side to the first device, and the first input-output memory management unit is used to provide address translation resources located on the driver side to the first device.
12. A computer device, It is 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 11 when executing the computer program.
13. A computer-readable storage medium, It is 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 11.
Citation Information
Patent Citations
Memory access management unit and system of input and output device and address conversion method
CN112612574A
Address translation cache table item management method
CN114780453A
Direct memory mapping method and device, equipment, cluster and medium
CN117331861A
Media-flow conversion address distribution method and media-flow conversion method
CN1893390A
Cited By
Communication method, related device and storage medium
CN121000699A
Aggregation scheduling method and system for address translation requests
CN122268938A
Data access method and virtual network card
CN122640388A
Data access method and virtual network card
CN122640388B
