Memory management system, processor, electronic equipment and page table acquisition method

By introducing a page table request accelerator to parse and translate page tables in the memory management system, the area and power consumption problems caused by the increase in TLB capacity are solved, the page table access efficiency and accuracy are improved, and more efficient memory management is achieved.

CN119088728APending Publication Date: 2024-12-06HYGON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411203287.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

When the existing memory management system accelerates the conversion of virtual addresses to physical addresses, increasing TLB capacity will lead to an increase in chip area and increase in power consumption. Prefetching page table entries may occupy space and reduce efficiency, and reduce TLB utilization when prefetching is invalid.

Method used

Introduce a page table request accelerator between the memory management unit and the memory controller, and use this accelerator to parse, translate and traverse the page table, shorten the interaction path between memory and MMU, save bandwidth resources, and increase page table acquisition through FIFO queues and counters efficiency.

Benefits of technology

It improves page table access efficiency, reduces the interaction complexity and power consumption of TLB, and enhances the accuracy and efficiency of page table acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119088728A_ABST
    Figure CN119088728A_ABST
Patent Text Reader

Abstract

The invention relates to a memory management system, a processor, electronic equipment and a page table acquisition method, and belongs to the technical field of electronics. The memory management system comprises an MMU, a page table request accelerator and a memory controller, wherein the page table request accelerator is respectively connected with the MMU and the memory controller. And the MMU is used for sending a page table reading request. The page table request accelerator is used for responding to the page table reading request and sending a page table access request for obtaining a current page table to the memory controller, analyzing the current page table returned by the memory controller, if the current page table is not required page table data, sending a page table access request for obtaining a next-level page table, and if the current page table is not required page table data, sending a page table access request for obtaining a next-level page table; and traversing the page table data until the required page table data is traversed. The memory controller is used for reading a page table in a memory in response to the page table access request and returning the read page table to the page table request accelerator; wherein the memory is used for storing a page table. The page table obtaining efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of electronic technology, and specifically relates to a memory management system, a processor, an electronic device, and a page table acquisition method. Background Art

[0002] As the demand for big data applications continues to expand, large memory management is a must for modern high-performance computing systems. Memory management involves page table management, for example, using page tables to implement virtual memory management. Accelerating the reading of page table entries can reduce the latency of virtual address to physical address conversion, thereby increasing data access speed, which is critical for applications that need to process large amounts of data quickly.

[0003] There are two main solutions to improve the efficiency of virtual address to physical address conversion in the current MMU (Memory Management Unit):

[0004] The first is to increase the capacity of the TLB (Translation Lookaside Buffer, also known as the page table buffer) in the MMU to store more page table entries, thereby improving the TLB hit rate and address translation efficiency. However, increasing the TLB capacity will increase the chip area, increase power consumption, and ultimately increase costs. In addition, a larger TLB may take more time to search, which may offset some of the advantages of increased capacity.

[0005] The second method is to prefetch adjacent page table entries based on the statistical rules of page table access. If the prefetch is successful, the hit rate of the TLB can be significantly improved. However, the prefetch may occupy limited TLB space, causing other useful page table entries to be replaced, thereby reducing the overall efficiency of the TLB. In addition, if the prefetched page table entries are not accessed in time, then this prefetch is invalid and may reduce the effective utilization of the TLB. Summary of the invention

[0006] In view of this, the purpose of the present application is to provide a memory management system, a processor, an electronic device and a page table acquisition method to speed up the page table access.

[0007] The embodiment of the present application is implemented as follows:

[0008] In the first aspect, an embodiment of the present application provides a memory management system, including: an MMU, a page table request accelerator, and a memory controller, wherein the page table request accelerator is connected to the MMU and the memory controller respectively; the MMU is used to send a page table read request; the page table request accelerator is used to send a page table access request to the memory controller to obtain a current page table in response to the page table read request, parse the current page table returned by the memory controller, and if the current page table is not the required page table data, send a page table access request to obtain a next-level page table until the required page table data is traversed, and return the required page table data to the MMU; the memory controller is used to read the page table in the memory in response to the page table access request, and return the read page table to the page table request accelerator; wherein the memory is used to store page tables.

[0009] In the above embodiment, a page table request accelerator is added between the memory management unit and the memory controller, so that the memory controller only returns the page table to the page table request accelerator, and the page table request accelerator performs operations such as page table parsing, translation, and traversal. There is no need to return the page table to the MMU every time, and there is no need for the MMU to perform operations such as page table parsing, translation, and traversal. In this application, only the required page table data is returned to the MMU, which shortens the interaction path between the internal memory and the MMU. By shortening the page table access request path, the bandwidth resources of the access request are saved, thereby improving the efficiency of page table access.

