Access request implementation method and device, computer equipment and storage medium

By directly writing the payload information into the preset queue and notifying the system process for processing, the problem of low efficiency of direct memory access in the case of page shortage is solved, and efficient data processing and resource utilization are achieved.

CN118550848APending Publication Date: 2024-08-27GUANGDONG HONGJUN MICROELECTRONICS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410414374.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-08
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

In the case of page missing, the direct memory access process is complicated, resulting in high CPU and IOMMU resource usage and low data processing efficiency.

Method used

By receiving the direct memory access request from the external device, the operation type is determined, and during the write operation, the payload information is directly written to the preset queue in the main memory, and the system process is notified for processing, avoiding considering the existence of the page table, and improving Access efficiency.

Benefits of technology

It achieves efficient data access in the case of page shortage, reduces resource occupation, and improves the access efficiency of external devices to main memory.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550848A
    Figure CN118550848A
Patent Text Reader

Abstract

The invention relates to the technical field of data transmission, and discloses an access request implementation method and device, computer equipment and a storage medium, and the method comprises the steps: responding to a received active access request instruction which is sent by external equipment and corresponds to a direct memory access request; determining an operation type of the direct memory access request based on the active access request instruction; when the operation type of the direct memory access request is a write-in type, obtaining first effective load information in the active access request instruction, and writing the first effective load information into a first preset queue in a main memory; the first notification message is sent to the system process so that the system process can process the first effective load information in the first preset queue, the effective load information in the access request of the external device is directly stored in the first preset queue in the main memory, and whether a page table exists in the main memory or not does not need to be considered; the access request of the external device to the main memory can be completed more efficiently.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data transmission, and in particular to a method, device, computer equipment and storage medium for implementing an access request. Background Art

[0002] In the computer field, direct memory access (DMA) requests are usually initiated by peripherals, with the purpose of reducing the burden on the main processors such as CPU, GPU, GPGPU, ASIC, etc., so that peripherals with DMA controller and DMA engine functions can directly transfer data with the memory. If a peripheral wants to perform DMA to the main memory, the DMA request initiated often needs to go through the system memory management unit, such as the I / O Memory Management Unit (IOMMU), to perform address conversion. For security reasons, the system generally only exposes virtual memory space to peripherals. The virtual memory address accessed by the peripheral needs to be translated into physical memory address through the memory management unit. The address conversion must allow the main processor to prepare page tables in advance for translation. Due to the richness of peripherals and DMA access, the main processor cannot prepare all the required page tables in advance, and the physical address is limited. There will definitely be some peripherals that use virtual addresses to initiate access, but there is no corresponding page table and physical address. This is called a page fault.

[0003] In the prior art, in the case of a page fault, a page request interface (PRI) and a page request service (PRS) are often used to help external devices implement DMA requests. However, such a DMA access process is relatively complicated and will occupy more resources of the CPU and IOMMU to handle page faults, resulting in low data processing efficiency. Summary of the invention

[0004] In view of this, the present invention provides an access request implementation method, apparatus, computer equipment and storage medium to solve the problem of low data processing efficiency when performing direct memory access in the case of page fault.

[0005] In a first aspect, the present invention provides an access request implementation method, which is applied to a memory management unit, and the method comprises:

[0006] In response to receiving an active access request instruction corresponding to a direct memory access request sent by an external device, determining an operation type of the direct memory access request based on the active access request instruction;

[0007] When the operation type of the direct memory access request is a write type, obtaining first valid load information in the active access request instruction, and writing the first valid load information into a first preset queue in the main memory;

[0008] A first notification message is sent to a system process, so that the system process processes first effective load information in the first preset queue.

[0009] By receiving an active access request instruction corresponding to a direct memory access request, and when the direct memory access request is a write operation, directly writing the effective load information in the active access request instruction into a first preset queue in the main memory, and notifying the system process to promptly process the load information in the first preset queue, direct access of the external device to the main memory is achieved. Since the effective load information is directly written into the preset queue, there is no need to consider whether a page table exists in the main memory, and the access request of the external device to the main memory can be completed more efficiently.

[0010] In some optional embodiments, the method further comprises:

[0011] Before writing the first effective load information into the first preset queue in the main memory, the method further includes:

[0012] Determining whether the size of the first effective load information meets preset requirements;

[0013] If the size of the first effective load information meets the preset requirement, the step of writing the first effective load information into a first preset queue in the main memory is executed.

[0014] By judging whether the size of the first effective load information meets the preset requirement, it is ensured that the active access request instruction can be processed through the first preset queue, thereby implementing the screening of the active access request and avoiding the waste of resources.

