Address translation configuration method and device, electronic equipment and storage medium

By using the address translation page table to determine the physical memory address corresponding to the virtual address in the NUMA system, the problem of large memory access performance overhead of the processor and instruction cache miss is solved, and multiple copies of the virtual address are accessed in different processors. Improves system performance and flexibility.

CN119003388APending Publication Date: 2024-11-22PHYTIUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410926553.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-11
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

NUMA systems have high performance overhead when processors access memory across nodes, and missed instruction caches may cause system access exceptions.

Method used

Provide an address translation configuration method, by obtaining the address translation page table of the target processor, determining the physical memory address corresponding to the virtual address, and using the combination of the home page table and the auxiliary page table to realize multiple copies of the virtual address in different processors. Avoid cross-node access.

Benefits of technology

It improves system performance, realizes access to the same content of virtual addresses in different physical memory, reduces cross-node access, and improves the flexibility and operation efficiency of multi-core processor systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003388A_ABST
    Figure CN119003388A_ABST
Patent Text Reader

Abstract

The invention provides an address translation configuration method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the steps that an address access request initiated by an application program is responded, an address conversion page table of a target processor is obtained, the address access request comprises a target virtual address, and the address conversion page table is used for indicating the mapping relation between the virtual address and a physical memory address; a target physical memory address in a page table entry corresponding to the target virtual address is determined from the address translation page table, and one virtual address corresponds to one or more physical memory addresses in the address translation page tables of different processors; when one virtual address corresponds to a plurality of physical memory addresses, the positions corresponding to the plurality of physical memory addresses store the same content; according to the target physical memory address, target content is read, and the target content comprises the target code or the target data. Different processors can access the node nearby to obtain the content, and the system performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to an address translation configuration method, device, electronic device and storage medium. Background Art

[0002] Based on its scalability advantage, Non Uniform Memory Access Achitecture (NUMA) can meet people's requirements for high-performance computing and is increasingly widely used in high-end servers.

[0003] However, for the current NUMA system, when the processor needs to access memory across nodes, it will cause a large performance overhead, and when the instruction cache of the thread executed on the node does not hit, it may cause system access exceptions. Summary of the invention

[0004] The purpose of the present invention is to provide an address translation configuration method, device, electronic device and storage medium to address the deficiencies in the above-mentioned prior art, so as to enable different processors to access the nearest node to obtain content and improve system performance.

[0005] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0006] In a first aspect, an embodiment of the present application provides an address translation configuration method, which is applied to a multi-core processor system, and the method includes:

[0007] In response to an address access request initiated by an application, an address translation page table of a target processor is obtained, wherein the address access request includes: a target virtual address, and the address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address;

[0008] Determine a target physical memory address in a page table entry corresponding to the target virtual address from the address translation page table, wherein one of the virtual addresses corresponds to one or more physical memory addresses in the address translation page tables of different processors, and when one of the virtual addresses corresponds to multiple physical memory addresses, the locations corresponding to the multiple physical memory addresses store the same content;

[0009] According to the target physical memory address, the target content is read, and the target content includes: target code or target data.

[0010] Optionally, the address translation page table includes: an address translation main page table and an address translation auxiliary page table; and determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table includes:

[0011] Determine the home page table entry corresponding to the target virtual address and the attribute bit of the home page table entry from the address conversion home page table;

[0012] According to the attribute bit of the main page table entry, determining to search the address translation auxiliary page table;

[0013] The target physical memory address corresponding to the target virtual address is determined from the physical memory address of the auxiliary page table entry of the address translation auxiliary page table.

[0014] Optionally, the address translation page table includes: an address translation main page table and an address translation auxiliary page table; and determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table includes:

[0015] Determine the home page table entry and the attribute bit of the home page table entry corresponding to the target virtual address from the address translation home page table, and determine the auxiliary page table entry corresponding to the target virtual address from the address translation auxiliary page table;

[0016] According to the attribute bit of the main page table entry, the target physical memory address corresponding to the target virtual address is determined from the physical memory addresses respectively corresponding to the main page table entry and the auxiliary page table entry.

[0017] Optionally, determining to search the address translation auxiliary page table according to the attribute bit of the main page table entry includes:

[0018] If the attribute bit of the main page table entry indicates that the address translation auxiliary page table is enabled, determining to search the address translation auxiliary page table;

[0019] The method further comprises:

[0020] If the attribute bit of the home page table entry indicates that the address translation auxiliary page table is disabled, then the physical memory address corresponding to the home page table entry is determined to be the target physical memory address corresponding to the virtual address.

[0021] Optionally, before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table, the method further includes:

[0022] For the first content used for making multiple copies, storage space is allocated for the first content in multiple physical memories respectively, and each processor corresponds to one physical memory;

[0023] Copying the first content to the storage space allocated by the plurality of physical memories;

[0024] According to the physical memory address corresponding to the storage space of the first content, an address translation auxiliary page table corresponding to the multiple physical memories is generated, and the address translation auxiliary page table stores the physical memory address of the first content and the mapping relationship between the virtual address of the application executing the first content.

[0025] Optionally, the method further comprises:

[0026] In the address translation main page tables corresponding to the multiple physical memories, the attribute bits of the main page table entries corresponding to the first content are respectively modified to enable the address translation auxiliary page table.

[0027] Optionally, before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table, the method further includes:

[0028] Obtaining the global address translation page table of the virtual machine through the virtual machine monitor;

[0029] Create an address translation auxiliary page table for multiple physical memories respectively;

[0030] Determine a physical memory address of a second content from the global address translation page table, where the second content is content used for making multiple copies;

[0031] According to the content in the physical memory address of the second content, copy the corresponding content in the multiple physical memories;

[0032] According to the physical memory addresses of the copied contents in the multiple physical memories, the corresponding physical memory addresses and the mapping relationship between the physical memory addresses and the virtual addresses of the second contents are respectively stored in the address translation auxiliary page tables of the multiple physical memories.

[0033] Optionally, determining the physical memory address of the second content from the global address translation page table includes:

[0034] According to the virtual address of the second content sent by the virtual machine based on the instruction of the application, determine the physical memory address corresponding to the virtual address of the second content from the global address translation page table; or, receive the page table entry corresponding to the second content sent by the virtual machine based on the instruction of the application, and determine the physical memory address of the second content from the global address translation page table according to the page table entry corresponding to the second content.

[0035] Optionally, before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table, the method further includes:

[0036] Receiving multiple groups of virtual memory page sets sent by the virtual machine, each group of virtual memory page sets including multiple source virtual memory pages and destination virtual memory pages for address mapping;

[0037] Create address translation auxiliary page tables for multiple physical memories respectively;

[0038] According to the physical memory address of the destination virtual memory page in the corresponding physical memory, a mapping relationship between the virtual address of the source virtual memory page and the physical memory address corresponding to the destination virtual memory page is stored in the address translation auxiliary page table of each physical memory.

[0039] Optionally, the method further comprises:

[0040] After detecting a change in the virtual address corresponding to the target content, the virtual machine monitor is notified to modify the mapping relationship between the virtual address and the physical memory address in the address translation auxiliary page table.

[0041] Optionally, reading the target content according to the target physical memory address includes:

[0042] If the target physical memory address is a physical memory address in the physical memory corresponding to the target processor, the target content is read from the physical memory corresponding to the target processor according to the target physical memory address.

[0043] Optionally, reading the target content according to the target physical memory address includes:

[0044] If the target physical content address is a physical memory address in a fixed physical memory among the multiple physical memories, the target content is read from the fixed physical memory according to the target physical memory address.

[0045] In a second aspect, an embodiment of the present application further provides an address translation configuration device, which is applied to a multi-core processor system, and the device includes:

[0046] A page table acquisition module is used to respond to an address access request initiated by an application program and acquire an address translation page table of a target processor, wherein the address access request includes: a target virtual address, and the address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address;

[0047] a physical address determination module, used to determine a target physical memory address in a page table entry corresponding to the target virtual address from the address translation page table, wherein the address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address, wherein one of the virtual addresses corresponds to one or more physical memory addresses in the address translation page tables of different processors, and when one of the virtual addresses corresponds to multiple physical memory addresses, the positions of the multiple physical memory address pairs store the same content;

[0048] The content reading module is used to read the target content according to the target physical memory address, and the target content includes: target code or target data.

[0049] Optionally, the address translation page table includes: an address translation main page table and an address translation auxiliary page table; the physical address determination module is specifically used to determine the main page table entry corresponding to the target virtual address and the attribute bits of the main page table entry from the address translation main page table; determine to search the address translation auxiliary page table according to the attribute bits of the main page table entry; determine the target physical memory address corresponding to the target virtual address from the physical memory address of the auxiliary page table entry of the address translation auxiliary page table.

[0050] Optionally, the address translation page table includes: an address translation main page table and an address translation auxiliary page table; the physical address determination module is specifically used to determine the main page table entry corresponding to the target virtual address and the attribute bits of the main page table entry from the address translation main page table, and determine the auxiliary page table entry corresponding to the target virtual address from the address translation auxiliary page table; according to the attribute bits of the main page table entry, determine the target physical memory address corresponding to the target virtual address from the physical memory addresses respectively corresponding to the main page table entry and the auxiliary page table entry.

[0051] Optionally, the physical address determination module is also used to determine to search the address translation auxiliary page table if the attribute bit of the home page table entry indicates that the address translation auxiliary page table is enabled; if the attribute bit of the home page table entry indicates that the address translation auxiliary page table is disabled, determine that the physical memory address corresponding to the home page table entry is the target physical memory address corresponding to the virtual address.

[0052] Optionally, before the physical address determination module, the device further includes:

[0053] An auxiliary page table creation module is used to allocate storage space for the first content used for multiple copies in multiple physical memories, one physical memory corresponding to each processor; copy the first content to the storage space allocated to the multiple physical memories; and generate address conversion auxiliary page tables corresponding to the multiple physical memories according to the physical memory addresses corresponding to the storage spaces of the first content, wherein the address conversion auxiliary page table stores the physical memory address of the first content and the mapping relationship between the virtual address of the application executing the first content.

[0054] Optionally, the device further comprises:

[0055] The attribute bit modification module is used to modify the attribute bits of the home page table entries corresponding to the first content in the address translation home page tables corresponding to the multiple physical memories to enable the address translation auxiliary page table.

[0056] Optionally, the auxiliary page table creation module is also used to obtain the global address translation page table of the virtual machine through the virtual machine monitor; create an address translation auxiliary page table for each of the multiple physical memories; determine the physical memory address of the second content from the global address translation page table, wherein the second content is content used for multiple copies; based on the content in the physical memory address of the second content, copy the corresponding content in the multiple physical memories; based on the physical memory addresses of the copied content in the multiple physical memories, store the corresponding physical memory addresses in the address translation auxiliary page tables of the multiple physical memories, as well as the mapping relationship between the virtual addresses of the second content.

[0057] Optionally, the auxiliary page table creation module is also used to determine the physical memory address corresponding to the virtual address of the second content from the global address translation page table according to the virtual address of the second content sent by the virtual machine based on the instructions of the application; or, receive the page table entry corresponding to the second content sent by the virtual machine based on the instructions of the application, and determine the physical memory address of the second content from the global address translation page table according to the page table entry corresponding to the second content.

[0058] Optionally, the auxiliary page table creation module is also used to receive multiple groups of virtual memory page sets sent by the virtual machine, each group of virtual memory page sets including multiple source virtual memory pages and destination virtual memory pages for address mapping; create address translation auxiliary page tables for multiple physical memories respectively; and store the mapping relationship between the virtual address of the source virtual memory page and the physical memory address corresponding to the destination virtual memory page in the address translation auxiliary page table of each physical memory according to the physical memory address of the destination virtual memory page in the corresponding physical memory.

[0059] Optionally, the device further comprises:

[0060] The monitoring module is used to detect the change of the virtual address corresponding to the target content and notify the virtual monitor

[0061]

[0062] The viewer modifies the mapping relationship between the virtual address and the physical memory address in the address translation auxiliary page table.

[0063] Optionally, the content reading module is specifically configured to read the target content from the physical memory corresponding to the target processor according to the target physical memory address if the target physical memory address is a physical memory address in the physical memory corresponding to the target processor.

[0064] Optionally, the content reading module is specifically configured to read the target content from the fixed physical memory according to the target physical memory address if the target physical content address is a physical memory address in a fixed physical memory among the multiple physical memories.

[0065] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the address conversion configuration method as described in any one of the first aspects.

[0066] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the address conversion configuration method as described in any one of the first aspects are executed.

[0067] The beneficial effects of this application are:

[0068] The address translation configuration method, device, electronic device and storage medium provided by the present application determine the target physical memory address corresponding to the target virtual address through the address translation page table for the target virtual address in the address access request initiated by the program, so as to obtain the target content through the target physical memory address. When a virtual address corresponds to multiple physical memory addresses in the address translation page tables of different processors, and the locations corresponding to the multiple physical memory addresses store the same content, it is possible to access the same content in different physical memories through the same virtual address, thereby realizing multiple copies of the application content access, avoiding cross-node access of the application, and improving the system operation performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0070] Figure 1 An architectural diagram of a multi-core processor system provided in an embodiment of the present application;

[0071] Figure 2 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 1 ;

[0072] Figure 3 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 2 ;

[0073] Figure 4 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 3 ;

[0074] Figure 5 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 4 ;

[0075] Figure 6 An architectural diagram of a virtualized multi-core processor system provided in an embodiment of the present application;

[0076] Figure 7 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 5 ;

[0077] Figure 8 A schematic diagram of address mapping provided for this embodiment;

[0078] Fig. 9 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 6 ;

[0079] Fig.10 A schematic diagram of the structure of an address conversion configuration device provided in an embodiment of the present application;

[0080] Fig.11 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0081] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0082] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0083] In addition, the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0084] It should be noted that, in the absence of conflict, the features in the embodiments of the present application may be combined with each other.

[0085] Before describing the specific implementation of the address translation configuration method provided in the present application, in order to better understand the present solution, the multi-core processor system used in the present application is first introduced.

[0086] Figure 1 The architecture diagram of the multi-core processor system provided in the embodiment of the present application is as follows: Figure 1 As shown, the multi-core processor system may include: multiple processors (CPUs) and multiple physical memories. The multiple processors and multiple physical memories in the multi-core processor system are divided into multiple NUMA nodes. Each NUMA node is configured with at least one processor and one physical memory. The processors in each NUMA node share the corresponding physical memory.

[0087] When the application process is running, the operating system can call threads on different processors to run the application process. For the processor running the application process, the physical memory address of the virtual address in the physical memory corresponding to the node where the processor is located is determined from the address translation page table based on the virtual address of the application process, and the content required for the application process to run is obtained from the physical memory.

[0088] Based on the above multi-core processor system, Figure 2 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 1 ,like Figure 2 As shown, the method may include:

[0089] S101. Respond to an address access request initiated by an application program and obtain an address translation page table of a target processor. The address access request includes a target virtual address. The address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address.

[0090] In this embodiment, the physical memory is abstracted into an address space, and the address allocated to the process running the application in the address space is a virtual address. For each virtual address, there is a corresponding physical memory address in the physical memory, and the mapping relationship between the virtual address and the physical memory address is represented by an address translation page table.