[0010] In combination with a possible implementation manner of the first aspect embodiment, the page table request accelerator includes: a request transceiver unit, a page table translation unit, and a page table access unit; the request transceiver unit is used to receive a page table read request sent by the MMU, and return the required page table data to the MMU; the page table translation unit is used to obtain the physical access address of the current page table according to the page table read request, and send the physical access address to the page table access unit; and parse the current page table returned by the memory controller. If the current page table is not the required page table data, continue to obtain the physical access address of the next level page table until the required page table data is traversed; the page table access unit is used to send a page table access request to the memory controller according to the physical access address sent by the page table translation unit, and return the page table read by the memory controller to the page table translation unit.

[0011] In the above embodiment, a page table request accelerator including a request transceiver unit, a page table translation unit, and a page table access unit is used to interact with the memory controller and the MMU, and perform operations such as page table parsing, translation, and traversal. Complex functions are decomposed into multiple functional units for implementation, thereby simplifying the design difficulty while achieving the purpose of the invention, so that each module can be independently developed and maintained.

[0012] In combination with a possible implementation manner of the first aspect, the page table access unit includes a FIFO queue; the page table translation unit is also used to store the acquired physical access address into the FIFO queue; accordingly, the page table access unit is used to obtain the physical access address from the FIFO queue.

[0013] In the above embodiment, by introducing the FIFO queue, it can be ensured that requests are executed in the order in which they are submitted, and the efficiency of page table acquisition can be improved.

[0014] In combination with a possible implementation manner of the first aspect embodiment, the page table request accelerator also includes a counter, which is used to record the number of page table translations of the page table translation unit; the page table translation unit is also used to determine whether the page table returned by the memory controller is the required page table data based on the number of page table translations recorded by the counter.

[0015] In the above embodiment, a counter is introduced to record the number of page table translations of the page table translation unit, so that it is possible to quickly and accurately determine whether the page table returned by the memory controller is the required page table data based on the number of page table translations recorded by the counter, thereby improving the judgment efficiency.

[0016] In combination with a possible implementation method of the first aspect, the initial value of the counter is N, where N is the number of levels of the multi-level page table; the page table translation unit is also used to update the count value of the counter each time after sending a physical access address to the page table access unit; and each time after receiving the page table returned by the memory controller, obtain the latest count value of the counter, and judge whether the latest count value is a preset threshold to determine whether the page table returned by the memory controller is the required page table data; wherein, if the latest count value is the preset threshold, it is determined that the page table returned by the memory controller is the required page table data.

[0017] In the above embodiment, the page table translation unit updates the count value of the counter each time after sending the physical access address to the page table access unit, and obtains the latest count value of the counter each time after receiving the page table returned by the memory controller. When the latest count value of the counter is a preset threshold, it is determined that the page table returned by the memory controller is the required page table data. In this way, it can be accurately determined whether the page table returned by the memory controller is the required page table data.

[0018] In combination with a possible implementation manner of the first aspect, the MMU includes a TLB page table, and the MMU is also used to search the TLB page table for page table data that hits the address conversion request when receiving an address conversion request; if there is no hit, send the page table read request to the page table request accelerator.

[0019] In the above embodiment, when receiving an address translation request, the MMU first searches the TLB page table for page table data that matches the address translation request. Only when the TLB does not hit the page table data, does it send a page table read request, which can improve the efficiency of page table acquisition.

[0020] In combination with a possible implementation manner of the embodiment of the first aspect, a distance of a transmission path between the page table request accelerator and the MMU is greater than a distance of a transmission path between the page table request accelerator and the memory controller.

[0021] In the above embodiment, the above configuration is adopted to further improve the efficiency of page table access. For example, the page table request accelerator can be arranged close to the memory controller to shorten the request path between the two as much as possible.

[0022] In a second aspect, an embodiment of the present application further provides a processor, including: a memory management system provided by the embodiment of the first aspect above and / or any possible implementation method in combination with the embodiment of the first aspect.

[0023] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a memory and a processor as provided in the embodiment of the second aspect above, wherein the processor is connected to the memory.

