Method and system for performing virtual to physical address translations in a virtual machine monitor
First Claim
1. A method for attempting to determine memory mappings between virtual addresses and physical addresses in a Virtual Machine Monitor (VMM), the VMM running on a physical computer having a plurality of physical processors and implementing a virtual memory system that is used by the physical processors, the method being used during a software-based processing of one or more guest instructions, the processing of the one or more guest instructions requiring one or more guest memory mappings, the method comprising:
- (A) establishing a data store for memory mappings between virtual addresses and physical addresses that is separate from the virtual memory system used by the physical processors;
(B) for one or more of the required memory mappings, performing the following steps;
(1) searching the data store for a virtual address for the required memory mapping, and performing the following step;
(2) if a matching virtual address is not found, performing the following steps;
(a) attempting to establish the required memory mapping according to the virtual memory system used by the physical processors;
(b) if the required memory mapping is established according to the virtual memory system, using the established memory mapping, and adding an entry to the data store indicating the established memory mapping for the virtual address and retaining the established memory mapping at least until the software-based processing of a current guest instruction is completed; and
(c) if the required memory mapping is not established according to the virtual memory system, using no memory mapping, and adding an entry to the data store indicating that a memory mapping was not found for the virtual address; and
(3) if a matching virtual address is found, performing the following steps;
(a) if an entry containing the matching virtual address indicates that a memory mapping was not found for the virtual address, using no memory mapping; and
(b) if an entry containing the matching virtual address indicates that a memory mapping was found for the virtual address, using the memory mapping indicated in the entry; and
(C) upon completing the processing of one or more guest instructions, invalidating all entries in the data store.
1 Assignment
0 Petitions
Accused Products
Abstract
The invention is used in a virtual machine monitor for a multiprocessing system that includes a virtual memory system. During a software-based processing of a guest instruction, including translating or interpreting a guest instruction, mappings between virtual addresses and physical addresses are retained in memory until processing of the guest instruction is completed. The retained mappings may be cleared after each guest instruction has been processed, or after multiple guest instructions have been processed. Information may also be stored to indicate that an attempt to map a virtual address to a physical address was not successful. The invention may be extended beyond virtual machine monitors to other systems involving the software-based processing of instructions, and beyond multiprocessing systems to other systems involving concurrent access to virtual memory management data.
165 Citations
27 Claims
-
1. A method for attempting to determine memory mappings between virtual addresses and physical addresses in a Virtual Machine Monitor (VMM), the VMM running on a physical computer having a plurality of physical processors and implementing a virtual memory system that is used by the physical processors, the method being used during a software-based processing of one or more guest instructions, the processing of the one or more guest instructions requiring one or more guest memory mappings, the method comprising:
-
(A) establishing a data store for memory mappings between virtual addresses and physical addresses that is separate from the virtual memory system used by the physical processors; (B) for one or more of the required memory mappings, performing the following steps; (1) searching the data store for a virtual address for the required memory mapping, and performing the following step; (2) if a matching virtual address is not found, performing the following steps; (a) attempting to establish the required memory mapping according to the virtual memory system used by the physical processors; (b) if the required memory mapping is established according to the virtual memory system, using the established memory mapping, and adding an entry to the data store indicating the established memory mapping for the virtual address and retaining the established memory mapping at least until the software-based processing of a current guest instruction is completed; and (c) if the required memory mapping is not established according to the virtual memory system, using no memory mapping, and adding an entry to the data store indicating that a memory mapping was not found for the virtual address; and (3) if a matching virtual address is found, performing the following steps; (a) if an entry containing the matching virtual address indicates that a memory mapping was not found for the virtual address, using no memory mapping; and (b) if an entry containing the matching virtual address indicates that a memory mapping was found for the virtual address, using the memory mapping indicated in the entry; and (C) upon completing the processing of one or more guest instructions, invalidating all entries in the data store. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A method for determining memory mappings between virtual addresses and physical addresses during a software-based processing of an instruction in a computer system having a virtual memory system, in which multiple devices have concurrent access to virtual memory management data, the method comprising:
-
for a first attempt at establishing a memory mapping, attempting to establish a memory mapping for a first virtual address according to the virtual memory system; if a first memory mapping is established for the first virtual address according to the virtual memory system during the processing of the instruction, retaining the first memory mapping until processing of the instruction has completed; if a memory mapping is not established for the first virtual address according to the virtual memory system during the processing of the instruction, retaining information indicating a failure to establish a memory mapping for the first virtual address until processing of the instruction has completed; and for a subsequent attempted memory mapping; if a stored virtual address for a retained memory mapping matches a second virtual address for the subsequent attempted memory mapping, using the retained memory mapping instead of attempting to establish a new memory mapping for the second virtual address according to the virtual memory system; and if retained information indicates a failure to establish a memory mapping for the second virtual address, using no memory mapping instead of attempting to establish a new memory mapping for the second virtual address according to the virtual memory system. - View Dependent Claims (12, 13, 14, 15, 16, 17)
-
-
18. A computer program embodied in a tangible computer readable medium, the computer program being executable in a computer system in which multiple devices have concurrent memory access, the computer program comprising:
-
a software-based instruction processor for enabling the execution of an instruction as if the instruction were executed on a virtualized computer system, the computer system having a virtual memory system, the execution of the instruction requiring multiple memory accesses to access code and data related to the instruction, each of a plurality of the multiple memory accesses requiring a memory mapping from a virtual address to a physical address in accordance with the virtual memory system; and a plurality of mapping-data storage locations for storing memory mappings between virtual addresses and physical addresses during the software-based processing of the instruction, wherein, when the instruction processor is processing the instruction, for each of the plurality of memory accesses that require a memory mapping, the instruction processor attempts to establish the required memory mapping by determining whether the mapping-data storage locations contain an entry that matches a virtual address of the required memory mapping and, if the instruction processor finds a matching entry in the mapping-data storage locations, the instruction processor uses a stored memory mapping from the matching entry, instead of attempting to establish the required memory mapping according to the virtual memory system, if the instruction processor does not find a matching entry in the mapping-data storage locations, the instruction processor attempts to establish the required memory mapping according to the virtual memory system and, if the required mapping is established, adding an entry to the mapping-data storage locations indicating the established memory mapping and retaining the entry until the software-based processing of the instruction is completed, if the instruction processor does not find a matching entry in the mapping-data storage locations and the required memory mapping is not established according to the virtual memory system, adding an entry to the mapping-data storage locations indicating that the required memory mapping was not established for the virtual address and retaining the entry until the processing of the instruction is completed, and if the instruction processor finds a matching entry in the mapping-data storage locations, but the entry indicates that a memory mapping was not established for the virtual address, using no memory mapping instead of attempting to establish the required memory mapping according to the virtual memory system. - View Dependent Claims (19, 20, 21, 22, 23, 24, 25, 26, 27)
-
Specification