[0091] For multiple processors in a multi-core processor system, each processor has a corresponding address translation page table, and the address translation page table of each processor is stored in the physical memory corresponding to each processor.

[0092] When an application calls code during execution, it initiates an address access request based on the target virtual address of the called code. When the multi-core processor system receives the address access request initiated by the application, it obtains the address translation page table of the target processor from the physical memory corresponding to the target processor based on the target processor assigned to the application by the operating system.

[0093] S102. Determine a target physical memory address in a page table entry corresponding to a target virtual address from an address translation page table, wherein one virtual address corresponds to one or more physical memory addresses in address translation page tables of different processors, and when one virtual address corresponds to multiple physical memory addresses, the locations corresponding to the multiple physical memory addresses store the same content.

[0094] In this embodiment, the address access request includes the target virtual address of the application running in the address space, wherein the target virtual address may include at least: a page start address and an offset value within the page. According to the target virtual address, the page table entry corresponding to the target virtual address is determined from the address translation page table. Specifically, according to the first address corresponding to the address translation page table and the page start address in the target virtual address, the page table entry corresponding to the target virtual address is determined from the address translation page table. The page table entry stores the physical memory base address corresponding to the target virtual address. The physical memory base address plus the page offset value in the target virtual address obtains the physical memory address.

[0095] In some embodiments, for the content required for the operation of the application in the operating system, the content is divided into two categories according to preset standards. The operating system copies the first category of content in multiple physical memories respectively, so as to realize multiple copies of the first category of content in the multi-core processor system, and stores the physical memory address corresponding to the virtual address of the first category of content in each physical memory according to the physical memory address of the first category of content in each physical memory in the corresponding address translation page table. In this way, even if the virtual address of the first category of content is the same when running in each processor, the corresponding physical memory address in the address translation page tables corresponding to different processors is also different, so that one virtual address corresponds to multiple physical memory addresses in the address translation page tables of different processors.

[0096] For the second category of content, the situation in which it is stored in only one physical memory is still retained, and the physical memory address corresponding to the virtual address of the second category of content is stored in the address translation page table corresponding to each processor. In this way, the physical memory address corresponding to the virtual address of the first category of content in each address translation page table is the same, so that one virtual address corresponds to one physical memory address in the address translation page table of all processors.

[0097] In some embodiments, the preset standard can be an importance standard manually defined by the user for the application, wherein the first category of content is important content that requires multiple copies, and the second category of content is secondary content, to ensure that the processor obtains important content from the physical memory corresponding to the local node when running the application, thereby avoiding the impact of cross-node acquisition of important content on program performance.

[0098] In other embodiments, the preset standard may be a frequency of use standard for an application, wherein the first category of content is content that is used frequently but does not change frequently, and the second category of content is content that changes frequently. The preset usage frequency may be used to determine the high-frequency usage content and the low-frequency usage content, thereby ensuring that the processor obtains the high-frequency usage content from the physical memory corresponding to the local node when running the application, thereby avoiding the impact of obtaining high-frequency usage content across nodes on the program running performance.

[0099] S103. Read target content according to the target physical memory address, where the target content includes: target code or target data.

[0100] In this embodiment, the target content that the application needs to read may be a target code or a target data, wherein the target data may be read-only data, which is not limited here.

[0101] For the target virtual address corresponding to the first type of content, no matter which processor the application runs on, based on the target physical memory address corresponding to the target virtual address in the address translation page table corresponding to the processor, the target content can be called from the physical memory corresponding to the local node of the processor, avoiding cross-node calls when the application calls content.

[0102] For the target virtual address corresponding to the second type of content, when the application is run by any processor, the target content is called through the unique fixed physical memory based on the physical memory address uniquely corresponding to the target virtual address in the address translation page table corresponding to the processor.

[0103] The address translation configuration method provided in the above embodiment determines the target physical memory address corresponding to the target virtual address through the address translation page table for the target virtual address in the address access request initiated by the application, so as to obtain the target content through the target physical memory address. When a virtual address corresponds to multiple physical memory addresses in the address translation page tables of different processors, and the locations corresponding to the multiple physical memory addresses store the same content, it is possible to access the same content in different physical memories through the same virtual address, thereby realizing multiple copies of the application content access, avoiding cross-node access of the application, and improving the system operation performance.

[0104] Furthermore, the virtual address is divided into corresponding multiple physical memory addresses and one physical memory address, so that a part of the virtual addresses can store the same content in multiple physical memory addresses to avoid cross-node access, and the other part of the virtual addresses can store content in one physical memory address to achieve cross-node access, so that the application calls different content to achieve compatibility between local multiple copy access and cross-node access, thereby improving the flexibility of the multi-core processor system.

[0105] In one possible implementation, Figure 3 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 2 ,like Figure 3 As shown, the process of determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table in S102 may include:

[0106] S201. Determine a home page table entry and an attribute bit of the home page table entry corresponding to a target virtual address from an address translation home page table.

[0107] In this embodiment, a serial search method is adopted to determine the target physical memory address by first searching the address translation main page table and then searching the address translation auxiliary page table.

[0108] The address translation page table includes an address translation main page table and an address translation auxiliary page table. In this embodiment, an attribute bit is added to the address translation main page table. Optionally, the address translation main page table includes a main page table entry and an attribute bit corresponding to the main page table entry. The main page table entry is used to store the physical memory base address corresponding to the virtual address or the index value of the address translation auxiliary page table. The attribute bit is used to indicate whether the address translation auxiliary page table is used to determine the mapping relationship between the virtual address and the physical memory address; the address translation auxiliary page table includes an auxiliary page table entry, and the auxiliary page table entry stores the physical memory base address corresponding to the virtual address. The physical memory base address plus the page offset value in the virtual address can obtain the physical memory address.

[0109] Among them, if the attribute bit indicates that the address translation auxiliary page table is used to determine the mapping relationship between the virtual address and the physical memory address, the home page table entry is used to store the index value of the address translation auxiliary page table corresponding to the virtual address; if the attribute bit indicates that the address translation home page table is used to determine the mapping relationship between the virtual address and the physical memory address, the home page table entry is used to store the physical memory base address corresponding to the virtual address.

[0110] The target processor obtains the address translation home page table, and determines the home page table entry corresponding to the page start address of the target virtual address and the attribute bit corresponding to the home page table entry from the address translation home page table according to the first address of the address translation home page table and the page start address of the target virtual address.

[0111] It should be noted that if the virtual address corresponding to the home page table entry is the virtual address corresponding to the first category of content, the address translation auxiliary page table can be used to determine the physical memory address, that is, the attribute bit of the home page table entry indicates the use of the address translation auxiliary page table to determine the mapping relationship between the virtual address and the physical memory address; if the virtual address corresponding to the home page table entry is the virtual address corresponding to the second category of content, the address translation home page table can be used to determine the physical memory address, that is, the attribute bit of the home page table entry indicates the use of the address translation home page table to determine the mapping relationship between the virtual address and the physical memory address.

[0112] S202: Determine to search the address translation auxiliary page table according to the attribute bit of the main page table entry.

[0113] In this embodiment, when the attribute bit corresponding to the main page table entry indicates the use of the address translation auxiliary page table to determine the mapping relationship between the virtual address and the physical memory address, the processor then determines the auxiliary page table entry corresponding to the index value from the address translation auxiliary page table based on the index value of the address translation auxiliary page table corresponding to the target virtual address found in the address translation main page table.

[0114] In some embodiments, the attribute bit of the home page table entry indicates whether the address translation auxiliary page table is enabled to indicate whether the address translation auxiliary page table is used to determine the mapping relationship between the virtual address and the physical memory address. The above S202 determines the process of searching the address translation auxiliary page table according to the attribute bit of the home page table entry, which may include:

[0115] If the attribute bit of the main page table entry indicates that the address translation auxiliary page table is enabled, it is determined to search the address translation auxiliary page table.

[0116] In this embodiment, if the attribute bit of the main page table entry indicates that the address translation auxiliary page table is enabled, it is determined to use the address translation auxiliary page table to determine the mapping relationship between the virtual address and the physical memory address, the processor obtains the address translation auxiliary page table from a predefined register, and determines the auxiliary page table entry according to the index value obtained from the address translation main page table based on the first address of the address translation auxiliary page table.

[0117] The index value in the address translation main page table may be a destination physical address, and the auxiliary page table entry may be determined from the address translation auxiliary page table according to the first address of the address translation auxiliary page table and the destination physical address.

[0118] In some embodiments, the method may further include: if the attribute bit of the home page table entry indicates disabling the address translation auxiliary page table, determining that the physical memory address corresponding to the home page table entry is the target physical memory address corresponding to the virtual address.

[0119] If the attribute bit of the home page table entry indicates disabling the address translation auxiliary page table, it is determined to use the address translation home page table to determine the mapping relationship between the virtual address and the physical memory address, and the processor determines the target physical memory address based on the physical memory base address in the home page table entry and the page offset value of the target virtual address.

[0120] S203: Determine a target physical memory address corresponding to the target virtual address from the physical memory address of the auxiliary page table entry of the address translation auxiliary page table.

[0121] In this embodiment, the target physical memory address is obtained according to the physical memory base address in the auxiliary page table entry plus the page offset value in the target virtual address.

[0122] In some embodiments, for the aforementioned first category of content, the mapping relationship between the virtual address and the physical memory address of the first category of content is added to each address translation auxiliary page table according to the storage address of the first category of content in each physical memory, and the physical memory address of the home page table entry corresponding to the virtual address of the first category of content in the address translation home page table is modified to the index value of the mapping relationship between the virtual address and the physical memory address of the first category of content in the address translation auxiliary page table, and the attribute bit of the home page table entry is modified to indicate that the address translation auxiliary page table is used to determine the mapping relationship between the virtual address and the physical memory address.

[0123] For the aforementioned second category of content, based on the storage address of the second category of content in the physical memory, the mapping relationship between the virtual address and the physical memory address of the second category of content is stored in all address translation home page tables, and the attribute bit of the home page table entry corresponding to the virtual address of the second category of content is determined to indicate by default that the address translation home page table is used to determine the mapping relationship between the virtual address and the physical memory address.

[0124] The address translation configuration method provided in the above embodiment determines the target physical memory address by using the address translation home page table according to the attribute bit indication in the address translation home page table, or determines the target physical memory address by using the address translation auxiliary page table. If the target physical memory address is determined by using the address translation auxiliary page table, it can be achieved that when the home page tables of each processor are the same, local multiple copies of access to different physical memory addresses can be performed for the same virtual address; by setting the attribute bit, compatibility of local multiple copies of access to different virtual addresses and cross-node access can be achieved, thereby improving the flexibility of the multi-core processor system.

[0125] In another possible implementation, Figure 4 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 3 ,like Figure 4 As shown, the process of determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table in S102 may include:

[0126] S204: Determine the main page table entry and the attribute bit of the main page table entry corresponding to the target virtual address from the address translation main page table, and determine the auxiliary page table entry corresponding to the target virtual address from the address translation auxiliary page table.

[0127] S205: Determine the target physical memory address corresponding to the target virtual address from the physical memory addresses corresponding to the main page table entry and the auxiliary page table entry respectively according to the attribute bit of the main page table entry.

[0128] In this embodiment, in order to improve the efficiency of determining the target physical memory address that matches the target virtual address, the target physical memory address can be determined by using a parallel search method of the address translation main page table and the address translation auxiliary page table.

[0129] The main page table entry and the attribute bits corresponding to the main page table entry are determined according to the first address of the address translation main page table and the page start address of the target virtual address. At the same time, the auxiliary page table entry is determined according to the first address of the address translation auxiliary page table and the page start address of the target virtual address. Then, according to the attribute bits of the main page table entry, it is determined whether to use the address translation main page table to determine the mapping relationship between the virtual address and the physical memory address, or to use the address translation auxiliary page table to determine the mapping relationship between the virtual address and the physical memory address.

[0130] If the attribute bit of the home page table entry indicates that the address translation home page table is used to determine the mapping relationship between the virtual address and the physical memory address, the target physical memory address is determined based on the physical memory base address in the home page table entry and the offset value of the target virtual address; if the attribute bit of the home page table entry indicates that the address translation auxiliary page table is used to determine the mapping relationship between the virtual address and the physical memory address, the target physical memory address is determined based on the physical memory base address in the auxiliary page table entry and the offset value of the target virtual address.

[0131] Different from the above-mentioned serial search method, the main page table entries and auxiliary page table entries in the parallel search method store the mapping relationship between the virtual address and the physical memory base address, and the first addresses of the address translation main page table and the address translation auxiliary page table are stored in preset registers.

[0132] In some embodiments, for the aforementioned first category of content, the mapping relationship between the virtual address and the physical memory address of the first category of content is added to each address translation auxiliary page table according to the storage address of the first category of content in each physical memory, and the attribute bit of the home page table entry corresponding to the virtual address of the first category of content in the address translation home page table is modified to indicate that the address translation auxiliary page table is used to determine the mapping relationship between the virtual address and the physical memory address.

[0133] For the aforementioned second category of content, the mapping relationship between the virtual address and the physical memory address of the second category of content is stored in all address translation home page tables according to the storage address of the second category of content in the physical memory, and the mapping relationship between the virtual address and the physical memory address of the second category of content is not stored in the auxiliary page table, and the attribute bit of the home page table entry corresponding to the virtual address of the second category of content is determined to indicate by default that the address translation home page table is used to determine the mapping relationship between the virtual address and the physical memory address.

[0134] The address conversion configuration method provided in the above embodiment indicates that the target physical memory address is determined by using the address conversion homepage table according to the attribute bit in the address conversion homepage table, or the target physical memory address is determined by using the address conversion auxiliary page table. If the target physical memory address is determined by using the address conversion auxiliary page table, it can be achieved that when the homepage tables of each processor are the same, local multiple copies of different physical memory addresses are accessed for the same virtual address; the compatibility of local multiple copies of different virtual addresses and cross-node access can be achieved by setting the attribute bit, thereby improving the flexibility of the multi-core processor system. In addition, parallel search of the address conversion homepage table and the address conversion auxiliary page table can also improve the speed and efficiency of searching the target physical memory address.

[0135] In some embodiments, the processor includes: a memory management unit (MMU) and a translation lookaside buffer (TLB). In order to improve the efficiency of determining the physical memory address according to the virtual address, after receiving the address access request, the MMU will first search for a matching target physical memory address in the TLB according to the target virtual address. If the matching target physical memory address is not found in the TLB, that is, a TLB miss, the target physical memory address is determined from the address translation main page table and the address translation auxiliary page table according to the target virtual address. Afterwards, the mapping relationship between the determined target physical memory address and the target virtual address will also be cached in the TLB.

[0136] For example, the address conversion configuration method is implemented on the armv8 architecture as an example.

[0137] In armv8, the base address of the address translation main page table stage1 is indicated by the ttbr0_el1 register, and the base address of the address translation auxiliary page table stage2 is indicated by vttbr0_el2. In the armv8 processor with the FEAT_HPDS2 feature, the page table entry has a PBHA attribute bit. When this solution is adopted, one of the bits can be selected to indicate whether the address translation auxiliary page table stage2 is enabled for the page table entry. The selected bit can be bit62. When bit62 is 0, it means that the address translation auxiliary page table stage2 is disabled. When bit62 is 1, it means that the address translation auxiliary page table stage2 is enabled.