[0024] In a fourth aspect, an embodiment of the present application also provides a page table acquisition method, which is applied to a page table request accelerator, and the method includes: obtaining a page table read request sent by an MMU; sending a page table access request to obtain a current page table to a memory controller in response to the page table read request; parsing the current page table read and returned in the memory by the memory controller in response to the page table access request; if the current page table is not the required page table data, sending a page table access request to obtain a next-level page table until the required page table data is traversed, and returning the required page table data to the MMU.

[0025] In combination with a possible implementation manner of the fourth aspect, the page table request accelerator includes a counter for recording the number of page table translations; the method also includes: judging whether the page table returned by the memory controller is the required page table data based on the count value of the counter, wherein the count value represents the number of page table translations.

[0026] In combination with a possible implementation manner of the fourth aspect, the method also includes: updating the count value of the counter after each page table access request is sent to the memory controller; judging whether the page table returned by the memory controller is the required page table data according to the count value of the counter, including: obtaining the latest count value of the counter after each page table returned by the memory controller is received, and judging whether the latest count value is a preset threshold to determine whether the page table returned by the memory controller is the required page table data; wherein, if the latest count value is the preset threshold, it is determined that the page table returned by the memory controller is the required page table data.

[0027] In combination with a possible implementation method of the fourth aspect, in response to the page table read request, a page table access request for obtaining the current page table is sent to the memory controller, including: obtaining the physical access address of the current page table according to the page table read request; and sending a page table access request for obtaining the current page table to the memory controller based on the physical access address.

[0028] In combination with a possible implementation method of the fourth aspect, a page table access request for obtaining a next-level page table is sent, including: obtaining an offset address of the next-level page table according to the page table read request, and obtaining a base address of the next-level page table according to the current page table; obtaining a physical access address of the next-level page table according to the offset address of the next-level page table and the base address of the next-level page table; and sending a page table access request for obtaining the next-level page table to the memory controller based on the physical access address of the next-level page table.

[0029] Other features and advantages of the present application will be described in the following description. The purpose and other advantages of the present application can be realized and obtained through the structures specifically pointed out in the written description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. The above and other purposes, features and advantages of the present application will be more clear as shown in the drawings.

[0031] Figure 1 A schematic diagram of the principle of a multi-level page table traversal provided in an embodiment of the present application is shown.

[0032] Figure 2 A schematic diagram of the structure of a memory management system provided in an embodiment of the present application is shown.

[0033] Figure 3A schematic diagram of the structure of a first page table request accelerator provided in an embodiment of the present application is shown.

[0034] Figure 4 A schematic diagram of the structure of a second page table request accelerator provided in an embodiment of the present application is shown.

[0035] Figure 5 A schematic diagram showing the principle of obtaining a page table provided in an embodiment of the present application is shown.

[0036] Figure 6 A schematic diagram showing the connection between a CPU and a physical memory provided in an embodiment of the present application is shown.

[0037] Figure 7 A flow chart of a page table acquisition method provided in an embodiment of the present application is shown.

[0038] Figure 8 A schematic structural diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0039] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The following embodiments can be used as examples to more clearly illustrate the technical solutions of the present application, and cannot be used to limit the scope of protection of the present application. It will be appreciated by those skilled in the art that, in the absence of conflict, the features in the following embodiments and embodiments can be combined with each other.

[0040] It should be noted that similar numbers and letters represent similar items in the following figures, so once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. At the same time, in the description of this application, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" 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 other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0041] Furthermore, the term "and / or" in this application is merely a term used to describe the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone.

[0042] In the description of the embodiments of the present application, unless otherwise clearly specified or limited, the technical term "connection" may refer to a direct connection or an indirect connection through an intermediate medium.

[0043] In order to facilitate the understanding of the traversal process of the multi-level page table, the following Figure 1 The schematic diagram shown in the figure illustrates the traversal process of the 4-level page table of the 48-bit virtual address. The 48-bit virtual address can be divided into five parts: A, B, C, D, and offset. A is the address offset of the first-level page table, B is the address offset of the second-level page table, C is the address offset of the third-level page table, and D is the address offset of the fourth-level page table. The offset plus the physical address (T) stored in the fourth-level page table gives the final physical address.

[0044] The traversal process of the first-level page table is: the starting address of the first-level page table (from Base_register) plus the address offset (A) of the first-level page table to obtain the physical address where X is stored, that is, Addr(X) = Base_register + A, where X is the starting address pointing to the second-level page table. This step requires the execution of page table parsing and translation operations, that is, obtaining the physical address where the first-level page table is stored based on the virtual address.

