Search

EP-4738130-A1 - ADDRESS TRANSLATION METHOD AND APPARATUS, AND ELECTRONIC DEVICE AND STORAGE MEDIUM

EP4738130A1EP 4738130 A1EP4738130 A1EP 4738130A1EP-4738130-A1

Abstract

Embodiments of the present disclosure provides an address translation method and apparatus, an electronic device, and a storage medium. The address translation method is applied to an address translation apparatus, the apparatus includes a plurality of sets of translation lookaside buffers, each set is configured to store page table information for translating a virtual address into a physical address. The address translation method includes: in response to obtaining a first virtual address translation request, determining a target translation lookaside buffer from the plurality of sets of translation lookaside buffers according to a first mapping algorithm, where the first virtual address translation request includes an object virtual address; accessing page table information in the target translation lookaside buffer to translate the object virtual address into an object physical address; the method further includes: acquiring access frequency information for each set of the plurality of sets of translation lookaside buffers; determining, based on the access frequency information, whether the first mapping algorithm requires updating; and in response to the first mapping algorithm requiring updating, updating the mapping algorithm to a second mapping algorithm.

Inventors

  • LIU, YU
  • HU, JINFENG
  • DAI, Kaiyong
  • PAN, YU

Assignees

  • Hygon Information Technology Co., Ltd.

Dates

Publication Date
20260506
Application Date
20241218