[0015] In some optional implementations, the active access request instruction further includes: page table request information;

[0016] The method further comprises:

[0017] Obtaining page table request information in the active access request instruction, and writing the page table request information into a second preset queue in the main memory;

[0018] A second notification message is sent to the system process, so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue, so as to complete a subsequent direct memory access request of the external device according to the target page table.

[0019] By storing the page table request instruction in the active access request instruction in the second preset queue in the main memory, the system process can process the page table request instruction and obtain the target page table, so that the external device can subsequently directly store its access request according to the target page table, further improving the access efficiency of the external device to the main memory.

[0020] In an optional embodiment, the method further includes:

[0021] If the size of the first effective load information does not meet the preset requirement, the direct memory access request of the external device is completed based on the target page table in the main memory.

[0022] By storing the target page table in the main memory, when the first payload information in the active access request instruction does not meet the requirements, the external device can complete the access to the main memory through a direct memory access request according to the target page table, further ensuring the smooth implementation of the external device's access to the main memory.

[0023] In an optional embodiment, the method further includes:

[0024] When the operation type of the direct memory access request of the external device is a read type, obtaining target payload information pre-stored in the first preset queue by the system process;

[0025] The target payload information is sent to the external device.

[0026] By acquiring the target effective load information pre-stored in the first preset queue and sending it to the target device when the external device performs a read operation on the main memory, the effective reading of the main memory by the external device can be realized efficiently and quickly.

[0027] In an optional implementation manner, the active access request instruction further includes: page table request information, and the method further includes:

[0028] Obtaining page table request information in the active access request instruction, and writing the page table request information into a second preset queue in the main memory;

[0029] If the target payload information pre-stored by the system process does not exist in the first preset queue, sending second notification information to the system process so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue;

[0030] A direct memory access request of the external device is completed based on the target page table in the main memory.

[0031] By actively accessing the page table request information in the request instruction, when there is no target payload information in the first preset queue in the main memory, the page table request information can be stored in the second preset queue, so that the system process stores the target page table in the main memory to complete the direct memory access request of the external device according to the target page table, thereby ensuring stable direct access of the external device to the main memory.

[0032] In an optional implementation, the active access request instruction includes: an operation type identifier of a direct memory access request;

[0033] The determining the operation type of the direct memory access request based on the active access request instruction comprises:

[0034] The operation type of the direct memory access request is determined based on the operation type identifier in the active access request instruction.

[0035] By including the operation type identifier of the direct memory access request in the active access request instruction, the operation type of the direct memory access request can be accurately determined, thereby ensuring the implementation of subsequent operations.

[0036] In a second aspect, the present invention provides an access request implementation device, which is applied to a memory management unit, and the device includes:

[0037] A type determination module: configured to, in response to receiving an active access request instruction corresponding to a direct memory access request sent by an external device, determine an operation type of the direct memory access request based on the active access request instruction;

[0038] an information writing module, configured to obtain first valid load information in the active access request instruction when the operation type of the direct memory access request is a write type, and write the first valid load information into a first preset queue in the main memory;

[0039] The information processing module is used to send a first notification message to a system process so that the system process processes the first effective load information in the first preset queue.

[0040] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the access request implementation method of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0041] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the access request implementation method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 is a flow chart of a method for implementing an access request according to an embodiment of the present invention;

[0044] Figure 2 is a flow chart of another access request implementation method according to an embodiment of the present invention;

[0045] Figure 3 This is an example flow chart of a preferred access request implementation method according to an embodiment of the present invention;

[0046] Figure 4 This is an example diagram of a main memory preset queue according to an embodiment of the present invention.

[0047] Figure 5 The figure is an example flow chart of a method for implementing a read access request according to an embodiment of the present invention.

[0048] Figure 6 is a structural block diagram of an access request implementation device according to an embodiment of the present invention;

[0049] Figure 7 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0051] In the computer field, direct memory access (DMA) requests are usually initiated by peripherals, with the purpose of reducing the burden on main processors such as CPUs and GPUs, so that peripherals such as DMA controllers and DMA engines can directly transfer data with the memory. If a peripheral wants to perform DMA on the main memory, the DMA request initiated often needs to go through the system memory management unit, such as the I / O Memory Management Unit (IOMMU), to perform address conversion. The address conversion must allow the main processor to prepare page tables in advance for translation. Due to the abundance of peripherals and DMA access, the CPU cannot prepare all the required page tables in advance, and the physical address is limited. There will definitely be some peripherals that use virtual addresses to initiate access, but there is no corresponding page table and physical address. This is called a page fault.