[0045] The traversal process of the second-level page table is as follows: the starting address (X) of the second-level page table plus the address offset (B) of the second-level page table obtains the physical address where Y is stored, that is, Addr (Y) = X + B, where Y is the starting address pointing to the third-level page table. This step requires the execution of a page table parsing and translation operation, that is, determining whether the current page table is the required page table data. If not, the physical address where the next-level page table is stored is obtained, and the next-level page table traversal continues.

[0046] The traversal process of the third-level page table is as follows: the starting address (Y) of the third-level page table plus the address offset (C) of the third-level page table obtains the physical address where Z is stored, that is, Addr (Z) = Y + C, where Z is the starting address pointing to the fourth-level page table. This step also requires the execution of page table parsing and translation operations, that is, determining whether the current page table is the required page table data. If not, the physical address of the next-level page table is obtained, and the next-level page table traversal is continued.

[0047] The traversal process of the fourth-level page table is: the starting address (Z) of the fourth-level page table plus the address offset (D) of the fourth-level page table to obtain the physical address where T is stored, that is, Addr (T) = Z + D, where T (Table) is the fourth-level page table itself, that is, the real page table. This step also requires the execution of page table parsing and translation operations, that is, to determine whether the current page table is the required page table data, and if so, to obtain the required page table. After the above 4 traversals, the access to the 4-level page table is completed.

[0048] It is understandable that the page table traversal of the present application is not limited to the 4-level page table traversal in the above example. The page table of the current virtual memory can be as many as 3 to 6 levels. Therefore, it is also applicable to page table traversals of other levels.

[0049] In order to improve the efficiency of page table traversal and address conversion, an embodiment of the present application provides a memory management system, a processor, an electronic device and a page table acquisition method.

[0050] Combine the following Figure 2 The memory management system provided in the embodiment of the present application is described. Among them, the memory management system includes a memory management unit (Memory Management Unit, MMU), a page table request accelerator, and a memory controller, and the page table request accelerator is connected to the MMU and the memory controller respectively. In some possible implementations, the memory management system also includes an on-chip network, and the MMU is connected to the page table request accelerator through the on-chip network.

[0051] In the embodiment of the present application, a page table request accelerator is added between the memory management unit and the memory controller to speed up the reading and address translation of the page table, and the page table access request path is shortened to save bandwidth resources for access requests, thereby improving the efficiency of page table access. Figure 1 It can be seen from the multi-level page table traversal shown that a page table traversal of a 48-bit address requires multiple page table parsing, translation, traversal and other operations. By adding a page table request accelerator, the memory controller only returns the page table to the page table request accelerator, and the page table request accelerator performs page table parsing, translation, traversal and other operations. There is no need to return the page table to the MMU every time, and there is no need for the MMU to perform page table parsing, translation, traversal and other operations. In this application, only the required page table data is returned to the MMU, which shortens the interaction path between the internal memory and the MMU, thereby improving the efficiency of page table access.

[0052] In some possible implementations, the distance of the transmission path between the page table request accelerator and the MMU is greater than the distance of the transmission path between the page table request accelerator and the memory controller. This can further improve the efficiency of page table access. For example, the page table request accelerator can be set close to the memory controller to shorten the request path between the two as much as possible.

[0053] Among them, the MMU is used to send a page table read request (including a complete virtual address (VA)). In some possible implementations, the MMU may include a TLB (Translation Lookaside Buffer) page table. At this time, the MMU is also used to search in the TLB page table whether there is a page table data that hits the address translation request when receiving an address translation request; if there is no hit, the page table read request is sent to the page table request accelerator. Among them, the TLB caches the page table data that has been traversed.

[0054] The page table request accelerator is used to respond to the page table read request and send a page table access request to the memory controller to obtain the current page table, parse the current page table returned by the memory controller, and if the current page table is not the required page table data, continue to send a page table access request to obtain the next level page table until the required page table data is traversed, and return the required page table data to the MMU. The next level page table is relative to the current page table, and is the next level page table of the current page table. For example, if the current page table is the first level page table, the next level page table is the second level page table. If the current page table is the second level page table, the next level page table is the third level page table.

[0055] The memory controller is used to respond to the page table access request from the page table request accelerator, read the page table in the physical memory (which can be referred to as the memory), and return the read page table to the page table request accelerator; wherein the memory is used to store the page table.

[0056] In a possible implementation manner, the page table request accelerator may be implemented using a programmable logic device, and the above functions may be realized by burning corresponding firmware into the programmable logic device.