[0138] When a serial search method is used, the input of the address translation auxiliary page table stage2 is the index value obtained by searching the address translation main page table stage1, that is, the index physical address or the destination physical address; when a parallel search method is used, the input of the address translation auxiliary page table stage2 is the target virtual address.

[0139] In one possible implementation, Figure 5 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 4 ,like Figure 5 As shown, before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table in the above S102, the method may further include:

[0140] S301 . Allocate storage space for first content used for making multiple copies in multiple physical memories, respectively, with each processor corresponding to one physical memory.

[0141] S302: Copy the first content to storage spaces allocated by multiple physical memories.

[0142] S303: Generate multiple address translation auxiliary page tables corresponding to the physical memories according to the physical memory address corresponding to the storage space of the first content, wherein the address translation auxiliary page table stores the mapping relationship between the physical memory address of the first content and the virtual address of the application executing the first content.

[0143] In this embodiment, for the content required by the application running in the operating system, the first content that needs to be copied is selected, that is, the first category of content mentioned above. Multiple copies means that the first content is stored in copies in the physical memories corresponding to the multiple processors where the application may run. In order to achieve multiple copies of the first content, when the operating system receives a request to install multiple copies of the first content, it will allocate memory for the first content in each physical memory corresponding to the processor where the application may run, and then copy the first content to the storage space allocated to the multiple physical memories.

[0144] After multiple copies are achieved by copying the first content to storage spaces allocated by multiple physical memories, in order to coordinate the contents of the multiple copies so that when the application runs on each processor, the processor can directly call the target content in the physical memory within the node, it is necessary to modify the existing address translation page table.

[0145] The specific modification method is: the existing address translation page table stores the mapping relationship between the virtual address of the first content and the physical memory address of the first content in the original physical memory. After completing multiple copies of the first content, an address translation auxiliary page table is created in each physical memory, and the mapping relationship between the virtual address of the first content and the physical memory address is stored in the address translation auxiliary page table. The original address translation page table is used as the address translation home page table, and the attribute bit of the home page table entry corresponding to the virtual address of the first content in the address translation home page table is modified.

[0146] In a possible implementation, the method may further include:

[0147] In the address translation home page tables corresponding to the multiple physical memories, the attribute bits of the home page table entries corresponding to the first content are respectively modified to enable the address translation auxiliary page table.

[0148] In this embodiment, the existing address translation page table is used as the address translation main page table, and the attribute bit of the main page table entry corresponding to the virtual address of the first content in the address translation main page table is modified to enable the address translation auxiliary page table to indicate that the physical memory address corresponding to the virtual address is determined according to the address translation auxiliary page table.

[0149] In some embodiments, if a serial search method is used to search the address translation main page table and the address translation auxiliary page table, the physical memory address stored in the main page table entry corresponding to the virtual address of the first content in the address translation main page table needs to be modified to the index value of the auxiliary page table entry in the address translation auxiliary page table, and the index value is the destination physical address of the auxiliary page table entry in the address translation auxiliary page table.

[0150] The address translation configuration method provided in the above embodiment realizes multiple copies of the first content by copying the first content used for multiple copies in each physical memory, and creates an address translation auxiliary page table in each physical memory for the multiple copies of the first content, so that the processor can call the content in the local memory of the application based on the address translation auxiliary page table, avoid cross-node access, and improve program operation efficiency and system performance.

[0151] In one possible implementation, when the first content needs to be upgraded, after receiving a code dynamic update request, the processor modifies the attribute bit of the home page table entry in the address translation home page table to disable the address translation auxiliary page table, and then upgrades the first content in each physical memory. After the upgrade is successful, the attribute bit of the home page table entry in the address translation home page table is modified to enable the address translation auxiliary page table.

[0152] If there are new first contents with multiple copies, it is necessary to add a new auxiliary page table entry in the address translation auxiliary page table.

[0153] In one possible implementation, Figure 6 The architecture diagram of the virtualized multi-core processor system provided in the embodiment of the present application is as follows: Figure 6 As shown, the virtualized multi-core processor system may include: multiple virtual processors (VCPUs) corresponding to the virtual machines, multiple physical processors (physical CPUs) and multiple physical memories, wherein the virtual processors correspond to the physical processors one-to-one, each NUMA node is configured with at least one physical processor and one physical memory, the virtual machine manages the virtual processors, and the virtual machine monitor (hypervisor) manages the physical processors and the physical memory.

[0154] When the application process is running, the virtual machine can call the lines on different virtual processors to run the application process, and the virtual processor needs to borrow the processing resources of the corresponding physical processor to support the running of the application process.

[0155] When the virtual machine monitor receives an address access request initiated by an application, it obtains the address translation page table of the target physical processor corresponding to the target virtual processor according to the target virtual address, determines the target physical memory address corresponding to the target virtual address according to the address translation page table, and reads the target content from the target physical memory address of the target physical processor.

[0156] It should be noted that in a multi-core processor system of a virtual machine, the conversion from the virtual machine virtual address to the virtual machine physical address and then to the host physical address is involved. This embodiment is aimed at the conversion from the virtual machine physical address (guest physical address) to the host physical address (host physical address). The target virtual address in this embodiment is the virtual machine physical address corresponding to the virtual machine virtual address of the application program, and the address conversion page table stores the host physical address corresponding to the virtual machine physical address.

[0157] The specific implementation method of creating an address translation auxiliary page table for a multi-core processor system applied to a virtual machine is described below in conjunction with an embodiment.

[0158] In one possible implementation, Figure 7 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 5 ,like Figure 7 As shown, before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table in the above S102, the method further includes:

[0159] S401. Obtain a global address translation page table of a virtual machine through a virtual machine monitor.

[0160] In this embodiment, the global address translation page table of the virtual machine is an existing address translation page table of the virtual machine, and the existing address translation page table stores the mapping relationship between the virtual machine physical address and the physical memory address.

[0161] In the existing solution, for applications running in different virtual processors, the existing address translation page table can only be mapped to the same physical memory address. When the content to be obtained is in the physical memory of other nodes, it is necessary to access the physical memory across nodes. This embodiment uses the existing address translation page table as the global address translation page table, that is, the address translation main page table, and combines it with the address translation auxiliary page table to achieve that for applications running in different virtual processors, the virtual address is directly mapped to the physical memory of the current node to obtain the content.

[0162] S402: Create an address translation auxiliary page table for each of the multiple physical memories.

[0163] In this embodiment, when the virtual machine monitor receives a request to create multiple copies of the second content, an address translation auxiliary page table is created for the physical memory in each NUMA node owned by the virtual machine monitor.

[0164] S403: Determine a physical memory address of a second content from a global address translation page table, where the second content is content used for making multiple copies.

[0165] In this embodiment, for the content required by the application running in the operating system, the second content that needs to be copied is selected, that is, the first category of content mentioned above, and the global page table entry corresponding to the virtual address of the second content is determined based on the page start address in the virtual address of the second content and the first address of the global address translation page table. The physical memory address of the second content in the physical memory is determined based on the physical memory base address in the global page table entry and the page offset value in the virtual address of the second content.

[0166] In some embodiments, the virtual machine monitor may obtain the virtual address of the second content by converting a page table of the virtual address of the virtual machine according to the virtual address of the second content, obtaining the virtual machine physical address of the second content, and using the virtual machine physical address of the second content as the virtual address of the second content.

[0167] In other embodiments, the page table entries in the virtual address translation page table of the virtual machine are divided into type 1 and type 2, wherein the content corresponding to the type 1 page table entry is the first category of content, and the content corresponding to the type 2 page table entry is the second category of content. The virtual machine monitor searches for the type 1 page table entry from the virtual address translation page table, and uses the virtual machine physical address recorded in the type 1 page table entry as the virtual address of the second content.