[0052] In the prior art, in the case of a page fault, a page request interface (PRI) and a page request service (PRS) are often used to help external devices implement DMA requests. However, such a DMA access process is relatively complicated and will occupy more resources of the CPU and IOMMU to handle page faults, resulting in low data processing efficiency.

[0053] To this end, an embodiment of the present invention provides an access request implementation method, which receives an active access request instruction corresponding to a direct memory access request, and when the direct memory access request is a write operation, directly writes the effective load information in the active access request instruction into a first preset queue in the main memory, and notifies the system process to process the load information in the first preset queue in a timely manner, thereby realizing direct access of the external device to the main memory. Since the effective load information is directly written into the preset queue, there is no need to consider whether there is a page table in the main memory, and the access request of the external device to the main memory can be completed more efficiently.

[0054] According to an embodiment of the present invention, a method for implementing an access request is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0055] In this embodiment, a method for implementing an access request is provided, which can be used for the above-mentioned external device to directly access the main memory. Figure 1 is a flow chart of a method for implementing an access request according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0056] Step S101 , in response to receiving an active access request instruction corresponding to a direct memory access request sent by an external device, determining an operation type of the direct memory access request based on the active access request instruction.

[0057] When an external device sends a direct memory access request, that is, the above-mentioned DMA request, it needs to go through the memory management unit inside the system to perform address conversion. For example, the memory management unit can be an IOMMU, SMMU, GMMU or other memory management unit.

[0058] When performing address translation, the memory management unit needs to obtain the page table for address translation in the main memory, but sometimes the main control processor does not store the relevant page table in the main memory. The main control processor can be a CPU, GPU, GPGPU and other processors. The CPU is used as an example for explanation. In this case, the external device needs to make a page table request through PRI and PRS. The DMA request can only be made after the CPU stores the page table in the main memory.

[0059] Regarding the above-mentioned step S101, its execution premise may be that after the external device initiates a DMA request attempt to the main memory and determines that there is no relevant page table in the main memory, the external device sends an active access request instruction corresponding to the previously sent DMA request to the memory management unit; or it may be that regardless of whether there is a correlation in the main memory, the external device directly sends an active access request instruction corresponding to the DMA to the main memory.

[0060] The correspondence between the active access request instruction and the DMA request can be understood as follows: the active access request instruction can complete the same main memory access operation as the DMA request, and the active access request instruction includes the content that the DMA wants to access the main memory and whether the DMA is a read operation or a write operation or a read-write operation. For example, the active access request instruction can include the data that the DMA specifically wants to read or write.

[0061] After receiving the active access request instruction sent by the external device, since the active access request instruction and the DMA access request are corresponding, it can be understood that the active access request instruction includes some relevant information of the DMA request. Therefore, the specific operation type of the DMA request can be determined based on the active access request instruction, such as a read operation or a write operation.

[0062] Step S102, when the operation type of the direct memory access request is a write type, obtaining first valid load information in the active access request instruction, and writing the first valid load information into a first preset queue in the main memory.

[0063] When it is determined that the direct memory access request corresponding to the active access request instruction, that is, the DMA request is a write operation, the first valid load information in the active access request instruction is obtained. The first valid load information can be understood as the data that the DMA request wants to write into the main memory. Because the active access request instruction corresponds to the DMA request mentioned above, the first valid load information is included in the active access request instruction. After the first valid load information is obtained, the information is stored in a first preset queue in the main memory that is pre-opened and is specifically used to process the active access request instruction.

[0064] In one example, when a traditional page table request instruction is transmitting a page table request instruction, it is necessary to set a queue for storing the page table request instruction in the main memory, and the first preset queue mentioned above can be set corresponding to the queue set in the main memory for storing the page table request instruction. In some cases, the page table request information and the first valid load information can be carried in the active access request instruction, the page table request information is stored in the traditional queue for storing the page table request instruction, and the first valid load information is stored in the corresponding first preset queue.

[0065] Step S103: Send a first notification message to the system process, so that the system process processes the first effective load information in the first preset queue.

[0066] After storing the first valid load information carried in the active access request instruction in the first preset queue, it is equivalent to completing the direct access of the external device to the main memory, that is, the data to be stored is stored in the main memory. At this time, a notification can be sent to the system process to allow the system process to process the first valid load information that has been stored in the main memory.

[0067] The access request implementation method provided in the present embodiment receives an active access request instruction corresponding to a direct memory access request, and when the direct memory access request is a write operation, directly writes the effective load information in the active access request instruction into a first preset queue in the main memory, and notifies the system process to process the load information in the first preset queue in a timely manner, thereby realizing direct access of the external device to the main memory. Since the effective load information is directly written into the preset queue, there is no need to consider whether there is a page table in the main memory, and the access request of the external device to the main memory can be completed more efficiently.