[0057] In one possible implementation, Figure 3 As shown, the page table request accelerator may include: a request transceiver unit, a page table translation unit and a page table access unit, the request transceiver unit is connected to the page table translation unit, the page table translation unit is connected to the page table access unit, in addition, the request transceiver unit is also connected to the MMU, and the page table access unit is also connected to the memory controller.

[0058] The request transceiver unit is a unit for the page table request accelerator to exchange data with the MMU, and is mainly used to receive the page table read request sent by the MMU and return the required page table data to the MMU. In one possible implementation, the request transceiver unit may include a request queue. After receiving the page table read request from the MMU, the request transceiver unit may put the page table read request into the request queue and wait for the page table translation unit to read it.

[0059] The page table translation unit is used to obtain the physical access address of the current page table according to the page table read request, and send the page table access request to the memory controller through the page table access unit; and parse the current page table returned by the memory controller. If the current page table is not the required page table data, continue to translate the page table to obtain the physical access address of the next level page table until the required page table data is traversed. The page table translation unit can generate a physical access address each time it translates.

[0060] Among them, based on Figure 1 It can be seen that the physical access address of the page table is composed of the base address of the page table + the offset address. Except for the base address of the first-level page table which comes from the register, the base addresses of the other page tables come from the previous-level page table, and the offset address of the page table comes from the virtual address, such as Figure 1 A is the address offset of the first-level page table, B is the address offset of the second-level page table, C is the address offset of the third-level page table, and D is the address offset of the fourth-level page table.

[0061] Taking the above-mentioned 4-level page table traversal as an example, the page table translation unit first obtains the physical access address of the first-level page table (such as Addr (X) = Base_register + A) according to the page table read request, so as to traverse the first-level page table. When the memory controller returns the first-level page table, the first-level page table returned by the memory controller is parsed. If the first-level page table is not the required page table data, the page table translation is continued, that is, according to the page table read request and the first-level page table, the physical access address of the second-level page table is obtained (such as Addr (Y) = X + B), so as to traverse the second-level page table. When the memory controller returns the second-level page table, the second-level page table returned by the memory controller is parsed. If the second-level page table is not the required page table data, the page table translation is continued, that is, according to the page table read request and the second-level page table, the physical access address of the third-level page table (such as Addr (Z) = Y + C) is obtained, so as to traverse the third-level page table. When the memory controller returns the level 3 page table, the level 3 page table returned by the memory controller is parsed. If the level 3 page table is not the required page table data, the page table translation is continued, that is, the physical access address of the level 4 page table (such as Addr (T) = Z + D) is obtained according to the page table read request and the level 3 page table, so as to traverse the level 4 page table. When the memory controller returns the level 4 page table, the level 4 page table returned by the memory controller is parsed. If the level 4 page table is the required page table data, the required page table data is returned to the MMU through the request transceiver unit.

[0062] In one possible implementation, the page table request accelerator may include a register for storing a base address, namely the above-mentioned Base_register. Of course, in some possible implementations, the Base_register may also be located outside the page table request accelerator to meet different usage scenarios.

[0063] The page table access unit is a unit for data exchange between the page table request accelerator and the memory controller. It is mainly used to send page table access requests to the memory controller according to the physical access address sent by the page table translation unit, and return the page table read by the memory controller to the page table translation unit.

[0064] In one possible implementation, the page table access unit includes a FIFO (First Input First Output) queue, and the page table translation unit is also used to store the obtained physical access address into the FIFO queue; accordingly, the page table access unit is used to obtain the physical access address from the FIFO queue. By introducing the FIFO queue, the efficiency of page table acquisition can be improved. The page table translation unit can generate a physical access address each time it translates. For example, after obtaining a page table read request, the page table translation unit can obtain the physical access address of the first-level page table by parsing and translating the request. After receiving the first-level page table, the physical access address of the second-level page table can be obtained by parsing and translating the page table, and so on, until the required page table data is obtained.

[0065] Among them, the page table returned by the memory controller can be a PTE (Page Table Entry) page table or a PDE (Page Directory Entry) page table. The PTE page table is an entry in the page table, which contains information about mapping virtual pages to physical pages, while the PDE page table is used to point to the entry of the next-level page table. When the page table translation unit determines whether the returned page table is the required page table data, it can determine whether the current page table is a PTE page table or a PDE page table. If it is a PDE page table, the page table traversal continues. If it is a PTE page table, it is the required page table data.