[0168] For example, Figure 8 The address mapping diagram provided for this embodiment is as follows: Figure 8 As shown, for type 1 page table entries in the virtual address translation page table, in different virtual processors, the host physical address corresponding to the virtual machine physical address is mapped to the physical memory of the node where the physical processor corresponding to each virtual processor is located. For type 2 page table entries in the virtual address translation page table, in different virtual processors, the host physical address corresponding to the virtual machine physical address is mapped to the specified physical memory.

[0169] It should be noted that the second content in this embodiment and the aforementioned first content are both first-category content, but are referred to as “first” and “second” to distinguish them and avoid ambiguity.

[0170] S404: Copy corresponding content in multiple physical memories according to the content in the physical memory address of the second content.

[0171] In this embodiment, a physical memory page (host page) is allocated in the physical memory of each NUMA node owned by the virtual machine monitor, the second content is obtained from the physical memory according to the physical memory address of the second content in the physical memory, and the second content is copied to the physical memory page allocated to each physical memory.

[0172] S405. According to the physical memory addresses of the copied contents in the multiple physical memories, the corresponding physical memory addresses and the mapping relationship between the physical memory addresses and the virtual addresses of the second contents are stored in the address translation auxiliary page tables of the multiple physical memories respectively.

[0173] In this embodiment, according to the virtual address of the second content in the guest page of the virtual processor, the mapping relationship between the virtual address of the second content and the physical memory address of the second content in the corresponding physical memory is stored in the address translation auxiliary page table of each physical memory.

[0174] In some embodiments, in virtualization mode, the attribute bits of the home page table entries of the address translation home page tables of the physical processors corresponding to all virtual processors are enabled, and the virtual addresses of the contents that do not need to be copied have the same mapped physical memory addresses in each address translation auxiliary page table.

[0175] In one possible implementation, for content that does not require multiple copies, the global page table entry corresponding to the virtual address of the content is determined in the global address translation page table based on the virtual address used by the application in the virtual machine to execute the content, and the attribute bit of the global page table entry is modified to disable the address translation auxiliary page table.

[0176] In a possible implementation method, the process of determining the physical memory address of the second content from the global address translation page table in S403 may include:

[0177] According to the virtual address of the second content sent by the virtual machine based on the instruction of the application, the physical memory address corresponding to the virtual address of the second content is determined from the global address translation page table; or, according to the page table entry corresponding to the second content sent by the virtual machine based on the instruction of the application, the physical memory address of the second content is determined from the global address translation page table.

[0178] In this embodiment, in order to simplify the work content of the virtual machine monitor, the virtual machine monitor does not search for the virtual address of the second content from the virtual address translation page table of the virtual machine. One way is that when the virtual machine receives an address access request initiated by the application for the second content, the virtual machine monitor directly sends the virtual address corresponding to the second content to the virtual machine monitor, and the virtual machine monitor determines the physical memory address corresponding to the virtual address of the second content from the global address translation page table according to the virtual address of the second content; in another way, the virtual machine notifies the virtual machine monitor of a set of page table entries (guest physical page) belonging to type 1 in the virtual address translation page table, so that the virtual machine monitor determines each virtual address in the set of page table entries of type 1 from the virtual address translation page table, and the virtual machine monitor determines the physical memory address corresponding to each virtual address from the global address translation page table according to each virtual address in the set of page table entries of type 1, wherein each virtual address in the set of page table entries of type 1 is a virtual address of the second content that needs to be copied in multiple copies.

[0179] In some embodiments, if the virtual machine sends a set of page table entries belonging to type 1 in the virtual address translation page table to the virtual machine monitor, a multiple copy request may be initiated through other applications.

[0180] The address translation configuration method provided in the above embodiment creates an address translation auxiliary page table for each physical memory, determines the physical memory address of the second content from the global address translation page table according to the virtual address of the second content, and copies the second content from the physical memory address of the second content to multiple physical memories. According to the address of the copied second memory in each physical memory, the mapping relationship between the virtual address of the second content and the physical memory address is stored in the address translation auxiliary page table, so that when the application runs on different virtual processors, the same virtual address can be mapped to the physical memory of different nodes, avoiding cross-node memory access, thereby improving the operation efficiency of the application and system performance.

[0181] In one possible implementation, Fig. 9 Schematic diagram of the address conversion configuration method provided in the embodiment of the present application Figure 6 ,like Fig. 9 As shown, before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table in the above S102, the method further includes:

[0182] S501: Receive multiple groups of virtual memory page sets sent by a virtual machine, each group of virtual memory page sets including multiple source virtual memory pages and destination virtual memory pages for address mapping.

[0183] S502: Create address translation auxiliary page tables for multiple physical memories respectively.

[0184] S503. According to the physical memory address of the destination virtual memory page in the corresponding physical memory, a mapping relationship between the virtual address of the source virtual memory page and the physical memory address corresponding to the destination virtual memory page is stored in the address translation auxiliary page table of each physical memory.

[0185] In this embodiment, the application in the virtual machine directly completes the copying of the second content in the physical memory pages of each physical memory, determines the physical memory addresses of the copied second content in each physical memory, and each physical memory page of the physical memory has a corresponding virtual memory page in the virtual machine.

[0186] For the second content with multiple copies, the virtual machine uses the virtual memory page of the second content in the virtual machine as the source virtual memory page, and uses the virtual memory page corresponding to the physical memory page of the created multiple copies in the virtual machine as the destination virtual memory page, to build a virtual memory page set of the source virtual memory page and each destination virtual memory page.

[0187] After receiving multiple groups of virtual memory page sets, the virtual machine monitor stores the mapping relationship between the virtual address of the source virtual memory page and the physical memory address of the destination virtual memory page in the address translation auxiliary page table of the physical memory targeted by each group of virtual memory page sets, based on the physical memory address of the physical memory page corresponding to the destination virtual memory page in each virtual memory page set and the virtual address of the source virtual memory page.

[0188] For example, the address mapping request format is defined as (gaddrx1, gaddry1), (gaddrx2, gaddry2), .... Assume that the virtual machine monitor receives a set of virtual address memory pages included in the address mapping request sent by the virtual machine as (gaddr1, gaddr2), (gaddr5, gaddr6), ..., and another set of virtual address memory pages is (gaddr1, gaddr3), (gaddr5, gaddr7), ..., Table 1 is the mapping relationship between the virtual address and the physical memory address. As shown in Table 1, in the global address translation page table, the physical memory address corresponding to gaddr1 is haddr1, the physical memory address corresponding to gaddr2 is haddr2, the physical memory address corresponding to gaddr3 is haddr3, the physical memory address corresponding to gaddr5 is haddr5, the physical memory address corresponding to gaddr6 is haddr6, and the physical memory address corresponding to gaddr7 is haddr7.

[0189] In the address translation auxiliary page table of the second physical memory, the physical memory address corresponding to the virtual address gaddr1 is mapped to the physical memory address haddr2 corresponding to the virtual address gaddr2, and the physical memory address corresponding to the virtual address gaddr5 is mapped to the physical memory address haddr6 corresponding to the virtual address gaddr6. In the address translation auxiliary page table of the third physical memory, the physical memory address corresponding to the virtual address gaddr1 is mapped to the physical memory address haddr3 corresponding to the virtual address gaddr3, and the physical memory address corresponding to the virtual address gaddr5 is mapped to the physical memory address haddr7 corresponding to the virtual address gaddr7. When the application runs on different virtual processors, even the same virtual address can be mapped to the physical memory where the physical processor corresponding to the virtual processor is located, avoiding cross-node address access.