[0068] According to an embodiment of the present invention, another access request implementation method embodiment is provided, which can be used for the above-mentioned external device to directly access the main memory. Figure 2 is a flow chart of another access request implementation method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0069] Step S201 , in response to receiving an active access request instruction corresponding to a direct memory access request sent by an external device, determining an operation type of the direct memory access request based on the active access request instruction.

[0070] Specifically, in step S201, the active access request instruction also includes: page table request information.

[0071] It can be understood that when the active access request instruction also carries the page table request information required for the traditional DMA access method, when the subsequent first payload information does not meet the requirements, resulting in the external device being unable to store the first payload information in the active access request instruction into the first preset queue in the main memory, the traditional method of page table request can be used to complete the external device's active access to the main memory. The specific usage is shown in the subsequent related steps and will not be repeated here.

[0072] Specifically, the active access request instruction includes: an operation type identifier of a direct memory access request;

[0073] Determining an operation type of a direct memory access request based on an active access request instruction includes:

[0074] Based on the operation type identifier in the active access request instruction, the operation type of the direct memory access request is determined.

[0075] It can be understood that the active access request instruction includes the operation type identifier of the corresponding direct memory access request, so that the operation type of the direct memory access request is determined according to the operation type identifier, thereby determining the subsequent specific operation.

[0076] By including the operation type identifier of the direct memory access request in the active access request instruction, the operation type of the direct memory access request can be accurately determined, thereby ensuring the implementation of subsequent operations.

[0077] Step S202: when the operation type of the direct memory access request is a write type, obtain the first effective load information in the active access request instruction. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0078] Step S203, determining whether the size of the first effective payload information meets a preset requirement;

[0079] If the size of the first effective load information meets the preset requirement, the step of writing the first effective load information into a first preset queue in the main memory is executed.

[0080] It can be understood that the size of each block in the first preset queue opened on the main memory is already limited, so the size of the first effective load information needs to be judged, and it can only be stored in the first preset queue if its size meets the requirement. In an example, its size limit can be less than 4kByte and / or less than a granule, that is, the size of a granule.

[0081] When the size of the first effective load information meets the requirement, the first effective load information is written into a first preset queue in the main memory.

[0082] By judging whether the size of the first effective load information meets the preset requirement, it is ensured that the active access request instruction can be processed through the first preset queue, thereby implementing the screening of the active access request and avoiding the waste of resources.

[0083] Step S204: Send a first notification message to the system process so that the system process processes the first effective load information in the first preset queue. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0084] Step S205, obtaining page table request information in the active access request instruction, and writing the page table request information into a second preset queue in the main memory;

[0085] A second notification message is sent to the system process, so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue, so as to complete a subsequent direct memory access request of the external device according to the target page table.

[0086] It can be understood that when obtaining the information in the active access request instruction, in addition to obtaining the first payload information in the active access request instruction, the page table request information is also obtained at the same time. While the first payload information is written into the first preset queue, its corresponding page table request information is also stored in the second preset queue. The first preset queue and the second preset queue are set accordingly. For example, for each active access request instruction, if the active access request instruction is a write operation, the page table request information is written to a certain position in the second preset queue, and the first payload information is written to a position in the first preset queue corresponding to the position of the page table request information in the second preset queue.

[0087] In some cases, when the first payload information meets the preset requirements, it can be written into the first preset queue. This completes steps S203-S204, which is equivalent to having completed the access request to the main memory. The page table request information no longer needs to be processed because the page table request information is also for completing the direct access of the external device to the main memory. At this time, there is no need to repeat the operation.

[0088] However, in some other cases, for example, the direct storage access request of the external device is frequent and direct storage access request to the main memory is needed frequently. Therefore, at the same time or after completing steps S203-S204, a second notification message is sent to the system process to let the system process process the page table request information in the second preset queue and store the corresponding page table in the main memory, so that the external device can directly make DMA requests according to the page table when accessing it subsequently.

[0089] By storing the page table request instruction in the active access request instruction in the second preset queue in the main memory, the system process can process the page table request instruction and obtain the target page table, so that the external device can subsequently directly store its access request according to the target page table, further improving the access efficiency of the external device to the main memory.

[0090] Step S206: if the size of the first effective load information does not meet the preset requirement, the direct memory access request of the external device is completed based on the target page table in the main memory.

