Address translation method and device, equipment, storage medium and computer program product
By using multiple cache queues in parallel processing and arbitration order selection in the address translation method, the translation backup buffer backpressure problem caused by uneven cache line hits is solved, and the address translation performance is improved.
Patent Information
- Application Number
- CN202410993394.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-12
AI Technical Summary
During the address translation process, when the hit rate is high and the cache line hits unevenly, the translation backup buffer may backpress upstream, resulting in a degradation of address translation performance.
Use the address translation method of at least two cache queues, write the address translation command to different cache queues according to the hit result, and select the commands that have determined the physical address in the arbitration order between the queues for feedback, ensuring the commands in different cache queues. Parallel processing reduces the probability of backpressure of the translation backup buffer caused by uneven hits of cache lines.
It improves address translation efficiency and performance, reduces the probability of the translation backup buffer backpressure upstream caused by uneven cache line hits, and improves the overall performance of the translation backup buffer.
Smart Images

Figure CN118939575A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of memory access technology, and in particular to an address translation method, apparatus, device, storage medium and computer program product. Background Art
[0002] Computer software usually uses virtual address addressing in logical storage space for software programming, but the actual commands and data are kept in the physical addresses in the physical space. The Translation Lookaside Buffer (TLB) in the Memory Management Unit (MMU) is required to perform high-speed conversion from virtual addresses to physical addresses to obtain actual commands and data.
[0003] During the process of querying the physical address through the translation lookaside buffer, when the address translation command hit rate is high and the cache line hits are uneven, the address translation command corresponding to a cache line may not be processed, causing the translation lookaside buffer to be back-pressured upstream, affecting the address translation performance of the translation lookaside buffer. Summary of the invention
[0004] In view of this, the embodiments of the present application provide an address translation method, apparatus, device, storage medium and computer program product, which can, to a certain extent, solve the problem of address translation performance degradation caused by upstream back pressure of the translation backup buffer when the hit rate is high and the hits of each cache line are uneven.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides an address translation method, which is applied to an address translation device, wherein the address translation device includes at least two cache queues, and the method includes:
[0007] In response to receiving an address translation command sent by an upstream module, performing a hit check based on a virtual address carried in the address translation command to obtain a hit result;
[0008] Writing the address translation command into the cache queue corresponding to the hit result, and determining the physical address corresponding to the virtual address;
[0009] An address translation command with a determined physical address is selected between the at least two cache queues according to an arbitration order, and a corresponding address feedback command is sent to an upstream module corresponding to the address translation command with a determined physical address.
[0010] In a second aspect, an embodiment of the present application further provides an address translation device, the address translation device comprising a hit check module, a queue allocation module, a queue cache module and a queue arbitration module; the queue cache module comprises at least two cache queues, wherein:
[0011] The hit check module is used to respond to receiving the address translation command sent by the upstream module, perform a hit check based on the virtual address carried by the address translation command, and obtain a hit result;
[0012] The queue allocation module is used to write the address translation command into the cache queue corresponding to the hit result in the queue cache module;
[0013] The queue cache module is used to determine the physical address corresponding to the virtual address;
[0014] The queue arbitration module is used to select the address translation command of the determined physical address between the at least two cache queues according to the arbitration order, and send the corresponding address feedback command to the upstream module corresponding to the address translation command of the determined physical address.
[0015] In a third aspect, an embodiment of the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the above-mentioned address translation methods when executing the computer program.
[0016] In a fourth aspect, an embodiment of the present application further provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the address translation method described in any one of the above items is implemented.
[0017] In a fifth aspect, an embodiment of the present application further provides a computer program product, including a computer program, which implements any of the address translation methods described above when executed by a processor.
[0018] In summary, in the address translation method provided in the embodiment of the present application, in response to receiving the address translation command sent by the upstream module, a hit check is performed based on the virtual address carried by the address translation command to obtain a hit result; the address translation command is written into the cache queue corresponding to the hit result, and the physical address corresponding to the virtual address is determined; between at least two cache queues, the address translation command with the determined physical address is selected according to the arbitration order, and the corresponding address feedback command is sent to the upstream module corresponding to the address translation command with the determined physical address. The embodiment of the present application writes the address translation command into different cache queues according to different hit results. On the one hand, the address translation commands in different cache queues can be processed in parallel to improve the address translation efficiency; on the other hand, each cache queue can cache the address translation commands corresponding to multiple cache lines, which reduces the probability of the translation backup buffer back-pressure upstream caused by uneven cache line hits, and improves the address translation performance of the translation backup buffer.
[0019] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and do not limit the technical solutions of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings are embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0021] Figure 1 A schematic diagram of the system architecture of an address translation method in related technology.
[0022] Figure 2 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 1 ;
[0023] Figure 3 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 2 ;
[0024] Figure 4 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 3 ;
[0025] Figure 5 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 4 ;
[0026] Figure 6 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 5 ;
[0027] Figure 7A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 6 ;
[0028] Figure 8 A schematic diagram of the system architecture of the address translation method provided in an embodiment of the present application;
[0029] Fig. 9 A schematic diagram of an address translation device provided in an embodiment of the present application;
[0030] Fig.10 A hardware entity diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0032] It should be understood that the "embodiment of the present application" or "the aforementioned embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in the embodiment of the present application" or "in the aforementioned embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. In the various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments.
[0033] In addition, the accompanying drawings are only schematic illustrations of embodiments of the present application and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated descriptions will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0034] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit the present disclosure. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0035] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present disclosure, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0036] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing this application and are not intended to limit this application.
[0037] At present, computer software usually uses virtual address addressing on logical storage space for software programming, but the actual commands and data are kept in the physical address on the physical space, and the translation lookaside buffer in the memory management unit is needed to perform high-speed conversion from virtual address to physical address to obtain the actual commands and data. The circuits usually involved in address translation include a memory address management unit and a translation lookaside buffer; both the memory address management unit and the translation lookaside buffer can complete the conversion operation between physical address and virtual address, wherein the memory address management unit reads the mapping table from the memory to realize the address translation, and the lookaside buffer reads the mapping table from the internal cache to realize the address translation.
[0038] Figure 1 Schematic diagram of the system architecture of the address translation method of the related technology. Figure 1 As shown, a system 100 of an address translation method in the related art includes a hit check 101 , a cache line allocation 102 , a queue cache 103 , a queue arbitration 104 and a command output 105 .
[0039] Among them, the hit check 101 is used to check whether the address translation command hits the cache line in the translation backup buffer. The cache line allocation 102 is used to allocate cache lines for address translation commands that do not hit cache lines. The queue cache 103 is used to cache information such as the address translation commands and access times corresponding to each cache line. The queue arbitration 104 is used to determine the order in which each queue of the queue cache 103 outputs information. The command output 105 is used to assemble and output the information determined to be output by the queue arbitration 104 (including the address translation command and the physical address corresponding to the virtual address in the address translation command).
[0040] When the address translation method in the related art is implemented by the system 100, firstly, a local page table query is performed in the translation backup buffer through the hit check 101. When the address translation command and the cache of the translation backup buffer have the same virtual address, no matter whether the physical address corresponding to the virtual address is ready, the address translation command is considered to hit the cache line. In the case that the address translation command does not hit the cache line, a cache line is allocated for the address translation command through the cache line allocation 102, and the access demand of the next level of memory is initiated. The queue cache 103 provides a queue for each cache line, and the queue records the address translation command in the corresponding cache line and the number of times the cache line is accessed. When the cache space of the queue is full, the corresponding cache line still has a new address translation command, and the address translation command cannot be processed at that time. The translation backup buffer will back pressure the upstream, resulting in a loss of address translation performance.
[0041] In summary, during the process of querying the physical address through the translation lookaside buffer, when the hits of various cache lines are uneven, the translation lookaside buffer may backpressure the upstream, affecting the address translation performance of the translation lookaside buffer.
[0042] Based on the above problems, an embodiment of the present application proposes an address translation method, which writes address translation commands into different cache queues according to different hit results. On the one hand, address translation commands in different cache queues can be processed in parallel, thereby improving address translation efficiency; on the other hand, each cache queue can cache address translation commands corresponding to multiple cache lines, thereby reducing the probability of the translation backup buffer back-pressured upstream due to uneven cache line hits, thereby improving the address translation performance of the translation backup buffer.
[0043] Figure 2 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 1 .like Figure 2 As shown, it is applied to an address translation device, the address translation device includes at least two cache queues, and the address translation method includes at least steps S201 to S203.
[0044] Step S201: In response to receiving an address translation command sent by an upstream module, a hit check is performed based on a virtual address carried in the address translation command to obtain a hit result.
[0045] In an embodiment of the present application, after the address translation device receives the address translation command from the upstream module, it can first determine whether the address translation command hits the cache line in the translation backup buffer based on the virtual address carried by the address translation command to determine the hit result of the address translation command.
[0046] Here, the upstream module can be a central processing unit (CPU) or a data processing unit (DPU), and the upstream module can be applied to any suitable computer device, and the computer device can be a server, a laptop, a tablet computer, a desktop computer, etc., which has data processing capabilities. The address translation command refers to a command for determining a physical address by carrying a virtual address. It is understandable that different address translation commands may come from different upstream modules.
[0047] Among them, the physical address refers to the actual memory address in the computer, which can directly correspond to the storage location on the random access memory (RAM) in the computer hardware. The virtual address refers to the virtual address space created by the computer operating system for each process. The physical address and virtual address are mapped through the memory management unit.
[0048] Among them, the hit check refers to checking whether the same virtual address is cached in the cache line in the translation lookaside buffer according to the virtual address carried by the address translation command, and can also be understood as whether the address translation command hits the cache line in the translation lookaside buffer. In some embodiments, the translation lookaside buffer can be queried according to the virtual address carried in the address translation command, and when the virtual address cached in a cache line in the translation lookaside buffer is the same as the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command hits the corresponding cache line; when the virtual address cached in each cache line in the translation lookaside buffer is different from the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command does not hit the cache line.
[0049] Taking the upstream module as a central processing unit as an example, the page number (Virtual Page Number, VPN) of the virtual address carried by the address translation command sent by the central processing unit can be first determined through the address translation device, and then the cache line matching the page number of the virtual address is searched in the translation lookaside buffer. When the cache line in the translation lookaside buffer contains the same page number as the virtual address, a hit result is generated indicating that the address translation command hits the corresponding cache line; when none of the cache lines in the translation lookaside buffer contains the same page number as the virtual address, a hit result is generated indicating that the address translation command misses the cache line.
[0050] Step S202: Write the address translation command into the cache queue corresponding to the hit result, and determine the physical address corresponding to the virtual address.
[0051] In some embodiments, after determining the hit result of the address translation command in the translation lookaside buffer, the address translation command can be written into different cache queues according to different hit results, and corresponding processing can be performed in each cache queue to determine the physical address corresponding to the address translation command.
[0052] Here, the cache queue refers to a data structure used to cache and process address translation commands and related information.
[0053] In some embodiments, corresponding to at least two different hit results, at least two cache queues may be set to cache different address translation commands corresponding to different hit results. The at least two cache queues may include a first cache queue and a second cache queue. The first cache queue is used to cache address translation commands that hit cache lines; the second cache queue is used to cache address translation commands that miss cache lines.
[0054] In some embodiments, at least two cache queues may further include a third cache queue. In the case where the address translation command hits the cache line, if the first cache queue is not full, the address translation command is written to the first cache queue; if the first cache queue is full, the address translation command is written to the third cache queue. In the case where the address translation command does not hit the cache line, if the second cache queue is not full, the address translation command is written to the second cache queue; if the second cache queue is full, the address translation command is written to the third cache queue. In some embodiments, the cache line hit by the address translation command in the first cache queue may contain a physical address corresponding to the virtual address in the address translation command, or may not contain a physical address corresponding to the virtual address in the address translation command. If the cache line hit by the address translation command contains a physical address corresponding to the virtual address in the address translation command, the physical address corresponding to the virtual address can be determined based on the cached information in the cache line hit by the address translation command; if the cache line hit by the address translation command contains a physical address corresponding to the virtual address in the address translation command, the address translation command can be sent to a memory address management unit to perform a page table query through the memory address management unit, so as to determine the physical address corresponding to the virtual address in the address translation command based on the mapping relationship between the physical address and the virtual address in the page table.
[0055] In some embodiments, the address translation commands in the second cache queue and the third cache queue can be sent to the memory address management unit to perform a page table query through the memory address management unit, thereby determining the physical address corresponding to the virtual address in the address translation command according to the mapping relationship between the physical address and the virtual address in the page table.
[0056] In some embodiments, at least two cache queues may further include other cache queues. In the case where an address translation command hits a cache line, if the physical address corresponding to the virtual address in the address translation command is already prepared in the cache line that hits, the address translation command is written into the first cache queue; if the physical address corresponding to the virtual address in the address translation command is not already prepared in the cache line that hits, the address translation command is written into other cache queues. The address translation command in the first cache queue can determine the physical address corresponding to the virtual address based on the information cached in the cache line that hits; the address translation commands in other cache queues can be sent to a memory address management unit to perform a page table query through the memory address management unit, thereby determining the physical address corresponding to the virtual address in the address translation command based on the mapping relationship between the physical address and the virtual address in the page table.
[0057] Taking other cache queues as an example, address translation commands can be sent to the memory address management unit in the order in which the address translation commands are written into other cache queues. The address translation command written into other cache queues first is sent to the memory address management unit first to determine the physical address corresponding to the virtual address in the address translation command.
[0058] Taking the upstream module as the central processing unit as an example, after the address translation device sends the address translation command to the memory address management unit, the central processing unit can first obtain the page directory index of the virtual address, access the page directory according to the page directory index, and thus determine the corresponding page table entry (Page Table Entry, PTE), and finally extract the physical address corresponding to the virtual address from the page table entry.
[0059] After reading the page table entry, you need to check the valid bit of the page table entry. If the valid bit is 1, it means that the virtual page represented by the virtual address has been cached in the physical memory, and the address field will point to the location of the physical page; if the valid bit is 0, it means that the page table entry does not contain mapping information, and page replacement or page fault exception is required. After the page fault exception is triggered, a physical page will be selected in the physical memory to overwrite, and the physical memory and page table entry will be updated.
[0060] The above-mentioned embodiment writes the address translation command into different cache queues according to different hit results. On the one hand, the address translation commands in different cache queues can be processed in parallel, thereby improving the address translation efficiency. On the other hand, each cache queue can cache the address translation commands corresponding to multiple cache lines. Compared with the one-to-one correspondence between cache queues and cache lines in the related art, which results in a certain cache line being unable to process the address translation command after being hit a certain number of times, thereby causing the translation backup buffer to be back-pressured upstream, the present embodiment reduces the probability of the translation backup buffer being back-pressured upstream due to uneven cache line hits, thereby improving the address translation performance of the translation backup buffer.
[0061] Step S203: selecting an address translation command with a determined physical address between the at least two cache queues according to an arbitration order, and sending a corresponding address feedback command to an upstream module corresponding to the address translation command with a determined physical address.
[0062] In some embodiments, after different address translation commands are written into different cache queues according to different hit results, the queue for outputting the address translation command can be selected according to a preset arbitration order. Outputting the address translation command refers to sending the address translation command to a command output module, so that the command output module assembles the address translation command and other data to generate an address feedback command.
[0063] Here, the address feedback command may include an address translation command, a virtual address carried by the address translation command and a corresponding physical address, and other information of the address translation command.
[0064] In some embodiments, the arbitration order may include the output order of different cache queues, and the output order may be determined by the output priority of each cache queue. Exemplarily, taking at least two cache queues including a first cache queue, a second cache queue and a third cache queue as an example, the output priority of the third cache queue may be higher than that of the first cache queue and the second cache queue, and the output priority of the second cache queue may be higher than that of the first cache queue. It is understandable that the arbitration order between the first cache queue, the second cache queue and the third cache queue may also be set according to actual needs, for example, the output priority of the first cache queue may be higher than that of the second cache queue and the third cache queue, and the output priority of the second cache queue may be higher than that of the third cache queue.
[0065] Taking the example that the output priority of the third cache queue is higher than that of the first cache queue and the second cache queue, and the output priority of the second cache queue is higher than that of the first cache queue, when there is an address translation command with a determined physical address in the third cache queue, the address feedback command is determined based on the address translation command with a determined physical address in the third cache queue; when there is no address translation command with a determined physical address in the third cache queue, the address feedback command is determined based on the address translation command with a determined physical address in the second cache queue; when there is no address translation command with a determined physical address in both the second cache queue and the third cache queue, the address feedback command is determined based on the address translation command with a determined physical address in the first cache queue.
[0066] In some embodiments, the arbitration order may include the output order of different address translation commands in the cache queue, and the output order may be determined by the output priority of each address translation command. Exemplarily, among the address translation commands with determined physical addresses in the cache queue, the output priority may be determined according to the order in which the address translation commands enter the cache queue, and the address translation command that first enters the cache queue has the highest output priority. Taking the first cache queue as an example, first, the address translation commands with determined physical addresses may be screened out from each address translation command, and then the address translation command closest to the head of the first cache queue may be determined from the address translation commands with determined physical addresses to determine the address feedback command.
[0067] In some embodiments, in the process of determining the physical address corresponding to the virtual address in the address translation command, it can be determined in sequence according to the order in which the address translation commands are written to the cache queue. The address translation command that enters the cache queue first determines the physical address corresponding to the virtual address first. After determining the physical address, the address translation command can be output first. Therefore, the arbitration order of the address translation commands with determined physical addresses in the second cache queue can be consistent with the order in which the address translation commands enter the second cache queue.
[0068] In some embodiments, the arbitration order may include both the output priorities of different cache queues and the output priorities of different address translation commands in the cache queues. The output priorities of different cache queues may be determined first, and after the cache queue with the highest output priority is determined, the output priorities of different address translation commands in the cache queue are determined, and the address translation command with the highest priority is output. Taking the output priority of the third cache queue as an example, which is higher than that of the first cache queue and the second cache queue, when there are address translation commands with determined physical addresses in the third cache queue, the address translation commands with determined physical addresses in the third cache queue are output first, and in the third cache queue, the address translation commands that first enter the third cache queue among the address translation commands with determined physical addresses are output first.
[0069] Taking the case where the upstream module corresponding to the address translation command of the determined physical address is the central processing unit as an example, after determining the address feedback command, the address feedback command can be sent to the central processing unit to complete the translation of the virtual address and the physical address. It is understandable that different address translation commands may come from different upstream modules, and when returning the address feedback command determined according to the address translation command to the upstream module, the address feedback command should be sent to the upstream module corresponding to the address translation command corresponding to the address feedback command.
[0070] The above embodiment outputs the address translation commands of the determined physical addresses in each cache queue according to the arbitration order, thereby reducing the situation where the address access commands of the determined physical addresses in each cache queue are output simultaneously and causing task congestion, thereby reducing the probability of the translation backup buffer back-pressure upstream.
[0071] It should be noted that in the scenario of implementing address translation, the upstream module can generate address translation commands according to the operator's address translation requirements. Corresponding to the operator's different address translation requirements, the generation frequency of different address translation commands is different, and accordingly, the probability of each cache line being hit is also different. If the hits of each cache line are uneven (that is, the hit rate of some cache lines is high), when the number of address translation commands stored in the queue corresponding to some cache lines reaches the upper limit, the address translation commands corresponding to the cache line cannot be processed further, and the translation backup buffer will back pressure the upstream, resulting in a loss of address translation performance.
[0072] The embodiment of the present application writes address translation commands into different cache queues according to different hit results. On the one hand, address translation commands in different cache queues can be processed in parallel, thereby improving address translation efficiency. On the other hand, each cache queue can cache address translation commands corresponding to multiple cache lines, thereby reducing the probability of the translation backup buffer back-pressured upstream due to uneven cache line hits, thereby improving the address translation performance of the translation backup buffer.
[0073] Figure 3 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 2 .like Figure 3 As shown, the at least two cache queues include a first cache queue; based on Figure 2 , Figure 2 Step S202 in the method may include step S301 and step S303.
[0074] Step S301: When the hit result is a hit, write the address translation command into the first cache queue.
[0075] Here, the hit result may include a hit and a miss, and different cache queues may be set for address translation commands corresponding to different hit results. Here, setting the first cache queue for a hit address translation command is taken as an example for explanation.
[0076] In some embodiments, the hit result of the address translation command can be determined by a hit check. For example, a query can be performed in the translation lookaside buffer according to the virtual address carried in the address translation command, and when the virtual address cached in a certain cache line in the translation lookaside buffer is the same as the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command hits the corresponding cache line; when the virtual address cached in each cache line in the translation lookaside buffer is different from the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command does not hit the cache line.
[0077] In step S301, the address translation command that hits the cache line can be written into the first cache queue, and the address translation command can be cached and processed by the first cache queue. For example, the first cache queue can be created through the queue service, and the address translation command that hits the cache line can be sent to the first cache queue using the interface provided by the queue service, so that the address translation command can be cached and processed by the first cache queue.
[0078] Exemplarily, when an address translation command that hits a cache line is written into the first cache queue, the address translation command is added to the end of the first cache queue. The address translation command written into the first cache queue can be scheduled to the corresponding processing unit and executed according to the first-in-first-out principle. After the processing unit completes the processing of the address translation command, the result can be returned to the upstream module, and the address translation command can be removed from the first cache queue.
[0079] If an address translation command fails to be executed in a corresponding processing unit, the address translation command may be re-added to the end of the first cache queue for re-execution.
[0080] Step S302: when the physical address corresponding to the virtual address carried by the address translation command exists in the first cache queue, determine the physical address corresponding to the virtual address through the cache line corresponding to the address translation command in the first cache queue.
[0081] Here, the cache line corresponding to the address translation command refers to the cache line hit by the address translation command.
[0082] It is understandable that the first cache queue caches address translation commands that hit cache lines, and the cache lines hit by each address translation command may or may not cache information such as the virtual address and the corresponding physical address.
[0083] In some embodiments, when a physical address exists in a cache line hit by an address translation command, the physical address corresponding to the virtual address carried by the corresponding address translation command can be directly determined according to information in the cache line.
[0084] Step S303: If the physical address corresponding to the virtual address carried by the address translation command does not exist in the first cache queue, send the address translation command to the memory address management unit, and determine the physical address corresponding to the virtual address through the memory address management unit.
[0085] In some embodiments, when there is no physical address in the cache line hit by the address translation command, the address translation command can be sent to the memory address management unit to perform a page table query through the memory address management unit, so as to determine the physical address corresponding to the virtual address in the address translation command according to the mapping relationship between the physical address and the virtual address in the page table.
[0086] The embodiment of the present application introduces a first cache queue to cache address translation commands that hit cache lines, so that address translation commands that hit cache lines in the first cache queue and address translation commands in other cache queues can be processed in parallel through different strategies, thereby improving the address translation efficiency of the translation backup buffer.
[0087] In some embodiments, the depth of the first cache queue is greater than the number of cache lines in the translation backup buffer. Here, the depth of the first cache queue refers to the number of elements that can be accommodated in the first cache queue. Among them, the elements can be composed of cache line information and related information of the address translation command corresponding to the cache line. For example, the depth of the first cache queue can be four times the number of cache lines or an integer multiple of the number of other cache lines. In the process of implementing address translation in related technologies, the translation backup buffer provides a queue for each cache line, and each queue can only store the address translation command corresponding to one cache line. When the cache lines are hit unevenly, it is easy for the number of address translation commands stored in the queue corresponding to a cache line to reach the upper limit, so that the translation backup buffer cannot continue to process the address translation command corresponding to the cache line, and the translation backup buffer will back pressure the upstream.
[0088] Compared with the address translation method in the related art, the first cache queue of the embodiment of the present application can cache more address translation commands corresponding to different cache lines or more address translation commands corresponding to the same cache line, thereby reducing the probability of the translation backup buffer back-pressure upstream caused by uneven cache line hits and improving the address translation performance of the translation backup buffer.
[0089] For example, in the case of uneven cache line hits, if a queue is provided for each cache line according to the address translation method in the related art, each queue can store up to 20 address translation commands. After a cache line is hit 20 times, the queue corresponding to the cache line has stored 20 address translation commands that hit the cache line, and the capacity limit has been reached. At this time, the new address translation command corresponding to the cache line cannot be processed, and the translation backup buffer will back pressure the upstream.
[0090] In an embodiment of the present application, the depth of the first cache queue can be an integer multiple of the number of cache lines in the translation lookaside buffer. In the case of uneven cache line hits, after a cache line is hit 20 times, as long as the space in the first cache queue is not full, the address translation command corresponding to the cache line can still be processed, thereby reducing the probability of the translation lookaside buffer back pressure upstream caused by uneven cache line hits and improving the address translation performance of the translation lookaside buffer.
[0091] Figure 4 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 3 .like Figure 4 As shown, the at least two cache queues include a second cache queue; based on Figure 2 , Figure 2 Step S202 in the method may include step S401 and step S402.
[0092] Step S401 : when the hit result is a miss, allocate a cache line for the address translation command and write the address translation command to which the cache line has been allocated into the second cache queue.
[0093] Here, the hit result may include a hit and a miss, and different cache queues may be set for address translation commands corresponding to different hit results. Here, setting a second cache queue for an address translation command that misses is taken as an example for explanation.
[0094] In some embodiments, the hit result of the address translation command can be determined by a hit check. Exemplarily, a query can be performed in the translation lookaside buffer according to the virtual address carried in the address translation command, and when the virtual address cached in a cache line in the translation lookaside buffer is the same as the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command hits the corresponding cache line; when the virtual address cached in each cache line in the translation lookaside buffer is different from the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command does not hit the cache line.
[0095] Next, a new cache line may be allocated for the address translation command of the cache line that missed, and the address translation command is written into the second cache queue, and the address translation command is cached and processed by the second cache queue. Exemplarily, the second cache queue may be created through the queue service, and the address translation command of the cache line that missed is sent to the second cache queue using the interface provided by the queue service, so that the address translation command is cached and processed by the second cache queue.
[0096] In some embodiments, when a new cache line cannot be allocated for an address translation command that misses a cache line, a new cache queue can be set up to store address translation commands that miss a cache line and are not allocated a cache line into the new cache queue and process them differently from the address translation commands in the second cache queue.
[0097] Step S402: Send the address translation command to a memory address management unit, and determine the physical address corresponding to the virtual address through the memory address management unit.
[0098] In some embodiments, the address translation command of the cache line that is not hit in the second cache queue can be sent to the memory address management unit to perform a page table query through the memory address management unit, so as to determine the physical address corresponding to the virtual address in the address translation command according to the mapping relationship between the physical address and the virtual address in the page table. After querying the physical address corresponding to the virtual address in the address translation command, the address translation command, the virtual address carried by the address translation command, and the physical address corresponding to the virtual address can be cached in the cache line allocated for the address translation command to facilitate the subsequent translation of the same virtual address.
[0099] In an embodiment of the present application, in the case where the cache in the second cache queue is an address translation command of an allocated cache line, the depth of the second cache queue can be the same as the number of cache lines in the translation lookaside buffer to cache more address translation commands of the allocated cache lines. In some embodiments, the depth of the second cache queue can also be greater than the number of cache lines in the translation lookaside buffer, and the specific situation can be determined according to actual needs. Here, the depth of the second cache queue refers to the number of elements that can be accommodated in the second cache queue.
[0100] For example, if there are 100 cache lines in the translation lookaside buffer, which may include occupied cache lines and cache lines available for allocation, it is understandable that when all cache lines are not occupied, the translation lookaside buffer may include 100 cache lines available for allocation, and accordingly, according to the above embodiment, the depth of the second cache queue may be the same as the number of cache lines in the translation lookaside buffer, and the number of elements that can be accommodated in the second cache line is 100.
[0101] For example, if there are 100 cache lines available for allocation in the translation backup buffer, if there are 120 address translation commands that miss the cache lines, then after allocating cache lines to the 100 address translation commands that miss the cache lines respectively, the 100 address translation commands can be written into the second cache queue. The 20 address translation commands other than the 100 allocated cache lines cannot be allocated cache lines, and therefore cannot be written into the second cache queue corresponding to the address translation commands that have been allocated cache lines.
[0102] In summary, when the depth of the second cache queue is the same as the number of cache lines in the translation lookaside buffer, all address translation commands of cache lines that have been allocated among address translation commands that miss cache lines can be written into the second cache queue.
[0103] The embodiment of the present application introduces a second cache queue to cache address translation commands that miss cache lines, so that address translation commands that hit cache lines in the first cache queue and address translation commands that miss cache lines in the second cache queue can be processed in parallel through different strategies, thereby improving the address translation efficiency of the translation backup buffer.
[0104] Figure 5 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 4 .like Figure 5 As shown, the at least two cache queues include a first cache queue and a second cache queue; based on Figure 2 , Figure 2 Step S203 in the method may include steps S501 to S502.
[0105] Step S501: when the address translation command with the determined physical address exists in the second cache queue, determine the address feedback command according to the address translation command with the determined physical address in the second cache queue.
[0106] In some embodiments, address translation commands corresponding to different hit results can be written into different cache queues. For example, the first cache queue can be used to cache address translation commands that hit the cache line, and can also be used to cache address translation commands that miss the cache line; when the first cache queue is used to cache address translation commands that hit the cache line, the second cache queue can be used to cache address translation commands that miss the cache line.
[0107] In some embodiments, the hit result of the address translation command can be determined by a hit check. Exemplarily, a query can be performed in the translation lookaside buffer according to the virtual address carried in the address translation command, and when the virtual address cached in a cache line in the translation lookaside buffer is the same as the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command hits the corresponding cache line; when the virtual address cached in each cache line in the translation lookaside buffer is different from the virtual address carried in the address translation command, a hit result is generated indicating that the address translation command does not hit the cache line.
[0108] After different address translation commands are written into different cache queues according to different hit results, the queue for outputting the address translation command can be selected according to a preset arbitration order. Outputting the address translation command refers to sending the address translation command to the command output module, so that the command output module assembles the address translation command and other data to generate an address feedback command.
[0109] The address feedback command may be a command composed of information such as an address translation command, a virtual address carried by the address translation command and a corresponding physical address, and other information of the address translation command.
[0110] The following is an explanation of the second cache queue being used to cache the address translation commands of cache line misses. In some embodiments, the address translation commands in the second cache queue can be sent to the memory address management unit to perform a page table query through the memory address management unit to determine the physical address corresponding to the virtual address in the address translation command.
[0111] In some embodiments, the arbitration order may include the output order of different cache queues, and the output order may be determined by the output priority of each cache queue. For example, taking at least two cache queues including a first cache queue and a second cache queue as an example, the output priority of the second cache queue may be higher than that of the first cache queue, that is, when there is an address translation command with a determined physical address in the second cache queue, the address translation command with a determined physical address in the second cache queue is output first.
[0112] In some embodiments, the arbitration order may include the output order of different address translation commands in the cache queue, and the output order may be determined by the output priority of each address translation command. For example, among the address translation commands whose physical addresses have been determined in the second cache queue, the output priority may be determined according to the order in which the address translation commands enter the second cache queue, and the address translation command that enters the second cache queue first has the highest output priority.
[0113] Step S502: when the address translation command with the determined physical address does not exist in the second cache queue, determine the address feedback command according to the address translation command with the determined physical address in the first cache queue.
[0114] The following description is given by assuming that the first cache queue is used to cache address translation commands that hit the cache line, and the second cache queue is used to cache address translation commands that miss the cache line.
[0115] In some embodiments, the output priority of the second cache queue is higher than that of the first cache queue.
[0116] In some embodiments, the address translation command that hits the cache line in the first cache queue may have two data preparation conditions: the corresponding physical address exists in the cache line hit by the address translation command or the corresponding physical address does not exist in the cache line hit by the address translation command. If the corresponding physical address does not exist in the cache line hit by the address translation command, the physical address corresponding to the virtual address in the address translation command can be directly determined based on the information in the cache line; if the corresponding physical address does not exist in the cache line hit by the address translation command, the address translation command can be sent to the memory address management unit to perform a page table query through the memory address management unit to determine the physical address corresponding to the virtual address in the address translation command.
[0117] In some embodiments, the arbitration order may include the output order of different cache queues, and the output order may be determined by the output priority of each cache queue. Exemplarily, taking at least two cache queues including a first cache queue and a second cache queue as an example, the output priority of the second cache queue may be higher than that of the first cache queue. That is, when there is an address translation command with a determined physical address in the second cache queue, the address translation command with a determined physical address in the second cache queue is output first; when there is no address translation command with a determined physical address in the second cache queue, the address translation command with a determined physical address in the first cache queue is output.
[0118] In some embodiments, the arbitration order may include the output order of different address translation commands in the cache queue, and the output order may be determined by the output priority of each address translation command. For example, among the address translation commands whose physical addresses have been determined in the first cache queue, the output priority may be determined according to the order in which the address translation commands enter the first cache queue, and the address translation command that enters the first cache queue first has the highest output priority.
[0119] The embodiment of the present application sets the arbitration order of the first cache queue and the second cache queue and the arbitration order of the address translation commands therein, so as to output the address translation commands for determining the physical address in sequence according to the arbitration order, thereby reducing the situation where the address translation commands are output simultaneously and causing task congestion, and improving the address translation performance of the translation backup buffer.
[0120] Figure 6 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 5 .like Figure 6 As shown, the at least two cache queues also include a third cache queue; the address translation method at least includes steps S601 to S602.
[0121] Step S601: When the cache queue corresponding to the hit result is full, write the address translation command into the third cache queue.
[0122] In some embodiments, when there are too many address translation commands and the existing cache queue space is filled up, in order to reduce the situation where the cache queue is full and cannot process subsequent address translation commands, causing the translation backup buffer to be back-pressured upstream, a new cache queue can be introduced to cache or process subsequent address translation commands. The embodiment of the present application introduces a third cache queue.
[0123] In some embodiments, the hit result may include a hit and a miss, and the cache queue corresponding to the hit result may include a first cache queue and a second cache queue, the first cache queue may be used to cache the address translation command that hits the cache line, and the second cache queue may be used to cache the address translation command that misses the cache line. In some embodiments, the hit result of the address translation command may be determined by a hit check. Exemplarily, a query may be performed in the translation lookaside buffer according to the virtual address carried in the address translation command, and when the virtual address cached in a cache line in the translation lookaside buffer is the same as the virtual address carried in the address translation command, a hit result representing that the address translation command hits the corresponding cache line is generated; when the virtual address cached in each cache line in the translation lookaside buffer is different from the virtual address carried in the address translation command, a hit result representing that the address translation command misses the cache line is generated.
[0124] In some embodiments, when the cache queue corresponding to the hit result is not full, the address translation command is written into the cache queue corresponding to the hit result. The cache queue corresponding to the hit result includes a first cache queue and a second cache queue. After determining the hit result of the address translation command, when the first cache queue is not full, the address translation command of the hit cache line can be written into the first cache queue; when the second cache queue is not full, the address translation command of the miss cache line can be written into the second cache queue. The cache queue is not full means that the number of elements in the cache queue is less than the maximum capacity of the cache queue.
[0125] In some embodiments, when the cache queue corresponding to the hit result is full, the address translation command is written into a third cache queue outside the cache queue corresponding to the hit result. For example, when the first cache queue is full, the address translation command of the hit cache line can be written into the third cache queue; when the second cache queue is full, the address translation command of the miss cache line can be written into the third cache queue. The cache queue is full means that the number of elements in the cache queue is equal to the maximum capacity of the cache queue.
[0126] In some embodiments, when the second cache queue is not full and a cache line cannot be allocated for an address translation command that misses a cache line, the address translation command that misses a cache line and has no cache line allocated can be written into a third cache queue, and the address translation command is cached and processed by the third cache queue. Exemplarily, a third cache queue can be created through a queue service, and an interface provided by the queue service can be used to send the address translation command that misses a cache line to the third cache queue, so that the address translation command is cached and processed by the third cache queue.
[0127] Step S602: Send the address translation command to a memory address management unit, and determine the physical address corresponding to the virtual address through the memory address management unit.
[0128] In some embodiments, when the cache queue corresponding to the hit result is full, in order to prevent the accumulation of address translation commands in each cache queue and cause the translation backup buffer to back pressure upstream, the address translation commands in the third cache queue can be directly sent to the memory address management unit for processing.
[0129] In some embodiments, after the address translation command is written into the third cache queue, the address translation command can be sent to the memory address management unit to perform a page table query through the memory address management unit, thereby determining the physical address corresponding to the virtual address in the address translation command based on the mapping relationship between the physical address and the virtual address in the page table.
[0130] In some embodiments, in the cache queue corresponding to the hit result and the third cache queue, the address translation command of the determined physical address is selected according to the arbitration order.
[0131] In some embodiments, after the address translation command in the third cache queue determines the physical address, the address translation command in the cache queue corresponding to the hit result and with the determined physical address is output according to a preset arbitration order.
[0132] In some embodiments, step S603 and step S604 may be used to select the address translation command of the determined physical address from the cache queue corresponding to the hit result and the third cache queue according to the arbitration order.
[0133] Step S603: when there is an address translation command with the determined physical address in the third cache queue, determine the address feedback command according to the address translation command with the determined physical address in the third cache queue.
[0134] In some embodiments, after different address translation commands are written into different cache queues, a queue for outputting address translation commands can be selected according to a preset arbitration order. Outputting address translation commands refers to sending address translation commands to a command output module, so that the command output module assembles the address translation commands and other data to generate an address feedback command.
[0135] The address feedback command may be a command composed of information such as an address translation command, a virtual address carried by the address translation command and a corresponding physical address, and other information of the address translation command.
[0136] In some embodiments, the arbitration order may include the output order of different cache queues, and the output order may be determined by the output priority of each cache queue. For example, taking at least two cache queues including a cache queue corresponding to a hit result and a third cache queue as an example, the output priority of the third cache queue may be higher than the cache queue corresponding to the hit result. That is, when there is an address translation command with a determined physical address in the third cache queue, the address translation command with a determined physical address in the third cache queue is output first.
[0137] In some embodiments, the arbitration order may include the output order of different address translation commands in the cache queue, and the output order may be determined by the output priority of each address translation command. Exemplarily, among the address translation commands whose physical addresses have been determined in the third cache queue, the output priority may be determined according to the order in which the address translation commands enter the third cache queue, and the address translation command that enters the third cache queue first has the highest output priority.
[0138] Step S604: when there is no address translation command with the determined physical address in the third cache queue, determine the address feedback command according to the address translation command with the determined physical address in the cache queue corresponding to the hit result.
[0139] In some embodiments, the arbitration order may include the output order of different cache queues, and the output order may be determined by the output priority of each cache queue. Taking the output priority of the third cache queue being higher than that of the cache queue corresponding to the hit result as an example, when there is no address translation command with a determined physical address in the third cache queue, the address translation command with a determined physical address in the cache queue corresponding to the hit result is output first. Taking the hit result including the first cache queue and the second cache queue, and the output priority of the second cache queue being higher than that of the first cache queue as an example, when there is an address translation command with a determined physical address in the second cache queue, the address translation command with a determined physical address in the second cache queue is output first; when there is no address translation command with a determined physical address in the second cache queue, the address translation command with a determined physical address in the first cache queue is output.
[0140] In some embodiments, the arbitration order may include the output order of different address translation commands in the cache queue, and the output order may be determined by the output priority of each address translation command. For example, among the address translation commands whose physical addresses have been determined in the second cache queue, the output priority may be determined according to the order in which the address translation commands enter the second cache queue, and the address translation command that enters the second cache queue first has the highest output priority.
[0141] The embodiment of the present application introduces a third cache queue to cache and process the address translation commands that cannot be cached in the first cache queue and the second cache queue, thereby reducing the situation where a large number of address translation commands cause the translation backup buffer to back pressure upstream. In addition, the address translation commands in the third cache queue, the first cache queue, and the second cache queue can be processed in parallel, thereby improving the processing efficiency of the address translation commands. In addition, by setting the arbitration order of the third cache queue, the first cache queue, and the second cache queue, the address translation commands that determine the physical address are output in sequence according to the arbitration order, thereby reducing the situation where the address translation commands are output simultaneously, resulting in task congestion, thereby improving the address translation performance of the translation backup buffer.
[0142] Figure 7 A schematic diagram of an implementation process of an address translation method provided in an embodiment of the present application Figure 6 .like Figure 7 As shown, the at least two cache queues also include an information recording queue; the address translation method at least includes step S701 and step S702.
[0143] Step S701: when the address translation command is written into the first cache queue, write the correspondence between the address translation command and the cache line in the first cache queue and the determination of the physical address in the cache line corresponding to the address translation command into the information recording queue.
[0144] In some embodiments, the first cache queue can be used to cache address translation commands that hit cache lines. Correspondingly, the information recording queue can be used to cache relevant information of the address translation commands in the first cache queue, for example, the correspondence between the address translation commands in the first cache queue and the cache lines and the determination of the physical addresses in the cache lines corresponding to the address translation commands can be cached.
[0145] Among them, the address translation command hits the cache line means that there is a virtual address identical to the address translation command in the cache line of the translation backup buffer. The cache line corresponding to the address translation command in the first cache queue refers to the cache line hit by the address translation command. The determination of the physical address in the cache line corresponding to the address translation command includes determined and undetermined. When the physical address corresponding to the virtual address is cached in the cache line hit by the address translation command, the physical address is considered to be determined; when the physical address corresponding to the virtual address is not cached in the cache line hit by the address translation command, the physical address is considered to be undetermined.
[0146] Optionally, the relevant information of the address translation command in the first cache queue may further include the generation time of the address translation command, the upstream module sending the address translation command, and the like.
[0147] Step S702: Determine the address translation command of the determined physical address in the first cache queue through the information recording queue.
[0148] In some embodiments, the address translation device needs to return the address translation command with the determined physical address in the first cache queue to the upstream module. The information recording queue can cache the determination of the physical address in the cache line corresponding to each address translation command in the first cache queue, so the address translation command with the determined physical address in the first cache queue can be determined based on the information cached in the information recording queue.
[0149] The embodiment of the present application sets an information recording queue to record relevant information of the address translation command in the first cache queue, so that the address translation device determines the address translation command of the determined physical address according to the information in the information recording queue, thereby improving the address translation efficiency of the translation backup buffer.
[0150] The following describes the application of the address translation method provided in the embodiment of the present application in a practical scenario.
[0151] In the process of implementing the conversion from virtual address to physical address in the related technology, there are the following problems:
[0152] When performing a page table query locally through the translation lookaside buffer, if the virtual address corresponding to the address translation command is accessed in the cache, the address translation command is considered to hit the cache line, and a cache line will be allocated for the address translation command that does not hit the cache line to retrieve the corresponding physical address from the memory. In this process, the translation lookaside buffer will allocate a corresponding queue for each cache line. The queue can record the virtual address carried by the address translation command in the corresponding cache line, other information of the address translation command, and the number of cache line accesses. When the number of accesses to the same cache line reaches the upper limit and the corresponding queue has no remaining space, the new address translation command cannot be processed, and the translation lookaside buffer will back pressure the upstream.
[0153] Based on the above problems, the embodiment of the present application introduces multiple cache queues so that address translation commands with different hit situations enter different cache queues. On the one hand, the address translation commands in different cache queues can be processed in parallel to improve the address translation efficiency; on the other hand, each cache queue can cache the address translation commands corresponding to multiple cache lines, thereby reducing the probability of the translation backup buffer back-pressured upstream due to uneven cache line hits, and improving the address translation performance of the translation backup buffer.
[0154] The address translation method in the embodiment of the present application can be applied to an address translation device and a computer device, or to a hardware system or device configured with an address translation device or a computer device. In the implementation process of the address translation method in the embodiment of the application, the computer device and the address translation device can be as follows: Figure 8 The system 800 shown is not specifically limited in this application.
[0155] Figure 8 A schematic diagram of the system architecture of the address translation method provided in the embodiment of the present application. Figure 8 As shown, the system 800 at least includes a hit check module 801, a cache line allocation module 802, a queue allocation module 803, a queue cache module 804, a queue arbitration module 805 and a command output module 806, wherein:
[0156] The hit check module 801 is used to check whether the current address translation command hits any cache line; the cache line allocation module 802 is used to allocate cache lines for address translation commands that do not hit; the queue allocation module 803 is used to determine the cache queue to which the address translation command will be written according to the hit result of the address translation command and the remaining state of the cache space of each cache queue in the queue cache module 804; the queue arbitration module 805 is used to determine the cache queue in the queue cache module 804 that outputs the address translation command; the command output module 806 is used to assemble and output the results output by the queue arbitration module 805. Here, the address translation command hits the cache line means that the virtual address carried by the address translation command is the same as the virtual address stored in the corresponding cache line.
[0157] The queue cache module 804 includes an independent queue 8041 (corresponding to the second cache queue in the above embodiment), a shared queue 8042 (corresponding to the first cache queue in the above embodiment), a shared queue description 8043 (corresponding to the information recording queue in the above embodiment) and a bypass queue 8044 (corresponding to the third cache queue in the above embodiment). Among them, the independent queue 8041 is used to record the address translation command of the cache line that is not hit determined by the hit check module 801 and is allocated by the cache line allocation module 802; the shared queue 8042 is used to record the address translation command of the cache line that is hit by the hit check module 801. It can be understood that the cache line hit by the address translation command may contain the physical address corresponding to the virtual address carried by the address translation command, or may not contain the corresponding physical address; the shared queue description 8043 is used to record the address translation command in the shared queue 8042 and the address translation command Corresponding cache line information and data preparation status information, where the data preparation status information may include whether the data is ready and whether the data is returned to the requesting end; the bypass queue 8044 is used to record other address translation commands that cannot enter the independent queue 8041 or the shared queue 8042. For example, when the capacity of the independent queue 8041 is full, the address translation commands that miss the cache line can be written into the bypass queue 8044; when the capacity of the shared queue 8042 is full, the address translation commands that hit the cache line can be written into the bypass queue 8044.
[0158] In some embodiments, when the capacity of the independent queue 8041 is not fully occupied, if the address translation command of the cache line that misses is not allocated to the cache line, it can be written into the bypass queue 8044 .
[0159] In some embodiments, after the translation backup buffer receives the address translation command from the request end, a hit check can be performed through the hit check module 801. Exemplarily, the hit check module 801 can perform an address hit test in all cache lines. If there is a virtual address in the cache line that is the same as the virtual address carried by the address translation command, it is considered that the address translation command hits the cache line. If the test result is a cache line hit, the cache line allocation module 802 determines the cache line that hits, that is, the cache line corresponding to the virtual address that is the same as the virtual address carried by the address translation command, and records the number of address translation commands corresponding to the cache line that is hit; if the test result is a loss, that is, the address translation command does not hit the cache line, the cache line allocation module 802 determines whether a new cache line can be allocated, and records the number of address translation commands corresponding to the current cache line. Exemplarily, if there is space to allocate cache lines, cache lines can be allocated to address translation commands that do not hit cache lines through the cache line allocation module 802.
[0160] Next, the queue allocation module 803 may allocate the current address translation command according to the cache line corresponding to the address translation command that hits the cache line or the cache line allocated to the address translation command that misses the cache line provided by the cache line allocation module 802 and the status of each queue. Exemplarily, when the address translation command hits the cache line and the shared queue 8042 is not full, the address translation command can be written to the shared queue 8042, and the address translation command and the cache line information and data preparation status information corresponding to the address translation command are recorded in the shared queue description 8043; when the address translation command does not hit the cache line and the independent queue 8041 is not full, the address translation command can be written to the independent queue 8041, and the address translation command and the cache line information and data preparation status information allocated to the address translation command are recorded in the independent queue 8042; when the address translation command hits the cache line but the shared queue 8042 is full or the address translation command does not hit the cache line but the independent queue 8041 is full, the address translation command can be written to the bypass queue 8044, and the address translation command is sent to the memory address management unit through the bypass queue 8044, so that the physical address corresponding to the virtual address carried by the address translation command is queried through the memory address management unit, and the queried physical address is returned to the bypass queue 8044.
[0161] Similarly, after the address translation command that misses the cache line in the independent queue 8041 is allocated a cache line, the address translation command can be sent to the memory address management unit to query the physical address corresponding to the virtual address carried by the address translation command through the memory address management unit, and the queried physical address is returned to the allocated cache line. When the address translation command in the shared queue 8042 hits the cache line but the corresponding physical address does not exist in the cache line, the address translation command can also be sent to the memory address management unit to store the queried physical address in the cache line through the memory address management unit.
[0162] Next, the queue arbitration module 805 may determine the currently output address translation command and the corresponding physical address according to a preset arbitration order.
[0163] In some embodiments, the arbitration order may include the output order of different queues, and the output order may be determined by the output priority of each queue. Exemplarily, taking the case where the queues include an independent queue 8041, a shared queue 8042, and a bypass queue 8044, the output priority of the bypass queue 8044 may be higher than that of the independent queue 8041, and the output priority of the independent queue 8041 may be higher than that of the shared queue 8042. In the case where there is an address translation command with a determined physical address in the bypass queue 8044, the address translation command with a determined physical address in the bypass queue 8044 is output first; in the case where there is no address translation command with a determined physical address in the bypass queue 8044, the address translation command with a determined physical address in the independent queue 8041 is output first; in the case where there is no address translation command with a determined physical address in the independent queue 8041, the address translation command with a determined physical address in the shared queue 8042 is output.
[0164] In some embodiments, the arbitration order may include the output order of different address translation commands in the queue, and the output order may be determined by the output priority of each address translation command. Exemplarily, among the address translation commands whose physical addresses have been determined in the shared queue 8042, the output priority may be determined according to the order in which the address translation commands enter the shared queue 8042, and the address translation command that first enters the shared queue 8042 has the highest output priority.
[0165] In some embodiments, the preset arbitration order may include both the output priorities of different queues and the output priorities of different address translation commands in the queues. The output priorities of different queues may be determined first, and after determining the queue with the highest output priority, the output priorities of different address translation commands in the queue may be determined to output the address translation command with the highest priority.
[0166] Taking the shared queue 8042 as the current output queue as an example, at this time, the address translation commands with corresponding physical addresses in the bypass queue 8044 and the independent queue 8041 should have all been output. There are two situations for the address translation commands that hit the cache line in the shared queue 8042: one in which the corresponding physical address exists in the hit cache line and one in which the corresponding physical address does not exist in the hit cache line. In the shared queue 8042, the address translation commands with determined physical addresses that first enter the shared queue 8042 are output preferentially.
[0167] Finally, the address translation command and the corresponding physical address determined to be output by the queue arbitration module 805 can be assembled and output to the request end through the command output module 806. Optionally, the command output module 806 can also assemble and output to the request end information such as the generation time of the address translation command, the corresponding request end, etc. together with the corresponding physical address.
[0168] In some embodiments, the depth of the independent queue 8041 is the same as the number of cache lines, and the depth of the shared queue 8042 can be set to four times or other larger multiples of the number of cache lines. On the one hand, the utilization efficiency of the shared queue 8042 can be improved in breadth, so that more address translation commands corresponding to cache lines can be cached in the shared queue 8042. On the other hand, more address translation commands can be cached for a single cache line in depth, thereby improving the hit rate of the address translation commands. Optionally, the shared queue 1042 can be implemented by a static random access memory (SRAM) to expand the cache capacity while reducing the hardware cost of the translation lookaside buffer, thereby improving the cache capacity of the translation lookaside buffer.
[0169] The above embodiment improves the use efficiency of queues by introducing multiple queues, reduces the back pressure of the translation backup buffer on the upstream in scenarios with uneven hit rate, high hit rate and high burst, and improves the address translation performance.
[0170] In yet another embodiment of the present application, based on the same inventive concept as the above-mentioned embodiment, Fig. 9 Schematic diagram of an address translation device provided in an embodiment of the present application. Fig. 9 As shown, the address translation device 900 includes a hit check module 901, a queue allocation module 902, a queue cache module 903 and a queue arbitration module 904, and the queue cache module 903 includes at least two cache queues, wherein:
[0171] A hit check module 901 is used to respond to receiving an address translation command sent by an upstream module, perform a hit check based on a virtual address carried in the address translation command, and obtain a hit result;
[0172] A queue allocation module 902, configured to write the address translation command into a cache queue corresponding to the hit result in the queue cache module;
[0173] The queue buffer module 903 is used to determine the physical address corresponding to the virtual address;
[0174] The queue arbitration module 904 is used to select the address translation command of the determined physical address between the at least two cache queues according to the arbitration order, and send the corresponding address feedback command to the upstream module corresponding to the address translation command of the determined physical address.
[0175] In some embodiments, the at least two cache queues include a first cache queue; wherein,
[0176] The queue allocation module 902 is further configured to write the address translation command into the first cache queue if the hit result is a hit;
[0177] The queue cache module 903 is also used to determine the physical address corresponding to the virtual address through the cache line corresponding to the address translation command in the first cache queue when the physical address corresponding to the virtual address carried by the address translation command exists in the first cache queue; and to send the address translation command to the memory address management unit to determine the physical address corresponding to the virtual address through the memory address management unit when the physical address corresponding to the virtual address carried by the address translation command does not exist in the first cache queue.
[0178] In some embodiments, the at least two cache queues further include a second cache queue; wherein,
[0179] The queue allocation module 902 is further configured to allocate a cache line to the address translation command and write the address translation command to which the cache line has been allocated into the second cache queue when the hit result is a miss;
[0180] The queue buffer module 903 is further configured to send the address translation command to the memory address management unit, and determine the physical address corresponding to the virtual address through the memory address management unit.
[0181] In some embodiments, the at least two cache queues include a first cache queue and a second cache queue; the queue arbitration module 904 is also used to determine the address feedback command according to the address translation command with the determined physical address in the second cache queue when there is an address translation command with the determined physical address in the second cache queue; and to determine the address feedback command according to the address translation command with the determined physical address in the first cache queue when there is no address translation command with the determined physical address in the second cache queue.
[0182] In some embodiments, the queue allocation module 902 is further configured to write the address translation command into the cache queue corresponding to the hit result when the cache queue corresponding to the hit result is not full.
[0183] In some embodiments, the at least two cache queues further include a third cache queue; wherein,
[0184] The queue allocation module 902 is further configured to write the address translation command into the third cache queue when the cache queue corresponding to the hit result is full;
[0185] The queue buffer module 903 is further configured to send the address translation command to the memory address management unit, and determine the physical address corresponding to the virtual address through the memory address management unit.
[0186] In some embodiments, the queue arbitration module 904 is also used to determine the address feedback command according to the address translation command with the determined physical address in the third cache queue when there is an address translation command with the determined physical address in the third cache queue; and to determine the address feedback command according to the address translation command with the determined physical address in the cache queue corresponding to the hit result when there is no address translation command with the determined physical address in the third cache queue.
[0187] In some embodiments, the at least two cache queues further include an information recording queue; wherein,
[0188] The queue cache module 903 is further configured to write the correspondence between the address translation command and the cache line in the first cache queue and the determination of the physical address in the cache line corresponding to the address translation command into the information recording queue when the address translation command is written into the first cache queue;
[0189] The queue arbitration module 904 is further configured to determine the address translation command of the determined physical address in the first cache queue through the information recording queue.
[0190] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. In some embodiments, the functions or modules included in the device provided in the embodiment of the present application can be used to execute the method described in the above method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0191] An embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, some or all of the steps in the above method are implemented.
[0192] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, some or all of the steps in the above method are implemented. The computer-readable storage medium can be transient or non-transient.
[0193] An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is run in a computer device, a processor in the computer device executes some or all of the steps for implementing the above method.
[0194] The embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, some or all of the steps in the above method are implemented. The computer program product can be implemented specifically by hardware, software or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium, and in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK) and the like.
[0195] It should be noted here that the description of the various embodiments above tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. The description of the above device, storage medium, computer program and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiments of the device, storage medium, computer program and computer program product of this application, please refer to the description of the method embodiment of this application for understanding.
[0196] Fig.10 A hardware entity diagram of a computer device provided in an embodiment of the present application is shown in FIG. Fig.10As shown, the hardware entity of the computer device 1000 includes: a processor 1001 and a memory 1002, wherein the memory 1002 stores a computer program that can be run on the processor 1001, and the processor 1001 implements the steps in the method of any of the above embodiments when executing the program.
[0197] The memory 1002 stores computer programs that can be run on the processor. The memory 1002 is configured to store instructions and applications executable by the processor 1001. It can also cache data to be processed or processed by the processor 1001 and various modules in the computer device 1000 (for example, image data, audio data, voice communication data, and video communication data). This can be achieved through flash memory (FLASH) or random access memory (Random Access Memory, RAM).
[0198] When the processor 1001 executes a program, the steps of any of the above-mentioned address translation methods can be implemented. The processor 1001 generally controls the overall operation of the computer device 1000.
[0199] An embodiment of the present application provides a computer storage medium, which stores one or more programs. The one or more programs can be executed by one or more processors to implement the steps of the address translation method of any of the above embodiments.
[0200] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0201] The processor may be at least one of an Application Specific Integrated Circuit (ASIC), a Digital Signal Processor (DSP), a Digital Signal Processing Device (DSPD), a Programmable Logic Device (PLD), a Field Programmable Gate Array (FPGA), a central processing unit, a controller, a microcontroller, and a microprocessor. It is understandable that the electronic device that implements the functions of the processor may also be other, and the embodiments of the present application are not specifically limited.
[0202] The above-mentioned computer storage medium / memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and the like; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0203] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the serial number of each step / process mentioned above does not mean the order of execution, and the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The serial numbers of the embodiments of the present application mentioned above are for description only and do not represent the advantages and disadvantages of the embodiments.
[0204] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0205] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0206] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0207] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0208] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0209] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0210] The above is only an implementation method 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.
Claims
1. An address translation method, characterized in that: Applied to an address translation device, the address translation device includes at least two cache queues, and the method includes: In response to receiving an address translation command sent by an upstream module, performing a hit check based on a virtual address carried in the address translation command to obtain a hit result; Writing the address translation command into the cache queue corresponding to the hit result, and determining the physical address corresponding to the virtual address; An address translation command with a determined physical address is selected between the at least two cache queues according to an arbitration order, and a corresponding address feedback command is sent to an upstream module corresponding to the address translation command with the determined physical address.
2. The address translation method according to claim 1, wherein: The at least two cache queues include a first cache queue; writing the address translation command into the cache queue corresponding to the hit result and determining the physical address corresponding to the virtual address includes: If the hit result is a hit, writing the address translation command into the first cache queue; In a case where the physical address corresponding to the virtual address carried by the address translation command exists in the first cache queue, determining the physical address corresponding to the virtual address through a cache line corresponding to the address translation command in the first cache queue; When the physical address corresponding to the virtual address carried by the address translation command does not exist in the first cache queue, the address translation command is sent to the memory address management unit, and the physical address corresponding to the virtual address is determined by the memory address management unit.
3. The address translation method according to claim 1, wherein: The at least two cache queues include a second cache queue; writing the address translation command into the cache queue corresponding to the hit result and determining the physical address corresponding to the virtual address includes: In a case where the hit result is a miss, allocating a cache line for the address translation command and writing the address translation command to which the cache line has been allocated into the second cache queue; The address translation command is sent to a memory address management unit, and the physical address corresponding to the virtual address is determined by the memory address management unit.
4. The address translation method according to claim 1, wherein: The at least two cache queues include a first cache queue and a second cache queue; and selecting the address translation command of the determined physical address between the at least two cache queues according to an arbitration order includes: In a case where the address translation command with the determined physical address exists in the second cache queue, determining the address feedback command according to the address translation command with the determined physical address in the second cache queue; In a case where the address translation command with the determined physical address does not exist in the second cache queue, the address feedback command is determined according to the address translation command with the determined physical address in the first cache queue.
5. The address translation method according to claim 1, wherein: Writing the address translation command into the cache queue corresponding to the hit result includes: When the cache queue corresponding to the hit result is not full, the address translation command is written into the cache queue corresponding to the hit result.
6. The address translation method according to any one of claims 1 to 5, characterized in that: The at least two cache queues further include a third cache queue; and the method further includes: When the cache queue corresponding to the hit result is full, writing the address translation command into the third cache queue; The address translation command is sent to a memory address management unit, and the physical address corresponding to the virtual address is determined by the memory address management unit.
7. The address translation method according to claim 6, characterized in that: The step of selecting the address translation command of the determined physical address between the at least two cache queues according to the arbitration order includes: In a case where the address translation command with the determined physical address exists in the third cache queue, determining the address feedback command according to the address translation command with the determined physical address in the third cache queue; In a case where the address translation command with the determined physical address does not exist in the third cache queue, the address feedback command is determined according to the address translation command with the determined physical address in the cache queue corresponding to the hit result.
8. The address translation method according to claim 2, wherein: The at least two cache queues further include an information recording queue; and the method further includes: When the address translation command is written into the first cache queue, writing the correspondence between the address translation command and the cache line in the first cache queue and the determination of the physical address in the cache line corresponding to the address translation command into the information recording queue; An address translation command of the determined physical address in the first cache queue is determined through the information recording queue.
9. An address translation device, characterized in that: The address translation device includes a hit check module, a queue allocation module, a queue cache module and a queue arbitration module; the queue cache module includes at least two cache queues, wherein, The hit check module is configured to, in response to receiving an address translation command sent by an upstream module, perform a hit check based on a virtual address carried in the address translation command to obtain a hit result; The queue allocation module is configured to write the address translation command into the cache queue corresponding to the hit result in the queue cache module; The queue cache module is used to determine the physical address corresponding to the virtual address; The queue arbitration module is used to select the address translation command with the determined physical address between the at least two cache queues according to the arbitration order, and send the corresponding address feedback command to the upstream module corresponding to the address translation command with the determined physical address.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the address translation method according to any one of claims 1 to 8 is implemented.
11. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the address translation method according to any one of claims 1 to 8 is implemented.
12. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the address translation method according to any one of claims 1 to 8 is implemented.