[0066] The above-mentioned request transceiver unit, page table translation unit and page table access unit can all be hardware units based on circuit implementation, or can be functional modules implemented using programmable logic devices. This application does not limit the specific implementation.

[0067] In a possible implementation, the page table request accelerator further includes a counter, which is used to record the number of page table translations of the page table translation unit. Figure 4 The page table translation unit is further used to determine whether the page table returned by the memory controller is the required page table data according to the number of page table translations recorded by the counter. For example, when the number of page table translations recorded by the counter is the same as the number of levels of the multi-level page table, it is considered that the page table returned by the memory controller is the required page table data.

[0068] In some possible implementations, the initial value of the counter is N, where N is the number of levels of the multi-level page table. At this time, the page table translation unit is also used to update the count value of the counter each time after sending the physical access address to the page table access unit, such as updating N to N=N-1; and each time after receiving the page table returned by the memory controller, obtain the latest count value of the counter, and determine whether the latest count value is a preset threshold (such as 0) to determine whether the page table returned by the memory controller is the required page table data; wherein, if the latest count value is the preset threshold, it is determined that the page table returned by the memory controller is the required page table data. In this implementation, each time the page table is obtained, the count value of the counter is reduced by 1. When the latest count value of the counter is 0, it is determined that the page table returned by the memory controller is the required page table data. Otherwise, the page table traversal continues, and the count value of the counter is updated until the latest count value of the counter is 0.

[0069] In some implementations, the initial value of the counter can be a preset threshold value (such as 0), and the page table translation unit is further used to update the count value of the counter each time after sending the physical access address to the page table access unit, such as updating N to N=N+1; and each time after receiving the page table returned by the memory controller, obtain the latest count value of the counter, and determine whether the latest count value is N to determine whether the page table returned by the memory controller is the required page table data; wherein, if the latest count value is N, it is determined that the page table returned by the memory controller is the required page table data. In this implementation, each time the page table is obtained, the count value of the counter is increased by 1. When the latest count value of the counter is N, it is determined that the page table returned by the memory controller is the required page table data. Otherwise, the page table traversal continues, and the count value of the counter is updated until the latest count value of the counter is N.

[0070] Among them, the base address of the above-mentioned first-level page table (from Base_register) and the initial value of the counter can be configured by software. Under one possible implementation, they can be configured by MMU. For example, when the MMU sends a page table read request to the page table request accelerator, the base address of the first-level page table and the initial value of the counter (such as N) are carried in the request. That is, at this time, the page table read request includes the virtual address VA of the requested page table, the base address of the first-level page table and the number of page table levels N.

[0071] In a possible implementation, the page table request accelerator performs page table traversal, and the schematic diagram of obtaining the page table can be as follows: Figure 5As shown, before traversing the page table, the page table base address and multi-level page table configuration need to be performed first. After receiving a page table read request (which may include page table level N), the page table level N can be set and the physical address of the page table entry can be calculated. Then, the current page table is read based on the physical address, and N is reduced by 1. After reading the current page table, the current page table is parsed. If the current page table is a PDE, the physical address of the next-level page table entry is calculated, and the next-level page table is read until the required PTE page table is read.

[0072] The aforementioned memory includes but is not limited to random access memory (RAM), and in some implementations, may also be other types of memory.

[0073] In one implementation, taking a CPU (Central Processing Unit) as an example, a schematic diagram of the connection between the memory management system, the CPU core and the physical memory can be as follows: Figure 6 As shown. It is understandable that Figure 6 The example is taken as a CPU (Central Processing Unit). In some possible implementations, when the processor is other processors, such as a microprocessor, the CPU core should be replaced with other cores, such as a microprocessor core.

[0074] The principle of page table access can be found in Figure 6 As shown in ①~⑤:

[0075] 1. When the CPU needs to access physical memory, the CPU core initiates an address translation request, which contains a virtual address (VA).

[0076] 2. After receiving the address translation request from the CPU core, the page table cache request unit in the MMU first checks the TLB page table to see if the physical address corresponding to the virtual address can be directly found. If the corresponding page table entry is not found in the TLB page table, a TLB Miss occurs, and a page table read request is sent to the page table request accelerator. The page table read request contains the page table address, that is, Figure 6 PT Addr in ② can contain the complete virtual address.

[0077] 3. The page table request accelerator responds to the page table read request from the MMU to perform multi-level page table traversal until the required page table data is reached. The process includes sending a page table access request to the memory controller and parsing the current page table returned by the memory controller. If the current page table is not the required page table data, continue to send page table access requests to obtain the next level page table until the required page table data is traversed and the required page table data is returned to the MMU.