[0091] The above situations are all explanations for the situation where the first payload information can be written into the first preset queue. In some cases, the size of the first payload information does not meet the preset requirements. At this time, since the page table request information has been stored in the second preset queue, the traditional page table request method can be used to complete the DMA request and realize the direct access of the external device to the main memory. The specific implementation method is to notify the system process to process the page table request information in the second preset queue, store the corresponding page table in the main memory, and notify the external device to complete the DMA request according to the stored page table.

[0092] Step S207, when the operation type of the direct memory access request of the external device is a read type, obtaining target payload information pre-stored in the first preset queue by the system process;

[0093] Sends target payload information to an external device.

[0094] It can be understood that when the operation type of the direct memory access request corresponding to the active access request instruction sent by the external device is a read operation, it means that the external device wants to read the relevant data in the main memory at this time, so it is necessary to obtain the target payload information that the system process has pre-stored in the first preset queue, and send the payload information to the external device.

[0095] By acquiring the target effective load information pre-stored in the first preset queue and sending it to the target device when the external device performs a read operation on the main memory, the effective reading of the main memory by the external device can be realized efficiently and quickly.

[0096] Specifically, in some cases, the active access request instruction also includes: page table request information.

[0097] Obtaining page table request information in the active access request instruction, and writing the page table request information into a second preset queue in the main memory;

[0098] If the target payload information pre-stored by the system process does not exist in the first preset queue, sending second notification information to the system process so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue;

[0099] Completes direct memory access requests from external devices based on the target page table in main memory.

[0100] It can be understood that when the direct memory access request corresponding to the active access request instruction is a read operation, the active access request instruction can also include page table request information. Referring to the above corresponding implementation method, the page table request information is stored in the corresponding second preset queue. When the target payload information does not exist in the first preset queue, a second notification information is sent to the system process, so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue.

[0101] By actively accessing the page table request information in the request instruction, when there is no target payload information in the first preset queue in the main memory, the page table request information can be stored in the second preset queue, so that the system process stores the target page table in the main memory to complete the direct memory access request of the external device according to the target page table, thereby ensuring stable direct access of the external device to the main memory.

[0102] The access request implementation method provided by the embodiment of the present invention can directly store the payload information in the first preset queue in the main memory by receiving the first payload information and the page table request information in the active access request instruction corresponding to the direct memory access request, thereby completing the direct access of the external device to the main memory, and at the same time storing the page table request information in the second preset queue corresponding to the first preset queue. Therefore, when the payload information cannot be stored in the first preset queue, the system process can store the relevant page table in the main memory according to the page table request information, so that the external device can complete the direct memory access request to the main memory according to the page table, thereby greatly improving the efficiency of direct access of external data to the main memory and reducing the waiting time between the request and data transmission.

[0103] In order to facilitate understanding of the embodiments of the present invention, a preferred exemplary example is provided. Figure 3 FIG. 1 is a flowchart showing an example of a preferred access request implementation method according to an embodiment of the present invention.

[0104] It should be noted that Figure 3 The illustrative example shown is only one application scenario of the access request method. Figure 3 In addition to the application scenario in which the external device accesses the main memory, the technical solution of the above method embodiment can be applied to scenarios involving request services such as memory management, network communication, distributed systems, and remote direct storage access.

[0105] For example, in application scenarios such as operating system memory management or virtual memory systems, there is also a similar page request mechanism as described above. When a process attempts to access a virtual memory page that is not in physical memory, a page fault interrupt will be generated, and the operating system will load the required page from the disk to the memory according to the request. Therefore, the technical solution of the above method embodiment can also be used for processing; or in certain network protocols or architectures, there may also be a mechanism for requesting service entities (such as pages, resource blocks, etc.). In the corresponding access request scenario, the technical solution of the above method embodiment can also be applied; or in a distributed storage system, the client may request specific data from the server. After receiving the request, the server loads the data block from the disk or other storage medium into the memory and returns it to the client. In such a data transmission scenario, the above method embodiment can also be applied. Figure 3 The embodiment described is only used as a reference for an application scenario, in which the IOMMU is only a memory management unit in one scenario. For other related scenarios, the memory management unit may also be MMU, SMMU, GMMU and other memory management units. The system process may be a related process in a processor such as a CPU, GPU, GPGPU, etc. In some other request access scenarios, the device may also be adaptively modified.

[0106] like Figure 3 As shown, first, step (1) in the figure refers to the system process notifying the external device to initiate DMA access to the main memory. It should be noted that the embodiment of the present invention is only the most commonly used scenario, and the method can also be applied to the scenario where the external device directly accesses the content of other devices.

