A data transmission method, device, medium and computer program product
By storing the memory area hardware entry memory table and memory conversion area table locally in the first device, using the target memory identification and virtual address to query the physical address, directly access the host memory, solving the problem of inefficient remote direct memory access communication, and achieving efficient data transmission.
Patent Information
- Application Number
- CN202510380285.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2045-03-28
AI Technical Summary
In the prior art, there are bottlenecks in the communication efficiency of remote direct memory access, resulting in low data transmission efficiency.
By storing the memory area hardware entry memory table and memory conversion area table locally in the first device, the physical address is queried using the identification and virtual address of the target memory to directly access the host memory, reducing multiple table lookup operations on the host memory.
It improves the communication efficiency of remote direct memory access, solves the communication bottleneck problem, and realizes efficient data transmission.
Smart Images

Figure CN119883975B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technologies, and in particular, to a data transmission method, device, medium, and computer program product. Background Art
[0002] Remote Direct Memory Access (RDMA) technology allows a computer to directly access the memory of a remote host without the intervention of the operating system kernel, achieving high-speed data transmission, and has been widely applied in scenarios such as large-scale data processing in data centers, distributed storage systems, and high-performance computing clusters. With the increasing requirements for computing speed and data transmission speed in the field of high-performance computing, the efficiency of remote direct memory access communication urgently needs to be improved.
[0003] How to improve the efficiency of remote direct memory access communication is a technical problem that needs to be solved by those skilled in the art. Summary of the Invention
[0004] The present invention provides a data transmission method, device, medium, and computer program product to at least solve the problem that there is a bottleneck in the communication efficiency of remote direct memory access in related technologies.
[0005] The present invention provides a data transmission method, which is applied to a first device and includes:
[0006] Obtain the memory area hardware entry memory table and the memory translation area table of the host memory and store them locally;
[0007] When performing a data transmission task of remote direct memory access of the host, identify the identifier of the target memory in the host memory involved in the data transmission task and the target virtual address of the target memory;
[0008] According to the identifier of the target memory and the target virtual address, query the memory area hardware entry memory table to obtain the address of the memory translation area table corresponding to the target memory;
[0009] Query the memory translation area table according to the target virtual address to obtain the target physical address of the target memory;
[0010] Call a first bus to access the target physical address in the host memory to perform data transfer between the host memory and the local storage of the first device in the data transmission task.
[0011] The present invention further provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of the above data transmission method when executing the computer program.
[0012] The present invention also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of the above data transmission method are implemented.
[0013] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the above data transmission method are implemented.
[0014] Through the present invention, the memory area hardware entry memory table and the memory conversion area table of the host memory are stored locally in the first device. When the first device executes the data transmission task of remote direct memory access of the host, data transfer between the host memory and the local storage is required. The address in the host memory provided by the data transmission task is a virtual address, while the first bus access to the host memory requires a physical address. At this time, the first device does not need to look up the table in the host to determine the physical address of the target memory, but by identifying the identifier of the target memory in the host memory involved in the data transmission task and the target virtual address of the target memory, and then querying the memory conversion area table according to the target virtual address to obtain the target physical address of the target memory. At this time, it is necessary to call the first bus to access the target physical address in the host memory to perform the data transfer between the host memory and the local storage of the first device in the data transmission task. Therefore, the communication bottleneck in the current remote direct memory access process can be solved, and the technical effect of improving the communication efficiency of remote direct memory access is achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the embodiments of the present invention, the drawings required for the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0016] Figure 1 It is a flowchart of a data transmission method provided by an embodiment of the present invention;
[0017] Figure 2 It is a schematic diagram of the hardware architecture involved in a data transmission task provided by an embodiment of the present invention;
[0018] Figure 3 It is a flowchart of another data transmission method provided by an embodiment of the present invention;
[0019] Figure 4 It is a schematic diagram of the structure of a data transmission device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0020] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the protection scope of the present invention.
[0021] It should be noted that in the description of the present invention, the terms "comprise", "include" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present invention are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0022] In order to enable those skilled in the art of the present technology to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0023] Here, some key terms used in the embodiments of the present invention will be explained first.
[0024] Virtual memory technology: Modern operating systems generally adopt virtual memory technology, which is a technology that separates the logical address space of a program from the physical memory space. The operating system assigns an independent virtual address space to each process, so that different processes can use the same virtual address without interfering with each other. When a Peripheral Component Interconnect Express (PCIe) device needs to access the host memory, the virtual address provided by the application program is often received. However, physical memory is organized and managed by physical addresses. When the PCIe device actually performs data transfer, the virtual address must be converted into the corresponding physical address to accurately locate the data storage location in the memory.
[0025] Memory mapping and page management: The operating system realizes the mapping from virtual addresses to physical addresses through a page table. The page table records the corresponding relationship between each virtual page and physical page. When performing a Remote Direct Memory Access (RDMA) operation, the PCIe device cannot directly understand virtual addresses and needs to rely on a mechanism provided by the operating system (such as a driver) to query the page table to obtain the physical address corresponding to the virtual address.
[0026] Physical Address Addressing: The hardware design of PCIe devices typically performs memory access based on physical addresses. The memory controller and data transfer circuits of the device are designed to directly process physical addresses and do not have the ability to directly process virtual addresses. Therefore, before data transfer, the virtual address must be converted into a physical address so that the PCIe device can correctly access the data in the host memory.
[0027] Memory Region Hardware Entry Memory (MR HEM) is a special memory region used to store hardware entry information related to the memory region. This information is crucial for achieving efficient memory access and address translation.
[0028] Memory Translate Region is a data structure used to record the mapping relationship between virtual addresses and physical addresses. This mapping relationship is the key to implementing Remote Direct Memory Access (RDMA). In RDMA communication, when an application requests access to remote memory, the virtual address needs to be accurately converted into a physical address so that the RDMA device can directly access the target memory region.
[0029] When performing an RDMA data transfer task, the RDMA device not only needs to convert the virtual address into a physical address through the Memory Translate Region table but also needs to obtain the hardware entry information related to the target memory region with the help of the Memory Region Hardware Entry Memory table. This information includes the starting address of the memory region, access permissions, memory type, etc. With this information, the RDMA device can accurately locate the target memory region and perform safe and efficient access.
[0030] In the related art, each time the host performs an RDMA operation (RDMA read, RDMA write), the RDMA device needs to find the required physical address from the host memory based on the virtual address and key sent by the host. First, it queries the Memory Region Hardware Entry Memory table, and based on the query result, it accesses the Memory Translate Region table in the host memory again to find the corresponding physical address. Then, the data is moved from the host memory to the send buffer of the RDMA device for data transmission. In this way, the RDMA device needs to access the host memory multiple times, which greatly affects the efficiency of RDMA.
[0031] Therefore, in the data transmission solution provided by the embodiments of the present invention, the memory area hardware entry memory table and the memory translation area table of the host memory are stored locally in the first device. When the first device executes the data transmission task of remote direct memory access of the host, data transfer between the host memory and the local storage is required. The address in the host memory provided by the data transmission task is a virtual address, while the first bus needs a physical address to access the host memory. At this time, the first device does not need to look up the table in the host to determine the physical address of the target memory. Instead, by identifying the identifier of the target memory and the target virtual address of the target memory in the host memory involved in the data transmission task, and then querying the memory translation area table according to the target virtual address, the target physical address of the target memory is obtained. Only at this time does it need to call the first bus to access the target physical address in the host memory to perform the data transfer between the host memory and the local storage of the first device in the data transmission task. Therefore, the communication bottleneck that appears in the current remote direct memory access process can be solved, and the technical effect of improving the communication efficiency of remote direct memory access is achieved.
[0032] Embodiments of the present invention provide a data transmission method. Combining the execution process of the data transmission method, the method will be described in detail below.
[0033] Figure 1 It is a flowchart of a data transmission method provided by an embodiment of the present invention; Figure 2 It is a schematic diagram of the hardware architecture involved in a data transmission task provided by an embodiment of the present invention.
[0034] As Figure 1 shown, applied to the first device, the data transmission method provided by the embodiments of the present invention includes:
[0035] S101: Obtain the memory area hardware entry memory table and the memory translation area table of the host memory and store them locally.
[0036] S102: When executing the data transmission task of remote direct memory access of the host, identify the identifier of the target memory and the target virtual address of the target memory in the host memory involved in the data transmission task.
[0037] S103: According to the identifier of the target memory and the target virtual address, query the memory area hardware entry memory table to obtain the address of the memory translation area table corresponding to the target memory.
[0038] S104: Query the memory translation area table according to the target virtual address to obtain the target physical address of the target memory.
[0039] S105: Call the first bus to access the target physical address in the host memory to perform the data transfer between the host memory and the local storage of the first device in the data transmission task.
[0040] In the embodiments of the present invention, the hardware architecture applicable to the data transmission task is as follows Figure 2 As shown, the first device is connected to the host through the first bus.
[0041] The first device is a device with remote direct memory access function connected to the host through the first bus. In some alternative embodiments, the first device may be an accelerator, such as a Graphics Processing Unit (GPU), a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), and a Data Processing Unit (DPU), etc. In some other alternative embodiments, the first device may also be a remote direct memory access network card.
[0042] The first bus may be a Peripheral Component Interconnect (PCI) bus or a peripheral component interconnect express (PCIe) bus.
[0043] To implement remote direct memory access between the host and the remote host, it is required that both the device where the host is located and the device where the remote host is located have the remote direct memory access function, and this remote direct memory access function is specifically implemented by the first device on the two devices.
[0044] For S101, to implement remote direct memory access, the host creates a memory area hardware entry memory table and a memory translation area table to ensure that the host memory can be correctly accessed by the first device.
[0045] Specifically, Memory Registration (MR) is a prerequisite for allowing the first device to access the host memory. The process of memory registration includes the following steps:
[0046] Allocate memory address: The host application allocates a continuous memory area (Buffer) for storing data. This memory can be virtual memory allocated in the user state or physical memory allocated in the kernel state.
[0047] Registered Memory Region: The host uses the memory region registration function (ibv_reg_mr function) to register the allocated memory region for remote direct memory access and maps the virtual address and physical address of the memory region to the memory management unit (MMU). When registering, the access permissions of the memory region (such as IBV_ACCESS_LOCAL_WRITE, IBV_ACCESS_REMOTE_READ, etc.) need to be specified to ensure that the first device can correctly access the memory region. Among them, IBV_ACCESS_LOCAL_WRITE is a flag used to specify the access permission to the memory region when registering the memory region, indicating that local processes are allowed to write data to the memory region. IBV_ACCESS_REMOTE_READ means that local processes are allowed to read data from this memory region.
[0048] Generate the identifier of the memory region (the Key of the MR). Two representations (Key, key) are generated for each registered memory region: the local identifier (l_key) is used by the local host channel adapter (HCA) to access local memory; the remote identifier (r_key): is provided to the remote channel adapter to allow remote processes to access the local system memory.
[0049] The host creates the Memory Region Hardware Entry Memory (MRHEM). The Memory Region Hardware Entry Memory is a data structure used to store memory region metadata. The creation process of the Memory Region Hardware Entry Memory includes: allocation of the Memory Region Hardware Entry Memory. When registering the memory, the host allocates a piece of Host Entry Memory (HEM) for each memory region of the host memory (Memory Region, MR) to store the metadata of the memory region, such as the starting address, size, access permissions, etc. of the memory region; initialization of the Memory Region Hardware Entry Memory. The host writes the metadata of the memory region into the Memory Region Hardware Entry Memory, including information such as the virtual address, physical address, local identifier, and remote identifier of the memory region. Then, the data structure of the Memory Region Hardware Entry Memory is stored in the local storage of the first device in the form of a Memory Region Hardware Entry Memory table.
[0050] The host creates a Memory Translate Region. The Memory Translate Region is a hardware data structure used by the host to manage memory address translation. The process of creating the Memory Translate Region includes: when the host registers memory, it initializes the Memory Translate Region and writes the virtual address and physical address of the registered memory region into the Memory Translate Region. This process is usually completed by the Remote Direct Memory Access driver. When the memory region is released or re-registered, the host updates the Memory Translate Region to ensure the correctness of the address mapping relationship. Then, the data structure of the Memory Translate Region is stored in the local storage of the first device in the form of a Memory Translate Region table.
[0051] Since the first device needs to perform data transfer between the local storage and the host memory when executing the data transfer task of the host's Remote Direct Memory Access. For example, when the data transfer task is the task of the host sending data to a remote device, it is necessary to first transfer the data from the host memory to the local storage of the first device. And the information of the data transfer task provided by the application service thread only includes the virtual address of the source address and the virtual address of the destination address. In the embodiment of the present invention, the first device obtains the Memory Region Hardware Entry Memory Table and the Memory Translate Region Table and stores them in the local storage. Among them, since the first device needs to obtain the address of the Memory Translate Region Table from the Memory Region Hardware Entry Memory Table, in the embodiment of the present invention, after storing the Memory Region Hardware Entry Memory Table and the Memory Translate Region Table in the local storage of the first device, the address of the Memory Translate Region Table in the local storage of the first device is recorded in the Memory Region Hardware Entry Memory Table at the same time.
[0052] For S102, performing the data transfer task of the host's Remote Direct Memory Access may include: if the data transfer task is the task of the host sending data to a remote device, then call the first bus to access the target physical address of the host memory to transfer the first target data of the target memory to the local storage, and call the Remote Direct Memory Access module to send the first target data to the remote device; if the data transfer task is the task of the host receiving data from a remote device, then after receiving the second target data through the Remote Direct Memory Access module, call the first bus to access the target physical address of the host memory to transfer the second target data in the local storage to the target physical address.
[0053] Specifically, the first device uses the Direct Memory Access method to transfer the data of the data transfer task between the host memory and the local storage of the first device. When performing the data transfer between the host memory and the local storage of the first device, the first device first identifies the identifier of the target memory and the target virtual address according to the information of the data transfer task.
[0054] For S103, based on the identifier of the target memory and the target virtual address, the first device queries the corresponding memory region hardware entry memory table from the local storage. Besides querying information such as the starting address, access permission, and memory type of the target memory from it, the address of the memory translation region table corresponding to the target memory in the local storage of the first device is also queried from it.
[0055] For S104, the first device queries the corresponding physical address from the memory translation region table according to the target virtual address of the target memory, which is the target physical address of the target memory.
[0056] For S105, the first device can access the host memory according to the information such as the target physical address obtained from the local table query to perform data transfer between the host memory and the local storage of the first device.
[0057] In the data transmission method provided by the embodiments of the present invention, the memory region hardware entry memory table and the memory translation region table of the host memory are stored locally in the first device. When the first device executes the data transfer task of the remote direct memory access of the host, data transfer between the host memory and the local storage is required. The address in the host memory provided by the data transfer task is a virtual address, while the first bus needs a physical address to access the host memory. At this time, the first device does not need to query the physical address of the target memory in the host, but identifies the identifier of the target memory and the target virtual address of the target memory in the host memory involved in the data transfer task, and then queries the memory translation region table according to the target virtual address to obtain the target physical address of the target memory. Only at this time does it need to call the first bus to access the target physical address in the host memory to execute the data transfer between the host memory and the local storage of the first device in the data transfer task. Therefore, the communication bottleneck that appears in the current remote direct memory access process can be solved, and the technical effect of improving the communication efficiency of remote direct memory access is achieved.
[0058] Based on the above embodiments, in the data transmission method provided by the embodiments of the present invention, to further improve the efficiency of the data transfer task of remote direct memory access, the table entries corresponding to the hot access regions of the host memory can also be stored in the (high-speed) cache of the first device.
[0059] As Figure 2 shown, denote the memory region hardware entry memory table 0 and the memory translation region table 0 as the table entries corresponding to the hot access regions. That is to say, the complete memory region hardware entry memory table and the memory translation region table are stored in the local memory of the first device, and the memory region hardware entry memory table and the memory translation region table of the hot access regions of the host memory are stored in the local cache of the first device.
[0060] In S103, the first device queries the memory region hardware entry memory table according to the identifier of the target memory and the target virtual address to obtain the address of the memory translation region table corresponding to the target memory, which may include: querying the memory region hardware entry memory table from the local cache of the first device according to the identifier of the target memory and the target virtual address; if the local cache hits, reading the memory region hardware entry memory table in the local cache to obtain the address of the memory translation region table corresponding to the target memory; if the local cache misses, reading the memory region hardware entry memory table in the local memory of the first device to obtain the address of the memory translation region table corresponding to the target memory.
[0061] In S104, the first device queries the memory translation region table according to the target virtual address to obtain the target physical address of the target memory, which may include: querying the memory translation region table from the local cache of the first device according to the target virtual address; if the local cache hits, reading the memory translation region table in the local cache to obtain the target physical address; if the local cache misses, reading the memory translation region table in the local memory of the first device to obtain the target physical address.
[0062] Based on the above embodiments, the data transmission method provided by the embodiments of the present invention may further include: monitoring the hot access area of the host memory, and storing the memory region hardware entry memory table and the memory translation region table corresponding to the hot access area into the local cache of the first device.
[0063] That is to say, the first device can determine the hot access area of the host memory by monitoring the access conditions of each memory region of the host memory, and store the memory region hardware entry memory table and the memory translation region table corresponding to the hot access area into the local cache to improve the query efficiency.
[0064] In some optional embodiments of the embodiments of the present invention, monitoring the hot access area of the host memory, and storing the memory region hardware entry memory table and the memory translation region table corresponding to the hot access area into the local cache of the first device may include: monitoring the number of times of accessing the memory region hardware entry memory table and the number of times of accessing the memory translation region table; storing the first number of memory region hardware entry memory tables with the top access times into the local cache; storing the first number of memory translation region tables with the top access times into the local cache.
[0065] Specifically, the first device can add an access counter to each entry of the memory area hardware entry memory table and the memory translation area table. When accessing a certain entry each time, the corresponding counter value is incremented by 1. The access times of each entry are counted within a certain time period. For example, it is counted once every hour, and the entries with more access times can be regarded as frequently used entries. Hardware counters or software can be used to implement the counting of access times at the driver level. For memory areas where remote direct memory access operations are frequently performed, this method can intuitively reflect which entries are frequently used, and the entries are recorded as those in the hot access area.
[0066] In an embodiment of the present invention, listening to the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation area table may include: listening to the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation area table within a first preset time; after ending a listening period corresponding to the first preset time, clearing the access times recorded in the previous listening period.
[0067] That is to say, in addition to simply counting the access times, a time window can be set to only count the access conditions within this time window. For example, a 5-minute time window is set to only focus on the access times of each entry within these 5 minutes. This can avoid the interference of old access records on the judgment of current frequently used entries and more accurately reflect the usage situation of the current system.
[0068] In an embodiment of the present invention, entries related to key business operations can also be determined as entries in the hot access area according to the business logic of the host. For example, in a distributed database system, the memory area hardware entry memory table and the memory translation area table corresponding to the memory area for storing database data are usually frequently used entries. Because the read and write operations of the database are frequent, these memory areas need to be accessed frequently. For a real-time data processing system, the entries corresponding to the memory area for processing real-time data streams will also be frequently used entries and be used as entries in the hot access area. By analyzing the business process, it is determined which operations are core operations, and then the associated entries are found and used as entries in the hot access area.
[0069] In an embodiment of the present invention, the hot access area of the host memory can also be found by analyzing the usage pattern of data. If certain data is frequently accessed, then the entries corresponding to the memory area storing this data are frequently used entries. For example, in an e-commerce system, the inventory data of popular products is a data hot spot, and the memory area hardware entry memory table and the memory translation area table corresponding to the memory area storing this inventory data can be used as entries in the hot access area.
[0070] Based on the above embodiments, in the data transmission method provided by an embodiment of the present invention, obtaining the memory area hardware entry memory table and the memory translation area table of the host memory in S101 and storing them locally may include: after receiving the table entry writing notification, determining that the memory area hardware entry memory table and the memory translation area table written by the host to the local storage are received.
[0071] In a specific implementation, the host writing the memory area hardware entry memory table and the memory translation area table to the local storage of the first device may include: the host invoking the first bus to write the memory area hardware entry memory table and the memory translation area table to the local storage of the first device through direct memory access. That is to say, the host can use the direct memory access (DMA) method to write the memory area hardware entry memory table and the memory translation area table to the local storage of the first device.
[0072] After writing the memory area hardware entry memory table and the memory translation area table to the first device, the host may send a table entry writing notification to the first device, and the table entry writing notification carries the memory area hardware entry memory table and the memory translation area table.
[0073] Receiving the table entry writing notification may include: when monitoring that the host writes data to the base address register of the first bus, identifying the base address register to obtain the table entry writing notification. That is to say, after writing the memory area hardware entry memory table and the memory translation area table to the first device, the host can use the base address register of the first bus to send the table entry writing notification to the first device, which can send the table entry writing notification to the first device faster than the direct memory access method.
[0074] In an embodiment of the present invention, the host writing the memory area hardware entry memory table and the memory translation area table to the local storage of the first device may further include: after writing the memory area hardware entry memory table and the memory translation area table to the local memory of the first device, storing the memory area hardware entry memory table and the memory translation area table corresponding to the hot access area of the host memory in the local cache of the first device. That is to say, when the host writes the complete memory area hardware entry memory table and the memory translation area table to the local memory of the first device, the host can independently write the table entries corresponding to the hot access area to the local cache of the first device.
[0075] The steps for the host to monitor the hot access areas of the host memory may include: The host monitors the number of times each memory area of the host memory is accessed, and takes the first number of memory areas with the top access times as the hot access areas. Specifically, the host can add access counters to each memory area. When accessing a certain entry each time, the corresponding counter value is incremented by 1. Within a certain time period, the access times of each entry are counted. For example, it is counted once every hour, and the entries with more access times can be regarded as frequently used entries. Hardware counters or software can be used to implement the statistics of the access times at the driver layer. For the memory areas that frequently perform remote direct memory access operations, this method can intuitively reflect which memory areas are frequently accessed, and are recorded as hot access areas.
[0076] Among them, the host monitors the number of times each memory area of the host memory is accessed, which may include: The host monitors the number of times the memory area is accessed within the first preset time; after ending a monitoring period corresponding to the first preset time, the access times recorded in the previous monitoring period are cleared. That is to say, in addition to simple access times statistics, a time window can be set to only count the access situations within this time window. For example, a 5-minute time window is set to only focus on the number of times each memory area is accessed within these 5 minutes. This can avoid the interference of old access records on the judgment of current frequently used entries and more accurately reflect the usage situation of the current system.
[0077] In addition, the hot access areas can also be determined according to the business logic of the host or the usage pattern of the data, and the specific method can refer to the description of the above embodiments.
[0078] The data transmission method provided by the embodiments of the present invention may further include: updating the memory area hardware entry memory table and the memory translation area table stored locally according to the entry update information sent by the host.
[0079] When the status of the memory area in the host memory changes, the memory area hardware entry memory table and the memory translation area table in the host memory are updated. At this time, the host synchronizes the update situations of the memory area hardware entry memory table and the memory translation area table to the first device.
[0080] In the embodiments of the present invention, updating the memory area hardware entry memory table and the memory translation area table stored locally according to the entry update information sent by the host may include: when it is monitored that the host writes data to the base address register of the first bus, identifying the base address register to obtain the entry update information; updating the memory area hardware entry memory table and the memory translation area table stored locally according to the entry update information.
[0081] Figure 3 It is a flowchart of another data transmission method provided by the embodiments of the present invention.
[0082] As Figure 3 shown, based on the above embodiments, taking the example of a host sending data to a remote host, the data transmission method provided by the embodiments of the present invention may include:
[0083] S301: The host creates a memory area hardware entry memory table and a memory conversion area table in the host memory.
[0084] S302: The host writes the memory area hardware entry memory table into the local memory of the first device in the form of direct memory access and writes the storage address of the memory area hardware entry memory table in the first device into the first device through the base address register of the first bus.
[0085] S303: The host writes the memory conversion area table into the local memory of the first device in the form of direct memory access and writes the storage address of the memory conversion area table in the first device into the first device through the base address register of the first bus.
[0086] S304: The host writes the table entry corresponding to the hot access area into the local cache of the first device.
[0087] S305: When a data transmission task needs to be executed, the host sends the identifier of the target memory and the target virtual address involved in the data transmission task to the first device.
[0088] S306: The first device determines whether there is a memory area hardware entry memory table corresponding to the identifier of the target memory and the target virtual address in the local cache; if so, it proceeds to S307; if not, it proceeds to S308.
[0089] S307: Query the memory area hardware entry memory table according to the identifier of the target memory and the target virtual address to obtain the address of the memory conversion area table in the first device.
[0090] S308: The first device queries the memory area hardware entry memory table from the local memory according to the identifier of the target memory and the target virtual address, and then proceeds to S307.
[0091] S309: The first device determines whether there is a memory conversion area table of the target memory in the local cache; if so, it proceeds to S310; if not, it proceeds to S311.
[0092] S310: Query the memory conversion area table to obtain the target physical address of the target memory.
[0093] S311: Query the memory conversion area table in the local cache according to the address of the memory conversion area table, and then proceeds to S310.
[0094] S312: The first device calls the first bus to access the target physical address in the host memory to perform the data transfer between the host memory and the local storage of the first device during the data transfer task.
[0095] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method.
[0096] Figure 4 It is a schematic structural diagram of a data transfer device provided by an embodiment of the present invention.
[0097] As Figure 4 shown, an embodiment of the present invention further provides a data transfer device, which is applied to the first device and includes: an acquisition unit 401, configured to acquire the memory area hardware entry memory table and the memory translation area table of the host memory and store them locally; an identification unit 402, configured to identify the identifier of the target memory and the target virtual address of the target memory in the host memory involved in the data transfer task when performing the remote direct memory access data transfer task of the host; a first query unit 403, configured to query the memory area hardware entry memory table according to the identifier of the target memory and the target virtual address to obtain the address of the memory translation area table corresponding to the target memory; a second query unit 404, configured to query the memory translation area table according to the target virtual address to obtain the target physical address of the target memory; a data transfer unit 405, configured to call the first bus to access the target physical address in the host memory to perform the data transfer between the host memory and the local storage of the first device during the data transfer task.
[0098] In the embodiment of the present invention, the first query unit 403 queries the memory area hardware entry memory table according to the identifier of the target memory and the target virtual address to obtain the address of the memory translation area table corresponding to the target memory, which may include: querying the memory area hardware entry memory table from the local cache of the first device according to the identifier of the target memory and the target virtual address; if the local cache hits, reading the memory area hardware entry memory table in the local cache to obtain the address of the memory translation area table corresponding to the target memory; if the local cache does not hit, reading the memory area hardware entry memory table in the local memory of the first device to obtain the address of the memory translation area table corresponding to the target memory.
[0099] In an embodiment of the present invention, the second query unit 404 queries the memory translation region table according to the target virtual address to obtain the target physical address of the target memory, which may include: querying the memory translation region table from the local cache of the first device according to the target virtual address; if the local cache hits, reading the memory translation region table in the local cache to obtain the target physical address; if the local cache misses, reading the memory translation region table in the local memory of the first device to obtain the target physical address.
[0100] The data transmission device provided by the embodiment of the present invention may further include: a monitoring unit, configured to monitor the hot access area of the host memory, and store the memory area hardware entry memory table and the memory translation region table corresponding to the hot access area into the local cache of the first device.
[0101] In an embodiment of the present invention, the monitoring unit monitors the hot access area of the host memory, and stores the memory area hardware entry memory table and the memory translation region table corresponding to the hot access area into the local cache, which may include: monitoring the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation region table; storing the first quantity of memory area hardware entry memory tables with the top access times into the local cache; storing the first quantity of memory translation region tables with the top access times into the local cache.
[0102] In an embodiment of the present invention, the monitoring unit monitors the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation region table, which may include: monitoring the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation region table within a first preset time; after ending a monitoring period corresponding to the first preset time, clearing the access times recorded in the previous monitoring period.
[0103] In an embodiment of the present invention, the obtaining unit 401 obtains the memory area hardware entry memory table and the memory translation region table of the host memory and stores them locally, which may include: after receiving the table entry writing notification, determining that the memory area hardware entry memory table and the memory translation region table written by the host to the local storage are received.
[0104] In an embodiment of the present invention, the host writes the memory area hardware entry memory table and the memory translation region table to the local storage of the first device, which may include: the host calls the first bus to write the memory area hardware entry memory table and the memory translation region table to the local storage of the first device through direct memory access.
[0105] In an embodiment of the present invention, the obtaining unit 401 receives the table entry writing notification, which may include: when monitoring that the host writes data to the base address register of the first bus, identifying the base address register to obtain the table entry writing notification.
[0106] In an embodiment of the present invention, the host writes the memory region hardware entry memory table and the memory translation region table into the local storage of the first device, which may include: after the host writes the memory region hardware entry memory table and the memory translation region table into the local memory of the first device, the memory region hardware entry memory table and the memory translation region table corresponding to the hot access region of the host memory are stored in the local cache of the first device.
[0107] In an embodiment of the present invention, the obtaining unit 401 may further be configured to, when it monitors that the host writes data into the base address register of the first bus, identify the base address register to obtain table entry update information; and update the memory region hardware entry memory table and the memory translation region table in the local storage according to the table entry update information.
[0108] In an embodiment of the present invention, performing a data transfer task of remote direct memory access of the host may include: if the data transfer task is a task for the host to send data to a remote device, then call the first bus to access the target physical address of the host memory to move the first target data of the target memory to the local storage, and call the remote direct memory access module to send the first target data to the remote device; if the data transfer task is a task for the host to receive data from a remote device, then after receiving the second target data through the remote direct memory access module, call the first bus to access the target physical address of the host memory to move the second target data in the local storage to the target physical address.
[0109] For the description of the features in the corresponding embodiment of the data transfer device, reference may be made to the relevant description in the corresponding embodiment of the data transfer method, which will not be elaborated here one by one.
[0110] An embodiment of the present invention further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above embodiments of the data transfer method.
[0111] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any one of the above embodiments of the data transfer method when running.
[0112] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media such as a USB flash drive, a read-only memory (ROM for short), a random access memory (RAM for short), a mobile hard disk, a magnetic disk, or an optical disc that can store a computer program.
[0113] An embodiment of the present invention also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above data transmission method embodiments are implemented.
[0114] An embodiment of the present invention also provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above data transmission method embodiments are implemented.
[0115] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present invention.
[0116] The above has introduced in detail a data transmission method, device, medium, and computer program product provided by the present invention. Specific examples are used herein to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention. It should be noted that for those of ordinary skill in the art in the technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the present invention.
Claims
1. A data transmission method, characterized in that, Applied to a first device, including: Obtain the memory area hardware entry memory table and the memory translation area table of the host memory and store them locally; wherein, the complete memory area hardware entry memory table and the memory translation area table are stored in the local memory of the first device; the memory area hardware entry memory table and the memory translation area table of the hot access area of the host memory are stored in the local cache of the first device; When performing the data transfer task of the remote direct memory access of the host, identify the identifier of the target memory in the host memory involved in the data transfer task and the target virtual address of the target memory; Query the memory area hardware entry memory table from the local cache according to the identifier of the target memory and the target virtual address; if the local cache hits, read the memory area hardware entry memory table in the local cache to obtain the address of the memory translation area table corresponding to the target memory; if the local cache misses, read the memory area hardware entry memory table in the local memory to obtain the address of the memory translation area table corresponding to the target memory; Query the memory translation area table from the local cache according to the target virtual address; if the local cache hits, read the memory translation area table in the local cache to obtain the target physical address; if the local cache misses, read the memory translation area table in the local memory to obtain the target physical address of the target memory; Call the first bus to access the target physical address in the host memory to perform the data transfer between the host memory and the local storage of the first device in the data transfer task.
2. The data transmission method according to claim 1, wherein It also includes: Monitor the hot access area of the host memory and store the memory area hardware entry memory table and the memory translation area table corresponding to the hot access area in the local cache of the first device.
3. The data transmission method according to claim 2, wherein Monitoring the hot access area of the host memory and storing the memory area hardware entry memory table and the memory translation area table corresponding to the hot access area in the local cache of the first device includes: Monitor the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation area table; Store the first number of the memory area hardware entry memory tables with the top access times in the local cache; Store the first number of the memory translation area tables with the top access times in the local cache.
4. The data transmission method according to claim 3, wherein Monitoring the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation area table includes: Monitor the number of times of accessing the memory area hardware entry memory table and the number of times of accessing the memory translation area table within a first preset time; After ending a monitoring period corresponding to the first preset time, clear the access times recorded in the previous monitoring period.
5. The data transmission method according to claim 1, wherein Obtaining the memory area hardware entry memory table and the memory translation area table of the host memory and storing them locally includes: After receiving the table entry write notification, determine that the memory area hardware entry memory table and the memory translation area table written by the host to the local storage are received.
6. The data transmission method according to claim 5, wherein The host writes the memory region hardware entry memory table and the memory translation region table to the local storage of the first device, including: The host calls the first bus to write the memory region hardware entry memory table and the memory translation region table to the local storage of the first device through direct memory access.
7. The data transmission method according to claim 5, characterized in that Receiving the table entry write notification, including: When it is monitored that the host writes data to the base address register of the first bus, the base address register is identified to obtain the table entry write notification.
8. The data transmission method according to claim 5, characterized in that The host writes the memory region hardware entry memory table and the memory translation region table to the local storage of the first device, including: After the host writes the memory region hardware entry memory table and the memory translation region table to the local memory of the first device, the memory region hardware entry memory table and the memory translation region table corresponding to the hot access region of the host memory are stored in the local cache of the first device.
9. The data transmission method according to claim 1, wherein It further includes: When it is monitored that the host writes data to the base address register of the first bus, the base address register is identified to obtain table entry update information; According to the table entry update information, the memory region hardware entry memory table and the memory translation region table in the local storage are updated.
10. The data transmission method according to claim 1, characterized in that Performing the data transfer task of the host's remote direct memory access, including: If the data transfer task is a task for the host to send data to a remote device, the first bus is called to access the target physical address of the host memory to move the first target data of the target memory to the local storage, and the remote direct memory access module is called to send the first target data to the remote device; If the data transfer task is a task for the host to receive data from the remote device, after the second target data is received through the remote direct memory access module, the first bus is called to access the target physical address of the host memory to move the second target data in the local storage to the target physical address.
11. An electronic device, characterized in that, It includes: A memory for storing a computer program; A processor for implementing the steps of the data transfer method according to any one of claims 1 to 10 when executing the computer program.
12. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program, when executed by a processor, implements the steps of the data transfer method according to any one of claims 1 to 10.
13. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the steps of the data transfer method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Data processing method and device, medium and computing equipment
CN115793982A
Memory management method and device, heterogeneous system, storage medium and program product
CN118820126A