[0078] 4. The memory controller responds to the page table access request from the page table request accelerator, reads the page table in the memory, and returns the read page table to the page table request accelerator.

[0079] 5. The page table request accelerator obtains the required PTE page table and returns it to the memory management unit. The memory management unit obtains the physical address corresponding to the virtual address based on the PTE page table and updates the TLB page table.

[0080] The present application also provides a method for obtaining a page table applied to a page table request accelerator, such as Figure 7 As shown, the execution subject of the page table acquisition method can be the above-mentioned page table request accelerator. Figure 7 The principle of this page table acquisition method is described.

[0081] S1: Get the page table read request sent by MMU.

[0082] The page table request accelerator receives a page table read request sent from the MMU, wherein the page table read request may include a complete virtual address.

[0083] S2: In response to the page table read request, a page table access request for obtaining a current page table is sent to the memory controller.

[0084] The process can be to obtain the physical access address of the current page table according to the page table read request, and send a page table access request to obtain the current page table to the memory controller based on the physical access address. Specifically, the page table request accelerator responds to the page table read request to obtain the virtual address contained in the page table read request, and obtains the physical address of the page table based on the virtual address, and sends a page table access request to obtain the current page table to the memory controller based on the physical address.

[0085] S3: Parse the current page table read and returned by the memory controller in response to the page table access request.

[0086] After obtaining the current page table read and returned by the memory controller in response to the page table access request, the page table request accelerator parses the current page table, including determining whether the current page table is the required page table.

[0087] S4: If the current page table is not the required page table data, a page table access request for obtaining a next-level page table is sent until the required page table data is traversed, and the required page table data is returned to the MMU.

[0088] If the current page table is not the required page table data, continue to send a page table access request to obtain the next level page table until the required page table data is traversed, and after the required page table data is traversed, return the required page table data to the MMU. It can be understood that S3 to S4 will be repeated multiple times until the required page table data is traversed.

[0089] Among them, the process of sending a page table access request to obtain a next-level page table may include: obtaining an offset address of a next-level page table according to a page table read request, and obtaining a base address of a next-level page table according to a current page table; obtaining a physical access address of a next-level page table according to the offset address of the next-level page table and the base address of the next-level page table; and sending a page table access request to obtain a next-level page table to a memory controller based on the physical access address of the next-level page table.

[0090] In one possible implementation, the page table request accelerator includes a counter for recording the number of page table translations; the method further includes: judging whether the page table returned by the memory controller is the required page table data according to the count value of the counter, wherein the count value represents the number of page table translations.

[0091] In the above embodiment, the method also includes: updating the count value of the counter each time after sending the physical access address to the page table access unit; accordingly, the process of judging whether the page table returned by the memory controller is the required page table data according to the count value of the counter can be: obtaining the latest count value of the counter each time after receiving the page table returned by the memory controller, judging whether the latest count value is a preset threshold to determine whether the page table returned by the memory controller is the required page table data.

[0092] The implementation principle and technical effects provided by the method embodiment are the same as those of the aforementioned memory management system embodiment. For the sake of brief description, for matters not mentioned in the method embodiment, reference may be made to the corresponding contents in the aforementioned memory management system embodiment.

[0093] The embodiment of the present application further provides a processor, which includes the above-mentioned memory management system. The processor can be various general-purpose processors, embedded processors, system-on-chip (SOC) mobile device processors, server processors, etc.

[0094] In some embodiments, the processor including the memory management system may be a general-purpose processor including a central processing unit (CPU), a network processor (NP), a graphics processing unit (GPU), an accelerated processing unit (Accelerated Processing Unit), a multimedia application processor (MAP), a microprocessor, etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. Or the processor may also be any conventional processor, etc.

[0095] The page table traversal provided by the processor embodiment has the same implementation principle and technical effects as those of the aforementioned memory management system embodiment. For the sake of brief description, for matters not mentioned in the processor embodiment, reference can be made to the corresponding contents in the aforementioned memory management system embodiment.

[0096] The embodiment of the present application also provides an electronic device, which includes the above-mentioned processor and memory, wherein the processor is connected to the memory. The electronic device provided in the embodiment of the present application includes but is not limited to mobile phones, tablets, notebooks, computers, servers and other devices.

[0097] In one possible implementation, Figure 8 As shown, the electronic device includes: a transceiver, a memory, a communication bus and a processor.