[0107] Next, in step (2), the external device sends a direct ATS TR (Translate request) to the IOMMU, i.e., a pre-DMA address translation request, so that the IOMMU performs address translation according to the page table in the main memory, thereby completing the DMA access.

[0108] Then, in step (3), since there is no page table in the main memory, the IOMMU translation fails and a page fault instruction is sent to the external device to indicate that there is no relevant page table in the main memory. In some cases, the peripheral device can actively initiate a DMA request, and steps (1) to (3) can be omitted.

[0109] In step (4), the external device sends an active access request instruction corresponding to the direct memory access request to the IOMMU. The request instruction may include page table request information, payload information, and an identifier for identifying the operation type of the direct memory access request. The page table request information includes: the required page table, the virtual address to be converted, related attributes and permissions, etc.; the payload information can be understood as the first payload information in the above-mentioned embodiment of the invention; the operation type is identified by AW and AR, where AW identifies a write operation and AR identifies a read operation.

[0110] And IOMMU opens a page request queue (Page Request InterfaceQueue, PRIQ) in the main memory in advance, reserves space for the active access queue (Aggressive Access Queue, AACQ), and binds it to PRIQ one by one, which can be accessed by Process and IOMMU at any time, wherein RPIQ is a traditional queue for storing page table request instructions PRI, which can be understood as the second preset queue of the above invention embodiment, and AACQ is used to store the payload information corresponding to the page table request instruction in the active access request instruction. Payload is the first effective load information in the above method embodiment, and AACQ is equivalent to the first preset queue in the above invention embodiment. For the specific forms of RPIQ and AACQ, please refer to Figure 4 As shown, it is an example diagram of a main memory preset queue according to an embodiment of the present invention. After the IOMMU receives the active access request instruction sent by the external device, the corresponding operation type identifier and page table request information are placed in the RPIQ, and the corresponding payload is written into the corresponding Aggressive Access Queque, i.e., AACQ, wherein WL refers to the first valid load information corresponding to the write operation, and RL refers to the target valid load information pre-stored by the system process corresponding to the read operation. For some requests, which include both read operations and write operations, AW and AR are stored in the corresponding RPIQ, AW refers to an identifier used to indicate that the active access request is a write operation, i.e., an active access write identifier; AR refers to an identifier used to indicate that the active access request is a read operation, i.e., an active access read identifier, and WL and RL are stored in the AACQ, wherein WL refers to the valid load information written by the active access request instruction, i.e., the write valid load information; RL refers to the valid load information read by the active access request instruction, i.e., the read valid load information.

[0111] Next, execute step (5) to store the information in the active access request into a preset queue in the main memory.

[0112] Specifically, after the IOMMU receives an active access request instruction, it will first identify it to determine whether to use ACCQ for processing. The specific judgment standard is to judge based on the size of the first effective load information in the active access request instruction. Specifically, its size should be smaller than a preset value and / or smaller than the size of a minimum particle Granule.

[0113] In the case where the first payload information meets the preset requirements, it is determined whether the specific operation type is read, write, or read and write. Preferably, regardless of the operation type and whether the size of the payload information meets the preset requirements, the page table request information in the active access request instruction can be placed in the RPIQ of the main memory. If the size of the first payload information does not meet the preset requirements, the DMA request can be completed directly according to the page table request information in the RPIQ in a traditional page table request manner.

[0114] In the case where the first payload information meets the preset requirements, if its specific operation type is a write operation, the first payload information is written into the AACQ, and step (6) is executed to send a notification message to the system process, that is, the first notification message in the above method embodiment, so that the system process processes the first payload information in the AACQ. In another case, if the first payload information is a read operation, the target payload information stored in the AACQ by the system process in advance is sent to the external device. In order to reduce the burden on the system software, multiple AACQ and RPIQ may be filled at the same time, and only one interrupt will be sent unless the queue is cleared.

[0115] Next, in step (7), the system process processes PRIQ and accesses the data in ACCQ at an appropriate time. At this point, the data that the system process needs to interact with has actually been completed. The process can be terminated here.

[0116] However, the system process can choose whether to continue the normal PRI process as needed. If necessary, the main memory is locked for the Device according to the Device's needs, and the page table is generated and stored in the main memory, and the IOMMU is notified after completion. The IOMMU notifies the Device that the page table is ready. The Device initiates the ATS TR request again to the IOMMU for successful translation and returns the translated PA (PhysicalAddr) and various attribute permissions and other information to the Device. The Device uses PA to perform DMA access to the main memory, and after completion, notifies the system process through MSI that the DMA has been completed.