[0190] Table 1 Mapping relationship between virtual address and physical memory address

[0191]

[0192] In some embodiments, the global address translation page table stores the host physical address corresponding to the virtual machine physical address, and based on a set of type 1 page table entries (guest physical pages) in the virtual address translation page table sent by the virtual machine, the host physical pages corresponding to the guest physical pages are determined from the global address translation page table, and the virtual address corresponding to the guest physical page of the content that needs to be copied and the physical memory address of the corresponding host physical page are stored in each address translation auxiliary page table.

[0193] The address translation configuration method provided in the above embodiment stores the mapping relationship between the virtual address of the source virtual memory page and the physical memory address corresponding to the destination virtual memory page in the address translation auxiliary page table of each physical memory according to the source virtual memory page and the destination virtual memory page used for address mapping in the virtual memory page set and the physical memory address of the destination virtual memory page in the corresponding physical memory. This eliminates the need for the virtual machine monitor to allocate physical memory and copy code on its own, thereby simplifying the work of the virtual machine monitor.

[0194] In a possible implementation, the method may further include:

[0195] After detecting the change of the virtual address corresponding to the target content, the virtual machine monitor is notified to modify the mapping relationship between the virtual address and the physical memory address in the address translation auxiliary page table.

[0196] In this embodiment, when the virtual address of the application is not locked, the virtual address of the application may change according to the situation of the processor executing the task. In order to ensure that the mapping relationship in the address translation auxiliary page table is correct, it is necessary to monitor the virtual machine address translation page table of the virtual machine through the monitoring mechanism mmu_notifier registered inside the virtual machine. When it is detected that the mapping relationship between the virtual address of the content in the virtual machine and the physical address of the virtual machine has changed, it is necessary to notify the virtual machine monitor, and the virtual machine monitor will map the mapping relationship between the virtual machine physical address and the host physical address in each address translation auxiliary page table.

[0197] The address translation configuration method provided in the above embodiment monitors the change of the address mapping relationship and promptly modifies the address translation auxiliary page table to ensure the correctness of the mapping relationship, thereby ensuring the normal operation of the application program.

[0198] In a possible implementation, the process of reading the target content according to the target physical memory address in S103 may include:

[0199] If the target physical memory address is a physical memory address in the physical memory corresponding to the target processor, the target content is read from the physical memory corresponding to the target processor according to the target physical memory address.

[0200] In this embodiment, for the case where the target virtual address corresponds to multiple physical memory addresses in different address translation page tables, for the target processor on which the application runs, the target physical memory address corresponding to the target virtual address is the storage address in the physical memory of the node where the target processor is located. The target processor can directly read the target content in the physical memory of this node, avoiding cross-node access, thereby improving the efficiency of the application and system performance.

[0201] In another possible implementation, the process of reading the target content according to the target physical memory address in S103 may include:

[0202] If the target physical content address is a physical memory address in a fixed physical memory among the multiple physical memories, the target content is read from the fixed physical memory according to the target physical memory address.

[0203] In this embodiment, in the case where the target virtual address corresponds to the same physical memory address in different address translation page tables, the physical memory address is an address in a fixed physical memory among multiple physical memories, and the target processor needs to access the fixed physical memory across nodes to read the content.

[0204] The address conversion configuration method provided in the above embodiment divides the virtual address into corresponding multiple physical memory addresses and one physical memory address, so that a part of the virtual address stores the same content in multiple physical memory addresses to avoid cross-node access, and the other part of the virtual address stores the content in one physical memory address to achieve cross-node access, so as to realize compatibility of local multiple copy access and cross-node access when the application calls different content, thereby improving the flexibility of the multi-core processor system.

[0205] In the above method embodiment, the embodiment of the present application also provides an address translation configuration device, which is applied to a multi-core processor system. Fig.10 A schematic diagram of the structure of the address conversion configuration device provided in the embodiment of the present application, such as Fig.10 As shown, the device may include:

[0206] The page table acquisition module 601 is used to respond to the address access request initiated by the application program and acquire the address translation page table of the target processor. The address access request includes: the target virtual address. The address translation page table is used to indicate the mapping relationship between the virtual address and the physical memory address.

[0207] A physical address determination module 602 is used to determine a target physical memory address in a page table entry corresponding to a target virtual address from an address translation page table, wherein the address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address, wherein one virtual address corresponds to one or more physical memory addresses in address translation page tables of different processors, and when one virtual address corresponds to multiple physical memory addresses, the positions of multiple physical memory address pairs store the same content;

[0208] The content reading module 603 is used to read the target content according to the target physical memory address, and the target content includes: target code or target data.

[0209] Optionally, the address translation page table includes: an address translation main page table and an address translation auxiliary page table; a physical address determination module 602, which is specifically used to determine the main page table entry and the attribute bits of the main page table entry corresponding to the target virtual address from the address translation main page table; determine to search the address translation auxiliary page table according to the attribute bits of the main page table entry; determine the target physical memory address corresponding to the target virtual address from the physical memory address of the auxiliary page table entry of the address translation auxiliary page table.

[0210] Optionally, the address translation page table includes: an address translation main page table and an address translation auxiliary page table; a physical address determination module 602, which is specifically used to determine the main page table entry and the attribute bits of the main page table entry corresponding to the target virtual address from the address translation main page table, and determine the auxiliary page table entry corresponding to the target virtual address from the address translation auxiliary page table; according to the attribute bits of the main page table entry, determine the target physical memory address corresponding to the target virtual address from the physical memory addresses corresponding to the main page table entry and the auxiliary page table entry respectively.

[0211] Optionally, the physical address determination module 602 is also used to determine to search the address translation auxiliary page table if the attribute bit of the home page table entry indicates that the address translation auxiliary page table is enabled; if the attribute bit of the home page table entry indicates that the address translation auxiliary page table is disabled, determine that the physical memory address corresponding to the home page table entry is the target physical memory address corresponding to the virtual address.

[0212] Optionally, before the physical address determination module 602, the device may further include:

[0213] The auxiliary page table creation module is used to create a first content for multiple copies in multiple pages.

[0214] A physical memory is allocated with storage space for the first content, each processor corresponds to a physical memory; the first content is copied to the storage space allocated to the multiple physical memories; according to the physical memory address corresponding to the storage space of the first content, an address translation auxiliary page table corresponding to each of the multiple physical memories is generated, wherein the address translation auxiliary page table stores the physical memory address of the first content and the mapping relationship between the virtual address of the application program executing the first content.

[0215] Optionally, the device may further include:

[0216] The attribute bit modification module is used to modify the attribute bit of the home page table entry corresponding to the first content in the address translation home page tables corresponding to the multiple physical memories to enable the address translation auxiliary page table.

[0217] Optionally, the auxiliary page table creation module is also used to obtain the global address translation page table of the virtual machine through the virtual machine monitor; create an address translation auxiliary page table for multiple physical memories respectively; determine the physical memory address of the second content from the global address translation page table, the second content is the content used for multiple copies; according to the content in the physical memory address of the second content, copy the corresponding content in multiple physical memories; according to the physical memory addresses of the copied content in multiple physical memories, store the corresponding physical memory addresses in the address translation auxiliary page tables of the multiple physical memories respectively, as well as the mapping relationship between the virtual address of the second content.

[0218] Optionally, the auxiliary page table creation module is also used to determine the physical memory address corresponding to the virtual address of the second content from the global address translation page table according to the virtual address of the second content sent by the virtual machine based on the instructions of the application; or, receive the page table entry corresponding to the second content sent by the virtual machine based on the instructions of the application, and determine the physical memory address of the second content from the global address translation page table according to the page table entry corresponding to the second content.