[0098] The transceiver, the memory, and the processor are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines. The transceiver is used to send and receive data. The memory is used to store data, such as storing the above-mentioned multi-level page table. The processor is used for the above-mentioned page table acquisition method to obtain the required page table from the memory.

[0099] Among them, the memory can be, but is not limited to, random access memory (Random Access Memory, RAM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (ElectricErasable Programmable Read-Only Memory, EEPROM), etc.

[0100] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0101] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0102] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A memory management system, characterized in that: include: MMU, used to send page table read requests; A page table request accelerator and a memory controller, wherein the page table request accelerator is connected to the MMU and the memory controller respectively, and the page table request accelerator is used to send a page table access request to the memory controller to obtain a current page table in response to the page table read request, parse the current page table returned by the memory controller, and if the current page table is not the required page table data, send a page table access request to obtain a next-level page table until the required page table data is traversed, and return the required page table data to the MMU; The memory controller is used to read the page table in the memory in response to the page table access request, and return the read page table to the page table request accelerator; wherein the memory is used to store the page table.

2. The memory management system according to claim 1, characterized in that: The page table request accelerator comprises: A request transceiver unit, used for receiving a page table read request sent by the MMU, and returning required page table data to the MMU; A page table translation unit and a page table access unit, wherein the page table translation unit is used to obtain a physical access address of a current page table according to the page table read request and send the physical access address to the page table access unit; and parse the current page table returned by the memory controller, and if the current page table is not the required page table data, obtain the physical access address of the next level page table until the required page table data is traversed; The page table access unit is used to send a page table access request to the memory controller according to the physical access address sent by the page table translation unit, and return the page table read by the memory controller to the page table translation unit.

3. The memory management system according to claim 2, characterized in that: The page table access unit includes a FIFO queue; the page table translation unit is also used to store the acquired physical access address into the FIFO queue; accordingly, The page table access unit is used to obtain the physical access address from the FIFO queue.

4. The memory management system according to claim 2, characterized in that: The page table request accelerator further includes a counter, and the counter is used to record the number of page table translations of the page table translation unit; The page table translation unit is further used to determine whether the page table returned by the memory controller is the required page table data according to the number of page table translations recorded by the counter.

5. The memory management system according to claim 4, characterized in that: The initial value of the counter is N, where N is the number of levels of the multi-level page table; The page table translation unit is further used to update the count value of the counter each time after sending the physical access address to the page table access unit; and each time after receiving the page table returned by the memory controller, obtaining the latest count value of the counter, judging whether the latest count value is a preset threshold value to determine whether the page table returned by the memory controller is the required page table data; If the latest count value is a preset threshold, it is determined that the page table returned by the memory controller is the required page table data.

6. The memory management system according to claim 1, characterized in that: The MMU includes a TLB page table, and the MMU is further used to search in the TLB page table whether there is page table data that hits the address conversion request when receiving the address conversion request; if there is no hit, send the page table read request to the page table request accelerator.

7. The memory management system according to any one of claims 1 to 6, characterized in that: The distance of the transmission path between the page table request accelerator and the MMU is greater than the distance of the transmission path between the page table request accelerator and the memory controller.

8. A processor, characterized in that: include: A memory management system as claimed in any one of claims 1 to 7.

9. An electronic device, characterized in that: include: A memory and a processor as claimed in claim 8, wherein the processor is connected to the memory.

10. A page table acquisition method, characterized in that: Applied to a page table request accelerator, the method comprises: Get the page table read request sent by MMU; In response to the page table read request, a page table access request for obtaining a current page table is sent to a memory controller; Parsing a current page table read and returned by the memory controller in response to the page table access request; If the current page table is not the required page table data, a page table access request for obtaining a next-level page table is sent until the required page table data is traversed, and the required page table data is returned to the MMU.

11. The method according to claim 10, characterized in that The page table request accelerator includes a counter for recording the number of page table translations; the method further includes: Whether the page table returned by the memory controller is the required page table data is determined according to the count value of the counter, wherein the count value represents the number of page table translations.

12. The method according to claim 11, characterized in that The method further comprises: After sending a page table access request to the memory controller each time, updating the count value of the counter; Judging whether the page table returned by the memory controller is required page table data according to the count value of the counter, including: After receiving the page table returned by the memory controller each time, obtaining the latest count value of the counter, judging whether the latest count value is a preset threshold value to determine whether the page table returned by the memory controller is the required page table data; If the latest count value is a preset threshold, it is determined that the page table returned by the memory controller is the required page table data.