Data transmission method and 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, identifying and querying the physical address of the target memory, the problem of low remote direct memory access communication is solved, and efficient data transmission is achieved.
Patent Information
- Application Number
- CN202510380285.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2045-03-28
AI Technical Summary
There are bottlenecks in the efficiency of remote direct memory access communication, which affects the computing speed and data transmission speed in the field of high-performance computing.
By storing the memory area hardware entry memory table and the memory conversion area table locally in the first device, the target memory identifier and virtual address in the data transmission task are identified, the memory conversion area table is queried to obtain the physical address, and data transmission is carried out through the first bus.
It solves the communication bottleneck in the remote direct memory access process, improves communication efficiency, and realizes efficient data transfer between host memory and local storage of the first device.
Smart Images

Figure CN119883975A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data transmission method, device, medium and computer program product. Background Art
[0002] Remote Direct Memory Access (RDMA) technology allows computers to directly access the memory of a remote host without the intervention of the operating system kernel, achieving high-speed data transmission. It has been widely used 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 needs to be improved urgently.
[0003] How to improve the efficiency of remote direct memory access communication is a technical problem that those skilled in the art need to solve. Summary of the invention
[0004] The present invention provides a data transmission method, device, medium and computer program product to at least solve the bottleneck problem of communication efficiency of remote direct memory access in the related art.
[0005] The present invention provides a data transmission method, applied to a first device, comprising: Obtain the memory area hardware entry memory table and memory translation area table of the host memory and store them locally; When executing a data transmission task of remote direct memory access of a host, identifying an identifier of a target memory in the host memory involved in the data transmission task and a target virtual address of the target memory; 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; According to the target virtual address, the memory translation area table is searched to obtain the target physical address of the target memory; The first bus is called to access the target physical address in the host memory to perform data movement between the host memory and the local storage of the first device in the data transmission task.
[0006] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of the above data transmission method when executing the computer program.
[0007] The present invention also provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program implements the steps of the above-mentioned data transmission method when executed by a processor.
[0008] The present invention also provides a computer program product, including a computer program, which implements the steps of the above data transmission method when executed by a processor.
[0009] 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 the remote direct memory access of the host, it is necessary to move data between the host memory and the local storage. The address in the host memory provided by the data transmission task is a virtual address, and the first bus needs a physical address to access the host memory. At this time, the first device does not need to look up a table in the host to determine the physical address of the target memory, but identifies the target memory identifier and the target virtual address of the target memory in the host memory involved in the data transmission task, and then queries 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 execute the data transfer task. The data movement between the host memory and the local storage of the first device can be solved. 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 can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0011] Figure 1 A flowchart of a data transmission method provided by an embodiment of the present invention; Figure 2 A schematic diagram of a hardware architecture involved in a data transmission task provided by an embodiment of the present invention; Figure 3 A flowchart of another data transmission method provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of a data transmission device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0012] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0013] It should be noted that, in the description of the present invention, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes 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.
[0014] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0015] Here, some key terms used in the embodiments of the present invention are explained.
[0016] Virtual memory technology: Modern operating systems generally use virtual memory technology, which is a technology that separates the logical address space of a program from the physical memory space. The operating system allocates 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 high-speed serial computer expansion bus (Peripheral Component Interconnect Express, referred to as PCIe) device wants to access the host memory, it often receives the virtual address provided by the application. However, physical memory is organized and managed based on physical addresses. When PCIe devices actually move data, they must convert virtual addresses into corresponding physical addresses in order to accurately locate the data storage location in the memory.
[0017] Memory mapping and page management: The operating system uses the page table to implement the mapping of virtual addresses to physical addresses. The page table records the correspondence between each virtual page and the physical page. When performing remote direct memory access (RDMA) operations, the PCIe device cannot directly understand the virtual address and needs to use the mechanism provided by the operating system (such as the driver) to query the page table to obtain the physical address corresponding to the virtual address.
[0018] Physical address addressing: The hardware design of PCIe devices is usually based on physical addresses for memory access. The device's memory controller and data transfer circuit are designed to directly process physical addresses, and they are not capable of directly processing virtual addresses. Therefore, before data is moved, the virtual address must be converted to a physical address so that the PCIe device can correctly access the data in the host memory.
[0019] Memory Region Hardware Entry Memory (MR HEM) is a special memory region used to store hardware entry information related to the memory region, which is essential for achieving efficient memory access and address translation.
[0020] Memory Translation 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. In remote direct memory access communication, when an application requests access to remote memory, the virtual address needs to be accurately converted to a physical address so that the remote direct memory access device can directly access the target memory area.
[0021] When a remote direct memory access data transmission task needs to be performed, the remote direct memory access device not only needs to convert the virtual address into the physical address through the memory translation area table, but also needs to use the memory area hardware entry memory table to obtain the hardware entry information related to the target memory area. This information includes the starting address of the memory area, access rights, memory type, etc. With this information, the remote direct memory access device can accurately locate the target memory area and access it safely and efficiently.
[0022] In the related technology, every time the host performs a remote direct memory access operation (remote direct memory access read, remote direct memory access write), the remote direct memory access device needs to search the required physical address from the host memory according to the virtual address and key sent by the host. First, it queries the memory area hardware entry memory table, and based on the query result, it accesses the memory conversion area table of the host memory again to find the corresponding physical address data and moves it from the host memory to the sending buffer area of the remote direct memory access device for data transmission. In this way, the remote direct memory access device needs to access the host memory multiple times, which greatly affects the efficiency of remote direct memory access.
[0023] To this end, the data transmission scheme provided by the embodiment of the present invention stores the memory area hardware entry memory table and the memory conversion area table of the host memory locally in the first device. When the first device executes the data transmission task of the remote direct memory access of the host, it is necessary to move data between the host memory and the local storage. The address in the host memory provided by the data transmission task is a virtual address, and the first bus needs a physical address to access the host memory. At this time, the first device does not need to look up a table in the host to determine the physical address of the target memory, but identifies the target memory identifier and the target virtual address of the target memory in the host memory involved in the data transmission task, and then queries 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 execute the data transfer task. The data transfer between the host memory and the local storage of the first device can be solved. Therefore, the communication bottleneck that occurs 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 can be achieved.
[0024] An embodiment of the present invention provides a data transmission method. Combined with the execution flow of the data transmission method, the method is described in detail below.
[0025] Figure 1 A flowchart of a data transmission method provided by an embodiment of the present invention; Figure 2 A schematic diagram of a hardware architecture involved in a data transmission task provided by an embodiment of the present invention.
[0026] like Figure 1 As shown, applied to a first device, the data transmission method provided by an embodiment of the present invention includes:
[0027] S101: Obtain a memory area hardware entry memory table and a memory conversion area table of a host memory and store them locally.
[0028] S102: When executing a data transmission task of a remote direct memory access of a host, identifying an identifier of a target memory in a host memory involved in the data transmission task and a target virtual address of the target memory.
[0029] 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.
[0030] S104: querying the memory translation area table according to the target virtual address to obtain the target physical address of the target memory.
[0031] S105: Invoke the first bus to access the target physical address in the host memory to perform data movement between the host memory and the local storage of the first device in the data transmission task.
[0032] In the embodiment 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 via a first bus.
[0033] The first device is a device having a remote direct memory access function connected to the host through a first bus. In some optional implementations, 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 processor distributed processing unit (DPU). In other optional implementations, the first device may also be a remote direct memory access network card.
[0034] The first bus may be a Peripheral Component Interconnect (PCI) bus or a peripheral component interconnect express (PCIe) bus.
[0035] In order 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 a remote direct memory access function, and the remote direct memory access function is specifically implemented by the first device on the two devices.
[0036] 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.
[0037] Specifically, memory registration (MR) is a prerequisite for allowing the first device to access the host memory. The memory registration process includes the following steps:
[0038] Allocate memory address: The host application allocates a continuous memory area (Buffer) for storing data. This memory can be virtual memory allocated in user mode or physical memory allocated in kernel mode.
[0039] Register memory area: The host uses the memory area registration function (ibv_reg_mr function) to register the allocated memory area for remote direct memory access, and maps the virtual address and physical address of the memory area to the memory management unit (MMU). When registering, you need to specify the access rights of the memory area (such as IBV_ACCESS_LOCAL_WRITE, IBV_ACCESS_REMOTE_READ, etc.) to ensure that the first device can correctly access the memory area. Among them, IBV_ACCESS_LOCAL_WRITE is a flag used to specify the access rights to the memory area when registering the memory area, indicating that the local process is allowed to write data to the memory area. IBV_ACCESS_REMOTE_READ means that the local process is allowed to read data in the memory area.
[0040] Generates the memory region identifier (MR's Key). Each registered memory region generates two representations (Key, key): 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 local system memory.
[0041] The host creates a 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 host hardware entry memory (HEM) to each memory region (MR) of the host memory to store the metadata of the memory region, such as the starting address, size, access rights, 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 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.
[0042] The host creates a memory translation region (Memory Translate Region). The memory translation region is a hardware data structure used by the host to manage memory address translation. The creation process of the memory translation region includes: when the host registers the memory, it initializes the memory translation region and writes the virtual address and physical address of the registered memory region into the memory translation region. This process is usually completed by the remote direct memory access driver. When the memory region is released or re-registered, the host will update the memory translation region to ensure the correctness of the address mapping relationship. Then, the data structure of the memory translation region is stored in the local storage of the first device in the form of a memory translation region table.
[0043] Since the first device needs to perform data movement between local storage and host memory when executing the data transmission task of remote direct memory access of the host, for example, when the data transmission task is a task for the host to send data to the remote device, the data needs to be moved from the host memory to the local storage of the first device first, and the information of the data transmission task provided by the application service thread to the first device only includes the virtual address of the source address and the virtual address of the destination address, in an embodiment of the present invention, the first device obtains the memory area hardware entry memory table and the memory conversion area table and stores them in the local storage. Among them, since the first device needs to obtain the address of the memory conversion area table from the memory area hardware entry memory table, in an embodiment of the present invention, after the memory area hardware entry memory table and the memory conversion area table are stored in the local storage of the first device, the address of the memory conversion area table in the local storage of the first device is recorded in the memory area hardware entry memory table at the same time.
[0044] For S102, executing the data transmission task of the remote direct memory access of the host may include: if the data transmission task is a task for the host to send data to the remote device, calling 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 calling the remote direct memory access module to send the first target data to the remote device; if the data transmission task is a task for the host to receive data from the remote device, then after receiving the second target data through the remote direct memory access module, calling 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.
[0045] Specifically, the first device uses direct memory access to move data of the data transmission task between the host memory and the local storage of the first device. When performing data movement between the host memory and the local storage of the first device, the first device first identifies the identifier and the target virtual address of the target memory according to the information of the data transmission task.
[0046] For S103, based on the identifier of the target memory and the target virtual address, the first device queries the corresponding memory area hardware entry memory table from the local storage. In addition to querying the starting address, access rights, memory type and other information of the target memory, the first device also queries the address of the memory conversion area table corresponding to the target memory in the local storage of the first device.
[0047] For S104, the first device queries the memory translation area table according to the target virtual address of the target memory to obtain a corresponding physical address as the target physical address of the target memory.
[0048] For S105, the first device can access the host memory according to the target physical address and other information obtained from the local table lookup to move data between the host memory and the local storage of the first device.
[0049] The data transmission method provided by the embodiment of the present invention stores the memory area hardware entry memory table and the memory conversion area table of the host memory locally in the first device. When the first device executes the data transmission task of the remote direct memory access of the host, it is necessary to move data between the host memory and the local storage. The address in the host memory provided by the data transmission task is a virtual address, and the first bus needs a physical address to access the host memory. At this time, the first device does not need to look up a table in the host to determine the physical address of the target memory, but identifies the target memory identifier and the target virtual address of the target memory in the host memory involved in the data transmission task, and then queries 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 execute the data transfer task. The data transfer between the host memory and the local storage of the first device can be performed. Therefore, the communication bottleneck that occurs 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 can be achieved.
[0050] Based on the above embodiments, in the data transmission method provided in the embodiments of the present invention, in order to further improve the efficiency of the data transmission task of remote direct memory access, the table entries corresponding to the hotspot access area of the host memory can also be stored in the (high-speed) cache of the first device.
[0051] like Figure 2 As shown, the memory area hardware entry memory table 0 and the memory conversion area table 0 are recorded as the table entries corresponding to the hotspot access area. That is, the complete memory area hardware entry memory table and the memory conversion area table are stored in the local memory of the first device, and the memory area hardware entry memory table and the memory conversion area table of the hotspot access area of the host memory are stored in the local cache of the first device.
[0052] In S103, the first device 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 conversion 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 conversion 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 conversion area table corresponding to the target memory.
[0053] In S104, the first device queries the memory translation area table according to the target virtual address to obtain the target physical address of the target memory, which may include: querying the memory translation area table from the local cache of the first device according to the target virtual address; if the local cache hits, reading the memory translation area table in the local cache to obtain the target physical address; if the local cache does not hit, reading the memory translation area table in the local memory of the first device to obtain the target physical address.
[0054] Based on the above embodiments, the data transmission method provided by the embodiments of the present invention may also include: monitoring the hotspot access area of the host memory, and storing the memory area hardware entry memory table and memory conversion area table corresponding to the hotspot access area into the local cache of the first device.
[0055] That is, the first device can determine the hotspot access area of the host memory by monitoring the access to each memory area of the host memory, and store the memory area hardware entry memory table and memory conversion area table corresponding to the hotspot access area into the local cache to improve query efficiency.
[0056] In some optional implementations of the embodiments of the present invention, monitoring the hot access area of the host memory, and storing the memory area hardware entry memory table and the memory conversion area table corresponding to the hot access area into the local cache of the first device may include: monitoring the number of times the memory area hardware entry memory table is accessed and the number of times the memory conversion area table is accessed; storing a first number of memory area hardware entry memory tables with a top number of access times into the local cache; storing a first number of memory conversion area tables with a top number of access times into the local cache.
[0057] Specifically, the first device can add an access counter to each table entry of the memory area hardware entry memory table and the memory conversion area table. Each time a table entry is accessed, the corresponding counter value is increased by 1. Within a certain time period, the number of accesses to each table entry is counted. For example, the table entries with a large number of accesses are counted every hour and can be regarded as frequently used table entries. The number of accesses can be counted at the driver layer using hardware counters or software. For memory areas where remote direct memory access operations are frequently performed, this method can intuitively reflect which table entries are frequently used and recorded as table entries in hot access areas.
[0058] In an embodiment of the present invention, monitoring the number of times the memory area hardware entry memory table is accessed and the number of times the memory conversion area table is accessed may include: monitoring the number of times the memory area hardware entry memory table is accessed and the number of times the memory conversion area table is accessed within a first preset time; after ending a monitoring cycle corresponding to the first preset time, clearing the number of accesses recorded in the previous monitoring cycle.
[0059] That is to say, in addition to simple access count statistics, you can also set a time window to only count the accesses within the time window. For example, set a 5-minute time window to only focus on the access counts of each table item within these 5 minutes. This can avoid the interference of old access records on the judgment of current commonly used table items and more accurately reflect the current system usage.
[0060] In an embodiment of the present invention, it is also possible to determine, based on the business logic of the host, table entries related to key business operations as table entries of the hotspot access area. For example, in a distributed database system, the memory area hardware entry memory table and the memory conversion area table corresponding to the memory area for storing database data are usually commonly used table entries. Because the database has frequent read and write operations, these memory areas need to be accessed frequently. For a real-time data processing system, the table entries corresponding to the memory area that processes the real-time data stream will also be commonly used table entries, as table entries of the hotspot access area. By analyzing the business process, it is determined which operations are core operations, and then the table entries associated with them are found as table entries of the hotspot access area.
[0061] In an embodiment of the present invention, the hotspot access area of the host memory can also be found by analyzing the usage pattern of the data. If certain data is frequently accessed, then the table entries corresponding to the memory area storing these data are frequently used table entries. For example, in an e-commerce system, the inventory data of popular commodities is a data hotspot, and the memory area hardware entry memory table and memory conversion area table corresponding to the memory area storing these inventory data can be used as the table entries of the hotspot access area.
[0062] On the basis of the above embodiments, in the data transmission method provided in the embodiments of the present invention, S101 obtains the memory area hardware entry memory table and the memory conversion area table of the host memory and stores them locally, which may include: after receiving the table entry write notification, determining that the memory area hardware entry memory table and the memory conversion area table written by the host to the local storage are received.
[0063] In a specific implementation, the host writes the memory area hardware entry memory table and the memory translation area table into 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 area table into the local storage of the first device through direct memory access. That is, the host may write the memory area hardware entry memory table and the memory translation area table into the local storage of the first device by direct memory access (DMA).
[0064] After writing the memory area hardware entry memory table and the memory conversion area table into the first device, the host may send a table entry write notification to the first device, where the table entry write notification carries the memory area hardware entry memory table and the memory conversion area table.
[0065] Receiving a table entry write 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 write notification. That is, after the host writes the memory area hardware entry memory table and the memory translation area table to the first device, the host may use the base address register of the first bus to send the table entry write notification to the first device, and the table entry write notification may be sent to the first device faster than the direct memory access method.
[0066] In an embodiment of the present invention, the host writes the memory area hardware entry memory table and the memory conversion area table into the local storage of the first device, and can also include: after the host writes the memory area hardware entry memory table and the memory conversion area table into the local memory of the first device, the memory area hardware entry memory table and the memory conversion area table corresponding to the hotspot access area of the host memory are stored 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 conversion area table into the local memory of the first device, the host can write the table items corresponding to the hotspot access area into the local cache of the first device.
[0067] The step of the host monitoring the hot access area 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 highest number of accesses as the hot access area. Specifically, the host can add an access counter for each memory area. Each time a table item is accessed, the corresponding counter value is increased by 1. Within a certain time period, the number of accesses to each table item is counted. For example, the table items with a large number of accesses are counted every hour and can be regarded as frequently used table items. The number of accesses can be counted at the driver layer using hardware counters or software. For memory areas that frequently perform remote direct memory access operations, this method can intuitively reflect which memory areas are frequently accessed and recorded as hot access areas.
[0068] 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 a monitoring cycle corresponding to the first preset time ends, the number of accesses recorded in the previous monitoring cycle is cleared. That is to say, in addition to simple access count statistics, a time window can also be set to only count the accesses within the time window. For example, a 5-minute time window is set, and only the number of times each memory area is accessed within these 5 minutes is focused on. This can avoid the interference of old access records on the judgment of current commonly used table items and more accurately reflect the current system usage.
[0069] In addition, the hotspot access area may also be determined according to the service logic of the host or the usage pattern of the data. For specific methods, reference may be made to the description of the above embodiments.
[0070] The data transmission method provided by the embodiment of the present invention may further include: updating the locally stored memory area hardware entry memory table and memory conversion area table according to the table entry update information sent by the host.
[0071] When the state of the memory area in the host memory changes, the memory area hardware entry memory table and the memory conversion area table in the host memory are updated. At this time, the host synchronizes the update status of the memory area hardware entry memory table and the memory conversion area table to the first device.
[0072] In an embodiment of the present invention, updating the locally stored memory area hardware entry memory table and memory conversion area table according to the table entry update information sent by the host may include: when monitoring the host writing data to the base address register of the first bus, identifying the base address register to obtain the table entry update information; updating the memory area hardware entry memory table and memory conversion area table in the local storage according to the table entry update information.
[0073] Figure 3 A flowchart of another data transmission method provided by an embodiment of the present invention.
[0074] like Figure 3 As shown, based on the above embodiment, taking the host sending data to the remote host as an example, the data transmission method provided by the embodiment of the present invention may include:
[0075] S301: The host creates a memory area hardware entry memory table and a memory translation area table in the host memory.
[0076] S302: The host writes the memory area hardware entry memory table into the local memory of the first device through direct memory access and writes the memory area hardware entry memory table into the first device at the storage address of the first device through the base address register of the first bus.
[0077] S303: The host writes the memory translation area table into the local memory of the first device through direct memory access and writes the memory translation area table into the first device at the storage address of the first device through the base address register of the first bus.
[0078] S304: The host writes the entry corresponding to the hotspot access area into the local cache of the first device.
[0079] S305: When a data transmission task needs to be executed, the host sends an identifier of a target memory and a target virtual address involved in the data transmission task to the first device.
[0080] 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 yes, proceed to S307; if not, proceed to S308.
[0081] S307: query the memory area hardware entry memory table according to the target memory identifier and the target virtual address to obtain the address of the memory translation area table in the first device.
[0082] 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 enters S307.
[0083] S309: The first device determines whether there is a memory conversion area table of the target memory in the local cache; if yes, proceed to S310; if not, proceed to S311.
[0084] S310: query the memory translation area table to obtain the target physical address of the target memory.
[0085] S311: query the memory translation area table in the local cache according to the address of the memory translation area table, and then enter S310.
[0086] S312: The first device calls the first bus to access the target physical address in the host memory to perform data movement between the host memory and the local storage of the first device in the data transmission task.
[0087] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0088] Figure 4 A schematic diagram of the structure of a data transmission device provided by an embodiment of the present invention.
[0089] like Figure 4 As shown, an embodiment of the present invention also provides a data transmission device, which is applied to a first device, including: an acquisition unit 401, which is used to acquire a memory area hardware entry memory table and a memory conversion area table of a host memory and store them locally; an identification unit 402, which is used to identify the identifier of a target memory in the host memory and the target virtual address of the target memory involved in the data transmission task when executing a data transmission task of remote direct memory access of the host; a first query unit 403, which is used to query the memory area hardware entry memory table according to the identifier and the target virtual address of the target memory to obtain the address of the memory conversion area table corresponding to the target memory; a second query unit 404, which is used to query the memory conversion area table according to the target virtual address to obtain the target physical address of the target memory; a data transmission unit 405, which is used to call the first bus to access the target physical address in the host memory to perform data movement between the host memory and the local storage of the first device in the data transmission task.
[0090] In an 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 conversion 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 conversion area table corresponding to the target memory; if the local cache misses, reading the memory area hardware entry memory table in the local memory of the first device to obtain the address of the memory conversion area table corresponding to the target memory.
[0091] In an embodiment of the present invention, the second query unit 404 queries the memory translation area table according to the target virtual address to obtain the target physical address of the target memory, which may include: querying the memory translation area table from the local cache of the first device according to the target virtual address; if the local cache hits, reading the memory translation area table in the local cache to obtain the target physical address; if the local cache misses, reading the memory translation area table in the local memory of the first device to obtain the target physical address.
[0092] The data transmission device provided by an embodiment of the present invention may also include: a monitoring unit, which is used to monitor the hotspot access area of the host memory, and store the memory area hardware entry memory table and memory conversion area table corresponding to the hotspot access area into the local cache of the first device.
[0093] In an embodiment of the present invention, a monitoring unit monitors the hotspot access area of the host memory, and stores the memory area hardware entry memory table and the memory conversion area table corresponding to the hotspot access area into the local cache of the first device, which may include: monitoring the number of times the memory area hardware entry memory table is accessed and the number of times the memory conversion area table is accessed; storing a first number of memory area hardware entry memory tables with a top number of accesses into the local cache; storing a first number of memory conversion area tables with a top number of accesses into the local cache.
[0094] In an embodiment of the present invention, the monitoring unit monitors the number of times the memory area hardware entry memory table is accessed and the number of times the memory conversion area table is accessed, which may include: monitoring the number of times the memory area hardware entry memory table is accessed and the number of times the memory conversion area table is accessed within a first preset time; after ending a monitoring cycle corresponding to the first preset time, clearing the number of accesses recorded in the previous monitoring cycle.
[0095] In an embodiment of the present invention, the acquisition unit 401 acquires the memory area hardware entry memory table and the memory conversion area table of the host memory and stores them locally, which may include: after receiving the table entry write notification, determining that the memory area hardware entry memory table and the memory conversion area table written by the host to the local storage are received.
[0096] In an embodiment of the present invention, the host writes the memory area hardware entry memory table and the memory translation area 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 area table to the local storage of the first device through direct memory access.
[0097] In the embodiment of the present invention, the acquisition unit 401 receives the entry write 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 entry write notification.
[0098] In an embodiment of the present invention, the host writes the memory area hardware entry memory table and the memory conversion area table into the local storage of the first device, which may include: after the host writes the memory area hardware entry memory table and the memory conversion area table into the local memory of the first device, the memory area hardware entry memory table and the memory conversion area table corresponding to the hotspot access area of the host memory are stored in the local cache of the first device.
[0099] In an embodiment of the present invention, the acquisition unit 401 can also be used to identify the base address register to obtain table update information when monitoring the host writing data to the base address register of the first bus; and update the memory area hardware entry memory table and memory conversion area table in the local storage according to the table update information.
[0100] In an embodiment of the present invention, executing a data transmission task of remote direct memory access of a host may include: if the data transmission task is a task of sending data from the host to a remote device, calling 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 calling the remote direct memory access module to send the first target data to the remote device; if the data transmission task is a task of the host receiving data from the remote device, after receiving the second target data through the remote direct memory access module, calling 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.
[0101] For the description of the features in the embodiment corresponding to the data transmission device, reference can be made to the relevant description of the embodiment corresponding to the data transmission method, which will not be repeated here.
[0102] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein 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 data transmission method embodiments.
[0103] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above-mentioned data transmission method embodiments when running.
[0104] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0105] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above data transmission method embodiments are implemented.
[0106] An embodiment of the present invention further provides another computer program product, including a non-volatile computer-readable storage medium, wherein 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-mentioned data transmission method embodiments are implemented.
[0107] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0108] The above is a detailed introduction to a data transmission method, device, medium and computer program product provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A data transmission method, characterized in that: Applied to a first device, comprising: Obtain the memory area hardware entry memory table and memory translation area table of the host memory and store them locally; When executing a data transmission task of remote direct memory access of a host, identifying an identifier of a target memory in the host memory involved in the data transmission task and a target virtual address of the target memory; 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; According to the target virtual address, the memory translation area table is searched to obtain the target physical address of the target memory; The first bus is called to access the target physical address in the host memory to perform data movement between the host memory and the local storage of the first device in the data transmission task.
2. The data transmission method according to claim 1, characterized in that: According to the identifier of the target memory and the target virtual address, querying the memory area hardware entry memory table to obtain the address of the memory translation area table corresponding to the target memory includes: 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, then reading the memory area hardware entry memory table in the local cache to obtain the address of the memory conversion area table corresponding to the target memory; If the local cache misses, the memory area hardware entry memory table in the local memory of the first device is read to obtain the address of the memory conversion area table corresponding to the target memory.
3. The data transmission method according to claim 1, characterized in that: Querying the memory translation area table according to the target virtual address to obtain the target physical address of the target memory includes: querying the memory translation region table from a local cache of the first device according to the target virtual address; If the local cache hits, reading the memory translation area table in the local cache to obtain the target physical address; If the local cache misses, the memory translation area table in the local memory of the first device is read to obtain the target physical address.
4. The data transmission method according to claim 1, characterized in that: Also includes: The hotspot access area of the host memory is monitored, and the memory area hardware entry memory table and the memory conversion area table corresponding to the hotspot access area are stored in the local cache of the first device.
5. The data transmission method according to claim 4, characterized in that: Monitoring the hotspot access area of the host memory, and storing the memory area hardware entry memory table and the memory conversion area table corresponding to the hotspot access area into the local cache of the first device, including: Monitoring the number of accesses to the memory area hardware entry memory table and the number of accesses to the memory translation area table; Store the hardware entry memory tables of the memory areas with the first number of access times into the local cache; A first number of memory conversion area tables with the highest number of access times are stored in the local cache.
6. The data transmission method according to claim 5, characterized in that: Monitoring the number of accesses to the memory area hardware entry memory table and the number of accesses to the memory conversion area table, including: Monitoring the number of accesses to the memory area hardware entry memory table and the number of accesses to the memory conversion area table within a first preset time; After a monitoring cycle corresponding to the first preset time ends, the number of accesses recorded in the previous monitoring cycle is cleared.
7. The data transmission method according to claim 1, characterized in that: Obtain the memory area hardware entry memory table and memory translation area table of the host memory and store them locally, including: After receiving the entry write notification, it is determined that the memory area hardware entry memory table and the memory conversion area table written by the host into the local storage are received.
8. The data transmission method according to claim 7, characterized in that: The host writes the memory area hardware entry memory table and the memory conversion area table into the local storage of the first device, including: The host invokes the first bus to write the memory region hardware entry memory table and the memory translation region table into the local storage of the first device through direct memory access.
9. The data transmission method according to claim 7, characterized in that: Receiving the entry write notification 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 the entry write notification.
10. The data transmission method according to claim 7, characterized in that: The host writes the memory area hardware entry memory table and the memory translation area table into the local storage of the first device, including: After the host writes the memory area hardware entry memory table and the memory conversion area table into the local memory of the first device, the memory area hardware entry memory table and the memory conversion area table corresponding to the hotspot access area of the host memory are stored in the local cache of the first device.
11. The data transmission method according to claim 1, characterized in that: Also includes: When monitoring that the host writes data to the base address register of the first bus, identifying the base address register to obtain table entry update information; The memory area hardware entry memory table and the memory conversion area table in the local storage are updated according to the table entry update information.
12. The data transmission method according to claim 1, characterized in that: Performs data transfer tasks for remote direct memory access of the host, including: If the data transmission task is a task for the host to send data to a remote device, calling 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 calling a remote direct memory access module to send the first target data to the remote device; If the data transmission task is a task for the host to receive data from the remote device, after receiving the second target data 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.
13. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the data transmission method according to any one of claims 1 to 12 when executing the computer program.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the data transmission method according to any one of claims 1 to 12.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 12 are implemented.
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
Extended page table for encrypted virtual machines
US20240354137A1
Cited By
Bandwidth determination method and device of host channel adapter
CN120567691A