Claims (20)

  1. An address translation method, applied to an address translation apparatus, wherein the address translation apparatus comprises a plurality of sets of translation lookaside buffers, each set of translation lookaside buffers comprises first page table information for translating a virtual address into a physical address, and the method comprises: in response to obtaining a first virtual address translation request, determining a target translation lookaside buffer from the plurality of sets of translation lookaside buffers according to a first mapping algorithm, wherein the first virtual address translation request comprises an object virtual address; and accessing first page table information in the target translation lookaside buffer to translate the object virtual address into an object physical address, wherein the method further comprises: acquiring access frequency information for each set of the plurality of sets of translation lookaside buffers; determining, based on the access frequency information, whether the first mapping algorithm requires updating; and in response to determining that the first mapping algorithm requires updating, updating the first mapping algorithm to a second mapping algorithm.
  2. The method according to claim 1, wherein the address translation apparatus further comprises a multi-level page table query module, and the multi-level page table query module comprises second page table information, and accessing the first page table information in the target translation lookaside buffer to translate the object virtual address into the object physical address comprises: accessing the first page table information in the target translation lookaside buffer, and determining whether the first target page table information that matches the first virtual address translation request exists in the first page table information; in response to the first target page table information not existing in the target translation lookaside buffer, providing the first virtual address translation request to the multi-level page table query module; determining whether second target page table information that matches the first virtual address translation request exists in the second page table information; and in response to the second target page table information that matches the first virtual address translation request not existing in the second page table information, translating the object virtual address into the object physical address based on translation information provided by an external memory.
  3. The method according to claim 2, wherein the first page table information comprises a plurality of page table entries, each page table entry corresponds to a physical page, the second page table information comprises a multi-level page table, each level of the page table comprises a plurality of page directory entries, and each page directory entry is used to point to a physical address of a next-level page table, wherein each page directory entry in a last-level page table of the multi-level page table is used to point to a page table entry in the first page table information.
  4. The method according to claim 3, wherein determining whether the second target page table information that matches the first virtual address translation request exists in the second page table information comprises: acquiring, based on the object virtual address and a base address, a first page table read address of at least one level of the multi-level page table; and determining, based on the first page table read address, whether the second target page table information that matches the first virtual address translation request exists in the second page table information.
  5. The method according to claim 4, wherein in response to the second target page table information that matches the first virtual address translation request not existing in the second page table information, translating the object virtual address into the object physical address based on the translation information provided by the external memory, comprises: in response to the second target page table information that matches the first virtual address translation request not existing in the second page table information, determining whether a merge signal is valid; in response to the merge signal being valid, comparing whether the first page table read address is identical to a second page table read address of a second virtual address translation request preceding the first virtual address translation request; in response to the first page table read address being identical to the second page table read address, merging the first virtual address translation request with the second virtual address translation request, and waiting for the translation information that is provided by the external memory in response to the second virtual address translation request; and translating the object virtual address into the object physical address based on the translation information.
  6. The method according to claim 5, wherein in response to the second target page table information that matches the first virtual address translation request not existing in the second page table information, translating the object virtual address into the object physical address based on the translation information provided by the external memory, further comprises: in response to the first page table read address and the second page table read address being different, providing a page table read request based on the first virtual address translation request to the external memory to acquire the translation information from the external memory; and updating the merge signal to be invalid.
  7. The method according to claim 5, wherein in response to the second target page table information that matches the first virtual address translation request not existing in the second page table information, translating the object virtual address into the object physical address based on the translation information provided by the external memory, further comprises: in response to the merge signal being invalid, providing a page table read request based on the first virtual address translation request to the external memory to acquire the translation information from the external memory; and updating the merge signal to be valid.
  8. The method according to claim 5, wherein in response to the second target page table information that matches the first virtual address translation request not existing in the second page table information, translating the object virtual address into the object physical address based on the translation information provided by the external memory, further comprises: in response to receiving the translation information that is provided by the external memory in response to the second virtual address translation request, updating the merge signal to be invalid.
  9. The method according to claim 6 or 7, wherein the page table read request comprises: a page table read address and an object virtual address of a virtual address translation request, and a hardware access unit identifier which providing the virtual address translation request, wherein the page table read address is obtained based on the base address and page directory entry data of at least one level of the multi-level page table.
  10. The method according to claim 3, wherein accessing the first page table information in the target translation lookaside buffer to translate the object virtual address into the object physical address comprises: accessing the first page table information in the target translation lookaside buffer, and determining whether a target page table entry that matches the object virtual address translation request exists in the first page table information; and in response to the target page table entry that matches the object virtual address translation request existing in the first page table information, determining the object physical address corresponding to the object virtual address based on the target page table entry and an in-page offset indicated by the object virtual address.
  11. The method according to claim 10, wherein the translation information comprises the target page table entry.
  12. The method according to any one of claims 1-11, wherein acquiring the access frequency information for each set of the plurality of sets of translation lookaside buffers comprises: counting a number of accesses for each set of the plurality of sets of translation lookaside buffers, and obtaining a count value of each set of the plurality of sets of translation lookaside buffers within a preset time period.
  13. The method according to claim 12, wherein determining, based on the access frequency information, whether the first mapping algorithm requires updating, comprises: calculating an average access value of count values of the plurality of sets of translation lookaside buffers based on the count value of each set of the plurality of sets of translation lookaside buffers; acquiring a permitted access deviation; calculating an effective access rate of the plurality of sets of translation lookaside buffers based on the permitted access deviation and the average access value; and determining, based on the effective access rate, whether the first mapping algorithm requires updating.
  14. The method according to claim 13, wherein calculating the effective access rate of the plurality of sets of translation lookaside buffers based on the permitted access deviation and the average access value comprises: calculating an access deviation value of each set of the plurality of sets of translation lookaside buffers based on the permitted access deviation; calculating an effective utilization indicator value of each set of the plurality of sets of translation lookaside buffers based on the access deviation value, wherein for each set of the plurality of sets of translation lookaside buffers, in response to sum of the access deviation value and the count value being greater than or equal to the average access value, setting an effective utilization indicator value of an translation lookaside buffer to a first preset value, and in response to the sum of the access deviation value and the count value being less than the average access value, setting the effective utilization indicator value of the translation lookaside buffer to a second preset value; and setting an average value of effective utilization indicator values of the plurality of sets of translation lookaside buffers as the effective access rate.
  15. The method according to claim 14, wherein determining, based on the effective access rate, whether the first mapping algorithm requires updating, comprises: in response to the effective access rate being greater than or equal to a preset access rate, determining that the first mapping algorithm does not require updating; and in response to the effective access rate being less than the preset access rate, determining that the first mapping algorithm requires updating.
  16. The method according to any one of claims 1 to 15, wherein the first mapping algorithm comprises: determining the target translation lookaside buffer based on a first target bit of an object virtual address in a virtual address translation request, and the second mapping algorithm comprises: determining the target translation lookaside buffer based on a second target bit of the object virtual address in the virtual address translation request, wherein the first target bit and the second target bit are different.
  17. The method according to claim 16, wherein the first target bit comprises a plurality of consecutive first bits in the object virtual address, and the second target bit comprises a plurality of consecutive second bits in the object virtual address.
  18. An address translation apparatus, comprising: an address translation module, comprising a plurality of sets of translation lookaside buffers; and an arbitration module, configured to in response to obtaining a first virtual address translation request, determine a target translation lookaside buffer from a plurality of sets of translation lookaside buffers according to a first mapping algorithm, wherein the first virtual address translation request comprises an object virtual address, wherein each set of the plurality of sets of translation lookaside buffers is configured to store the first page table information for translating the object virtual address into an object physical address, the address translation module is configured to: access first page table information in the target translation lookaside buffer to translate the object virtual address into an object physical address, wherein the address translation apparatus further comprises: an address translation performance monitoring module, configured to: acquire access frequency information for each set of the plurality of sets of translation lookaside buffers; determine, according to the access frequency information, whether the first mapping algorithm requires updating; and in response to determining that the first mapping algorithm requires updating, update the first mapping algorithm to a second mapping algorithm.
  19. The address translation apparatus according to claim 18, further comprising: a multi-level page table query module, the multi-level page table query module comprises second page table information, wherein the address translation module is configured to: access the first page table information in the target translation lookaside buffer, and determine whether first target page table information that matches the first virtual address translation request exists in the first page table information; and in response to the first target page table information not existing in the target translation lookaside buffer, provide the first virtual address translation request to the multi-level page table query module; wherein the multi-level page table query module is configured to: receive the first virtual address translation request provided by the address translation module; determine whether second target page table information that matches the first virtual address translation request exists in the second page table information; and in response to the second target page table information that matches the first virtual address translation request not existing in the second target page table information, acquire translation information provided by an external memory, wherein the translation information is used to translate the object virtual address into the object physical address.
  20. The address translation apparatus according to claim 19, wherein the first page table information comprises a plurality of page table entries, each page table entry corresponding to a physical page, and the second page table information comprises a multi-level page table, and each level of the page table comprises a plurality of page directory entries, and each page directory entry is used to point to a physical address of a next-level page table, wherein each page directory entry in a last-level page table of the multi-level page table is used to point to a page table entry in the first page table information.