[0219] Optionally, the auxiliary page table creation module is also used to receive multiple groups of virtual memory page sets sent by the virtual machine, each group of virtual memory page sets includes multiple source virtual memory pages and destination virtual memory pages for address mapping; create address translation auxiliary page tables for multiple physical memories respectively; and store the mapping relationship between the virtual address of the source virtual memory page and the physical memory address corresponding to the destination virtual memory page in the address translation auxiliary page table of each physical memory according to the physical memory address of the destination virtual memory page in the corresponding physical memory.

[0220] Optionally, the device may further include:

[0221] The monitoring module is used to notify the virtual machine monitor to modify the mapping relationship between the virtual address and the physical memory address in the address translation auxiliary page table after detecting the change of the virtual address corresponding to the target content.

[0222] Optionally, the content reading module 603 is specifically configured to read the target content from the physical memory corresponding to the target processor according to the target physical memory address if the target physical memory address is a physical memory address in the physical memory corresponding to the target processor.

[0223] Optionally, the content reading module 603 is specifically configured to read the target content from the fixed physical memory according to the target physical memory address if the target physical content address is a physical memory address in a fixed physical memory among the multiple physical memories.

[0224] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0225] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0226] Fig.11 A schematic diagram of an electronic device provided in an embodiment of the present application, such as Fig.11As shown, the electronic device includes: a processor 701, a storage medium 702 and a bus, the storage medium 702 stores program instructions executable by the processor 701, when the electronic device is running, the processor 701 and the storage medium 702 communicate through the bus, and the processor 701 executes the program instructions to execute the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.

[0227] Optionally, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the above method embodiment is executed.

[0228] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, 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 integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0229] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, 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 solution of this embodiment.

[0230] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0231] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0232] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. An address translation configuration method, characterized in that: Applied to a multi-core processor system, the method comprises: In response to an address access request initiated by an application, an address translation page table of a target processor is obtained, wherein the address access request includes: a target virtual address, and the address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address; Determine a target physical memory address in a page table entry corresponding to the target virtual address from the address translation page table, wherein one of the virtual addresses corresponds to one or more physical memory addresses in the address translation page tables of different processors, and when one of the virtual addresses corresponds to multiple physical memory addresses, the locations corresponding to the multiple physical memory addresses store the same content; According to the target physical memory address, the target content is read, and the target content includes: target code or target data.

2. The method according to claim 1, characterized in that: The address translation page table includes: an address translation main page table and an address translation auxiliary page table; the step of determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table includes: Determine the home page table entry corresponding to the target virtual address and the attribute bit of the home page table entry from the address conversion home page table; According to the attribute bit of the main page table entry, determining to search the address translation auxiliary page table; The target physical memory address corresponding to the target virtual address is determined from the physical memory address of the auxiliary page table entry of the address translation auxiliary page table.

3. The method according to claim 1, characterized in that The address translation page table includes: an address translation main page table and an address translation auxiliary page table; the step of determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table includes: Determine the home page table entry and the attribute bit of the home page table entry corresponding to the target virtual address from the address translation home page table, and determine the auxiliary page table entry corresponding to the target virtual address from the address translation auxiliary page table; According to the attribute bit of the main page table entry, the target physical memory address corresponding to the target virtual address is determined from the physical memory addresses respectively corresponding to the main page table entry and the auxiliary page table entry.

4. The method according to claim 2, characterized in that: The step of determining to search the address translation auxiliary page table according to the attribute bit of the main page table entry includes: If the attribute bit of the main page table entry indicates that the address translation auxiliary page table is enabled, determining to search the address translation auxiliary page table; The method further comprises: If the attribute bit of the home page table entry indicates that the address translation auxiliary page table is disabled, then the physical memory address corresponding to the home page table entry is determined to be the target physical memory address corresponding to the virtual address.

5. The method according to claim 2 or 3, characterized in that: Before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table, the method further includes: For the first content used for making multiple copies, storage space is allocated for the first content in multiple physical memories respectively, and each processor corresponds to one physical memory; Copying the first content to the storage space allocated by the plurality of physical memories; According to the physical memory address corresponding to the storage space of the first content, an address translation auxiliary page table corresponding to the multiple physical memories is generated, and the address translation auxiliary page table stores the physical memory address of the first content and the mapping relationship between the virtual address of the application executing the first content.

6. The method according to claim 5, characterized in that The method further comprises: In the address translation main page tables corresponding to the multiple physical memories, the attribute bits of the main page table entries corresponding to the first content are respectively modified to enable the address translation auxiliary page table.

7. The method according to claim 2 or 3, characterized in that: Before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table, the method further includes: Obtaining the global address translation page table of the virtual machine through the virtual machine monitor; Create an address translation auxiliary page table for multiple physical memories respectively; Determine a physical memory address of a second content from the global address translation page table, where the second content is content used for making multiple copies; According to the content in the physical memory address of the second content, copy the corresponding content in the multiple physical memories; According to the physical memory addresses of the copied contents in the multiple physical memories, the corresponding physical memory addresses and the mapping relationship between the physical memory addresses and the virtual addresses of the second contents are respectively stored in the address translation auxiliary page tables of the multiple physical memories.

8. The method according to claim 7, characterized in that The determining the physical memory address of the second content from the global address translation page table includes: Determining the physical memory address corresponding to the virtual address of the second content from the global address translation page table according to the virtual address of the second content sent by the virtual machine based on the instruction of the application program; or, According to the page table entry corresponding to the second content sent by the virtual machine based on the instruction of the application program, the physical memory address of the second content is determined from the global address translation page table.

9. The method according to claim 2 or 3, characterized in that: Before determining the target physical memory address in the page table entry corresponding to the target virtual address from the address translation page table, the method further includes: The receiving virtual machine sends multiple sets of virtual memory page sets, each set of virtual memory page sets includes multiple source virtual memory pages and destination virtual memory pages for address mapping; Create address translation auxiliary page tables for multiple physical memories respectively; According to the physical memory address of the destination virtual memory page in the corresponding physical memory, a mapping relationship between the virtual address of the source virtual memory page and the physical memory address corresponding to the destination virtual memory page is stored in the address translation auxiliary page table of each physical memory.

10. The method according to claim 2 or 3, characterized in that: The method further comprises: After detecting a change in the virtual address corresponding to the target content, the virtual machine monitor is notified to modify the mapping relationship between the virtual address and the physical memory address in the address translation auxiliary page table.

11. The method according to claim 1, characterized in that: The step of reading the target content according to the target physical memory address includes: If the target physical memory address is a physical memory address in the physical memory corresponding to the target processor, the target content is read from the physical memory corresponding to the target processor according to the target physical memory address.

12. The method according to claim 1, characterized in that The step of reading the target content according to the target physical memory address includes: If the target physical memory address is a physical memory address in a fixed physical memory among the multiple physical memories, the target content is read from the fixed physical memory according to the target physical memory address.

13. An address translation configuration device, characterized in that: Applied to a multi-core processor system, the device comprises: A page table acquisition module is used to respond to an address access request initiated by an application program and acquire an address translation page table of a target processor, wherein the address access request includes: a target virtual address, and the address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address; a physical address determination module, used to determine a target physical memory address in a page table entry corresponding to the target virtual address from the address translation page table, wherein the address translation page table is used to indicate a mapping relationship between a virtual address and a physical memory address, wherein one of the virtual addresses corresponds to one or more physical memory addresses in the address translation page tables of different processors, and when one of the virtual addresses corresponds to multiple physical memory addresses, the positions of the multiple physical memory address pairs store the same content; The content reading module is used to read the target content according to the target physical memory address, and the target content includes: target code or target data.

14. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the address conversion configuration method as described in any one of claims 1 to 12.

15. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the address translation configuration method according to any one of claims 1 to 12 are executed.