[0117] The above illustrative example mainly improves the IOMMU structure and logic related to PRI to implement the whole method. The original PRIQ data packet is added with AW and AR tags, and the original location for storing PRIQ in the memory is expanded to store the contents of ACCQ one by one. Compatibility with traditional PRI requests can be supported.

[0118] The above-mentioned invention embodiment shows that the direct access to the main memory is realized by the active access request instruction in the embodiment of the present invention. According to the active access request method described in the embodiment of the present invention, the main memory can also be read, read and write, write and read, etc. Figure 5 As shown, it is an example flow chart of a method for implementing a read access request according to an embodiment of the present invention.

[0119] like Figure 5 As shown, in Figure 3 On the basis of the illustrated embodiment, relevant steps of reading are added. When performing a read operation, the system process first stores the data to be read in the AACQ queue, that is, the first preset queue mentioned in the above method embodiment, and at the same time sends a message to the device, that is, the peripheral device, so that the device accesses the main memory. The device sends an active access request instruction carrying a read identifier to the memory management unit. After receiving the active access request instruction, the IOMMU sends the corresponding data pre-stored by the system process in the first preset queue in the main memory to the device. In some cases, the active access request instruction sent by the external device can also perform a read-and-write operation or a write-and-read operation on the data already stored in the AACQ, that is, an Atomic atomic operation. Taking the read-and-write operation as an example, it means that on the basis of the above-mentioned reading of the data, the read data is processed, and the processed data is written to the corresponding position in the queue. Taking the write-and-read operation as an example, specific data in the queue is read on the basis of the above-mentioned write operation.

[0120] Placing data in ACCQ and transmitting it together with the PRI request can reduce the latency of the entire PRI+ATS process. When the device initiates a PRI request with data, the host can start processing the data immediately without waiting for the data to arrive. This is beneficial for application scenarios that require low latency (such as real-time data processing, high-performance computing, etc.).

[0121] In some cases, transferring data and requests simultaneously can improve data throughput. This can be advantageous for large-scale data transfers or scenarios that require frequent access to a large number of memory pages, as it reduces the waiting time between requests and data transfers.

[0122] Secondly, the host can process data immediately upon receiving a PRI request. For some low-frequency small DMA data, there is no need to generate a page table or wait for additional data transfer. The IOMMU does not need to perform a secondary translation of this data. This can reduce the burden on the host CPU and IOMMU. This may be beneficial in some applications that require efficient data processing.

[0123] At the same time, this method is combined with some pre-fetch algorithms. After the first request arrives quickly, the CPU can prepare the corresponding cache and data in advance, which can improve the efficiency of subsequent DMA access and reasoning, which is of great significance in some AI and ML scenarios.

[0124] And with the explosive development of AI, ML, cloud computing and edge computing, this type of low-frequency DMA packets will only increase. For example, when AI / ML hardware accelerators accelerate computing tasks, deep learning reasoning or training, it usually involves the transmission of model parameters, input data, etc. between the host memory. These data are likely to be small data packets, and once transferred to the host memory, the CPU may only need to use these data once, and may no longer need them afterwards; in cloud computing and edge computing scenarios, after the edge device collects sensor data, it may need to transmit the data to the cloud server for further processing and analysis. These sensor data may be very small data packets, and once transmitted to the cloud, the data may only need to be used once. The embodiment of this method can effectively cope with this application scenario.

[0125] In this embodiment, an access request implementation device is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0126] This embodiment provides an access request implementation device, such as Figure 6 As shown, including:

[0127] The type determination module 401 is configured to, in response to receiving an active access request instruction corresponding to a direct memory access request sent by an external device, determine an operation type of the direct memory access request based on the active access request instruction.

[0128] The information writing module 402 is used to obtain the first valid load information in the active access request instruction when the operation type of the direct memory access request is a write type, and write the first valid load information into a first preset queue in the main memory.

[0129] The information processing module 403 is used to send a first notification message to the system process, so that the system process processes the first effective load information in the first preset queue.

[0130] In some optional implementations, before writing the first effective load information into the first preset queue in the main memory, the information writing module 402 is further used to determine whether the size of the first effective load information meets the preset requirement;

[0131] If the size of the first effective load information meets the preset requirement, the step of writing the first effective load information into a first preset queue in the main memory is executed.

[0132] In some optional implementations, the active access request instruction further includes: page table request information;

[0133] The information writing module 402 is also used to obtain the page table request information in the active access request instruction, and write the page table request information into the second preset queue in the main memory;

[0134] A second notification message is sent to the system process, so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue, so as to complete a subsequent direct memory access request of the external device according to the target page table.