Description

The present application claims the priority to Chinese Patent Application No. 202411142514.0, filed on August 19, 2024, the entire disclosure of which is incorporated herein by reference as portion of the present application. TECHNICAL FIELD Embodiments of the present disclosure relate to an address translation method and an apparatus, an electronic device and a storage medium. BACKGROUND Currently, devices that require virtual addressing, such as Central Processing Unit (CPU), chips and Graphics Processing Unit (GPU), etc., typically have a specific address translation apparatus responsible for translating virtual addresses to physical addresses. For example, the CPU has a Memory Management Unit (MMU) that is responsible for translating virtual addresses to physical addresses. SUMMARY At least one embodiment of the present disclosure provides an address translation method, applied to an address translation apparatus, where the address translation apparatus includes a plurality of sets of translation lookaside buffers, each set of translation lookaside buffers includes first page table information for translating a virtual address into a physical address, and the method includes: in response to obtaining a first virtual address translation request, determining a target translation lookaside buffer from the plurality of sets of translation lookaside buffers according to a first mapping algorithm, where the first virtual address translation request includes an object virtual address; and accessing first page table information in the target translation lookaside buffer to translate the object virtual address into an object physical address, where the method further includes: acquiring access frequency information for each set of the plurality of sets of translation lookaside buffers; determining, based on the access frequency information, whether the first mapping algorithm requires updating; and in response to determining that the first mapping algorithm requires updating, updating the first mapping algorithm to a second mapping algorithm. For example, in the address translation method provided by some embodiments of the present disclosure, the address translation apparatus further includes a multi-level page table query module, and the multi-level page table query module includes second page table information, and accessing the first page table information in the target translation lookaside buffer to translate the object virtual address into the object physical address includes: accessing the first page table information in the target translation lookaside buffer, and determining whether the first target page table information that matches the first virtual address translation request exists in the first page table information; in response to the first target page table information not existing in the target translation lookaside buffer, providing the first virtual address translation request to the multi-level page table query module; determining whether second target page table information that matches the first virtual address translation request exists in the second page table information; and in response to the second target page table information that matches the first virtual address translation request not existing in the second page table information, translating the object virtual address into the object physical address based on translation information provided by an external memory. For example, in the address translation method provided by some embodiments of the present disclosure, the first page table information includes a plurality of page table entries, each page table entry corresponds to a physical page, the second page table information includes a multi-level page table, each level of the page table includes a plurality of page directory entries, and each page directory entry is used to point to a physical address of a next-level page table, where each page directory entry in a last-level page table of the multi-level page table is used to point to a page table entry in the first page table information. For example, in the address translation method provided by some embodiments of the present disclosure, determining whether the second target page table information that matches the first virtual address translation request exists in the second page table information includes: acquiring, based on the object virtual address and a base address, a first page table read address of at least one level of the multi-level page table; and determining, based on the first page table read address, whether the second target page table information that matches the first virtual address translation request exists in the second page table information. For example, in the address translation method provided by some embodiments of the present disclosure, in response to the second target page table information that matches the first virtual address translation request not existing in the second page table i