[0135] In some optional implementations, if the size of the first effective load information does not meet the preset requirement, the direct memory access request of the external device is completed based on the target page table in the main memory.

[0136] In some optional implementations, when the operation type of the direct memory access request of the external device is a read type, obtaining target payload information pre-stored in a first preset queue by the system process;

[0137] Sends target payload information to an external device.

[0138] In some optional implementations, the apparatus is further used to obtain page table request information in the active access request instruction, and write the page table request information into a second preset queue in the main memory;

[0139] If the target payload information pre-stored by the system process does not exist in the first preset queue, sending second notification information to the system process so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue;

[0140] Completes direct memory access requests from external devices based on the target page table in main memory.

[0141] In some optional implementations, the active access request instruction includes: an operation type identifier of a direct memory access request;

[0142] Determining an operation type of a direct memory access request based on an active access request instruction includes:

[0143] Based on the operation type identifier in the active access request instruction, the operation type of the direct memory access request is determined.

[0144] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0145] The access request implementation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0146] The embodiment of the present invention also provides a computer device having the above Figure 5 The access request implementation device shown.

[0147] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.

[0148] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0149] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0150] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0151] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0152] The internal structure of the computer can refer to the DMA system with IOMMU. The CPU mentioned in the above-mentioned embodiment of the invention can generally refer to the system process, and IOMMU can be used as a system memory control unit. The peripherals mentioned in the embodiment of the present invention generally include graphics cards, network cards, sound cards, memories, wireless network adapters, video capture cards, industrial control equipment, USB devices, hardware acceleration cards, etc. The bus between the peripherals and the system generally includes PCIPCIe USB LPC, SATA / SAS / SCSI, AGP (Accelerated Graphics Port), ISA (Industry Standard Architecture), EISA (Extended Industry Standard Architecture), etc.

[0153] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0154] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for implementing an access request, applied to a memory management unit, characterized in that: The method comprises: In response to receiving an active access request instruction corresponding to a direct memory access request sent by an external device, determining an operation type of the direct memory access request based on the active access request instruction; When the operation type of the direct memory access request is a write type, obtaining first valid load information in the active access request instruction, and writing the first valid load information into a first preset queue in the main memory; A first notification message is sent to a system process, so that the system process processes first effective load information in the first preset queue.

2. The method according to claim 1, characterized in that Before writing the first effective load information into the first preset queue in the main memory, the method further includes: Determining whether the size of the first effective load information meets preset requirements; If the size of the first effective load information meets the preset requirement, the step of writing the first effective load information into a first preset queue in the main memory is executed.

3. The method according to claim 2, characterized in that The active access request instruction also includes: page table request information; The method further comprises: Obtaining page table request information in the active access request instruction, and writing the page table request information into a second preset queue in the main memory; A second notification message is sent to the system process, so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue, so as to complete a subsequent direct memory access request of the external device according to the target page table.

4. The method according to claim 3, characterized in that The method further comprises: If the size of the first effective load information does not meet the preset requirement, the direct memory access request of the external device is completed based on the target page table in the main memory.

5. The method according to claim 1, characterized in that The method further comprises: When the operation type of the direct memory access request of the external device is a read type, obtaining target payload information pre-stored in the first preset queue by the system process; The target payload information is sent to the external device.

6. The method according to claim 5, characterized in that The active access request instruction also includes: page table request information, and the method further includes: Obtaining page table request information in the active access request instruction, and writing the page table request information into a second preset queue in the main memory; If the target payload information pre-stored by the system process does not exist in the first preset queue, sending second notification information to the system process so that the system process stores the target page table into the main memory based on the page table request information in the second preset queue; A direct memory access request of the external device is completed based on the target page table in the main memory.

7. The method according to any one of claims 1 to 6, characterized in that: The active access request instruction includes: an operation type identifier of a direct memory access request; The determining the operation type of the direct memory access request based on the active access request instruction comprises: The operation type of the direct memory access request is determined based on the operation type identifier in the active access request instruction.

8. An access request implementation device, applied to a memory management unit, characterized in that: The device comprises: A type determination module: configured to, in response to receiving an active access request instruction corresponding to a direct memory access request sent by an external device, determine an operation type of the direct memory access request based on the active access request instruction; an information writing module, configured to obtain first valid load information in the active access request instruction when the operation type of the direct memory access request is a write type, and write the first valid load information into a first preset queue in the main memory; The information processing module is used to send a first notification message to a system process so that the system process processes the first effective load information in the first preset queue.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the access request implementation method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the access request implementation method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Memory management method and electronic device

    WO2026045870A1