Method and apparatus for facilitating recognition of an open event window during operation of guest software in a virtual machine environment

Information

  • Patent Grant
  • 7620949
  • Patent Number
    7,620,949
  • Date Filed
    Wednesday, March 31, 2004
    20 years ago
  • Date Issued
    Tuesday, November 17, 2009
    14 years ago
Abstract
In one embodiment, a method includes transitioning control to a virtual machine (VM) upon receiving a request from a virtual machine monitor (VMM), determining that the request to transition control is associated with a request to be informed of an open event window, performing an event window check to determine whether an even window of the VM is open, and transitioning control to the VMM if the event window check indicates that the event window of the VM is open.
Description
FIELD

Embodiments of the invention relate generally to virtual machines, and more specifically to facilitating recognition of an open event window during operation of guest software in a virtual machine environment.


BACKGROUND OF THE INVENTION

A closed interrupt window is a time interval during software execution when interrupts may not be delivered to the software. Alternatively, an open interrupt window is a time interval during software execution when interrupts can be delivered to the software. The opening and closing of the interrupt window may occur through a number of mechanisms.


The interrupt window may be closed because the software does not want to be interrupted. For example, an instruction set architecture (ISA) may allow software to block external interrupts through a masking bit or some other mechanism. In particular, in the ISA of the Intel® Pentium® 4 (referred to herein as the IA-32 ISA), hardware interrupts are blocked if the IF bit in the EFLAGS register is cleared. The IF bit may be set or cleared by instructions that load the EFLAGS register (e.g., POPF) or by instructions that explicitly set or clear the IF bit (e.g., STI, CLI). Additionally, certain machine transitions may make modifications to the IF bit (e.g., interrupt and exception vectoring may cause the IF bit to be cleared).


The interrupt window may be closed because the software is in the midst of a transition in machine state that precludes delivering the interrupt. In the IA-32 ISA, for example, because the proper vectoring of an interrupt requires the stack segment and stack pointer to remain consistent, the CPU may automatically block interrupt vectoring while the software update of the stack segment and stack pointer (MOVSS/POPSS) takes place. Additionally, the IA-32 ISA dictates that the execution of an STI instruction that sets the IF bit does not take effect until the instruction following the STI completes. Hence, the interrupt window opens one instruction after the STI.


Additional events, for example, non-maskable interrupts (NMIs), system management interrupts (SMIs), etc. may have similar event blocking semantics. A closed event window is a time interval during software execution when the associated event may not be delivered to the software. Alternatively, an open event window is a time interval during software execution when the associated event can be delivered to the software.


Depending on the specific ISA, the event window conditions may be rather complex, requiring evaluation of detailed information on the state of the processor to determine if software has an open event window for a given event.





BRIEF DESCRIPTION OF THE DRAWINGS

The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which like reference numerals refer to similar elements and in which:



FIG. 1 illustrates one embodiment of a virtual-machine environment, in which the present invention may operate;



FIG. 2 is a flow diagram of one embodiment of a process for facilitating recognition of an open event window during operation of guest software;



FIG. 3 illustrates simplified operation of reorder buffer logic, according to one embodiment of the present invention;



FIG. 4 is a flow diagram of one embodiment of a process for determining the status of an event window of a VM; and



FIG. 5 is a flow diagram of one embodiment of a process for delivering an event to guest software.





DESCRIPTION OF EMBODIMENTS

A method and apparatus for facilitating recognition of an open event window during operation of guest software is described. In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention can be practiced without these specific details.


Some portions of the detailed descriptions that follow are presented in terms of algorithms and symbolic representations of operations on data bits within a computer system's registers or memory. These algorithmic descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. An algorithm is here, and generally, conceived to be a self-consistent sequence of operations leading to a desired result. The operations are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.


It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussions, it is appreciated that throughout the present invention, discussions utilizing terms such as “processing” or “computing” or “calculating” or “determining” or the like, may refer to the action and processes of a computer system, or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer-system memories or registers or other such information storage, transmission or display devices.


In the following detailed description of the embodiments, reference is made to the accompanying drawings that show, by way of illustration, specific embodiments in which the invention may be practiced. In the drawings, like numerals describe substantially similar components throughout the several views. These embodiments are described in sufficient detail to enable those skilled in the art to practice the invention. Other embodiments may be utilized and structural, logical, and electrical changes may be made without departing from the scope of the present invention. Moreover, it is to be understood that the various embodiments of the invention, although different, are not necessarily mutually exclusive. For example, a particular feature, structure, or characteristic described in one embodiment may be included within other embodiments. The following detailed description is, therefore, not to be taken in a limiting sense, and the scope of the present invention is defined only by the appended claims, along with the full scope of equivalents to which such claims are entitled.


Although the below examples may describe detection of an open event window during operation of a virtual machine in the context of execution units and logic circuits, other embodiments of the present invention can be accomplished by way of software. For example, in some embodiments, the present invention may be provided as a computer program product or software which may include a machine or computer-readable medium having stored thereon instructions which may be used to program a computer (or other electronic devices) to perform a process according to the present invention. In other embodiments, steps of the present invention might be performed by specific hardware components that contain hardwired logic for performing the steps, or by any combination of programmed computer components and custom hardware components.


Thus, a machine-readable medium may include any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer). For example, a machine-readable medium includes a machine (e.g., a computer) readable storage medium (e.g., floppy diskettes, optical disks, Compact Disc, Read-Only Memory (CD-ROMs), and magneto-optical disks, Read-Only Memory (ROMs), Random Access Memory (RAM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), magnetic or optical cards, flash memory, etc.); a machine (e.g., computer readable transmission medium (e.g., a transmission over the Internet, electrical, optical, acoustical or other forms of propagated signals (e.g., carrier waves, infrared signals, digital signals, etc.) or the like); etc.


Further, a design may go through various stages, from creation to simulation to fabrication. Data representing a design may represent the design in a number of manners. First, as is useful in simulations, the hardware may be represented using a hardware description language or another functional description language. Additionally, a circuit level model with logic and/or transistor gates may be produced at some stages of the design process. Furthermore, most designs, at some stage, reach a level of data representing the physical placement of various devices in the hardware model. In the case where conventional semiconductor fabrication techniques are used, data representing a hardware model may be the data specifying the presence or absence of various features on different mask layers for masks used to produce the integrated circuit. In any representation of the design, the data may be stored in any form of a machine-readable medium. An optical or electrical wave modulated or otherwise generated to transmit such information, a memory, or a magnetic or optical storage such as a disc may be the machine readable medium. Any of these mediums may “carry” or “indicate” the design or software information. When an electrical carrier wave indicating or carrying the code or design is transmitted, to the extent that copying, buffering, or re-transmission of the electrical signal is performed, a new copy is made. Thus, a communication provider or a network provider may make copies of an article (a carrier wave) embodying techniques of the present invention.



FIG. 1 illustrates one embodiment of a virtual-machine environment 100, in which the present invention may operate. In this embodiment, bare platform hardware 116 comprises a computing platform, which may be capable, for example, of executing a standard operating system (OS) or a virtual-machine monitor (VMM), such as a VMM 112.


The VMM 112, though typically implemented in software, may emulate and export a bare machine interface to higher level software. Such higher level software may comprise a standard or real-time OS, may be a highly stripped down operating environment with limited operating system functionality, may not include traditional OS facilities, etc. Alternatively, for example, the VMM 112 may be run within, or on top of, another VMM. VMMs may be implemented, for example, in hardware, software, firmware or by a combination of various techniques.


The platform hardware 116 can be of a personal computer (PC), mainframe, handheld device, portable computer, set-top box, or any other computing system. The platform hardware 116 includes a processor 118 and memory 120.


Processor 118 can be any type of processor capable of executing software, such as a microprocessor, digital signal processor, microcontroller, or the like. The processor 118 may include microcode, programmable logic or hardcoded logic for performing the execution of method embodiments of the present invention. Although FIG. 1 shows only one such processor 118, there may be one or more processors in the system.


Memory 120 can be a hard disk, a floppy disk, random access memory (RAM), read only memory (ROM), flash memory, any combination of the above devices, or any other type of machine medium readable by processor 118. Memory 120 may store instructions and/or data for performing the execution of method embodiments of the present invention.


The VMM 112 presents to other software (i.e., “guest” software) the abstraction of one or more virtual machines (VMs), which may provide the same or different abstractions to the various guests. FIG. 1 shows two VMs, 102 and 114. The guest software running on each VM may include a guest OS such as a guest OS 104 or 106 and various guest software applications 108 and 110. Each of the guest OSs 104 and 106 expect to access physical resources (e.g., processor registers, memory and I/O devices) within the VMs 102 and 114 on which the guest OS 104 or 106 is running and to perform other functions. For example, the guest OS expects to have access to all registers, caches, structures, I/O devices, memory and the like, according to the architecture of the processor and platform presented in the VM. The resources that can be accessed by the guest software may either be classified as “privileged” or “non-privileged.” For privileged resources, the VMM 112 facilitates functionality desired by guest software while retaining ultimate control over these privileged resources. Non-privileged resources do not need to be controlled by the VMM 112 and can be accessed by guest software.


Further, each guest OS expects to handle various events such as exceptions (e.g., page faults, general protection faults, etc.), interrupts (e.g., hardware interrupts, software interrupts), and platform events (e.g., initialization (INIT) and system management interrupts (SMIs)). These exceptions, interrupts and platform events are referred to collectively and individually as “events” herein. Some of these events are “privileged” because they must be handled by the VMM 112 to ensure proper operation of VMs 102 and 114 and for protection from and among guest software.


When a privileged event occurs or guest software attempts to access a privileged resource, control may be transferred to the VMM 112. The transfer of control from guest software to the VMM 112 is referred to herein as a VM exit. After facilitating the resource access or handling the event appropriately, the VMM 112 may return control to guest software. The transfer of control from the VMM 112 to guest software is referred to as a VM entry.


In one embodiment, the processor 118 controls the operation of the VMs 102 and 114 in accordance with data stored in a virtual machine control structure (VMCS) 124. The VMCS 124 is a structure that may contain state of guest software, state of the VMM 112, execution control information indicating how the VMM 112 wishes to control operation of guest software, information controlling transitions between the VMM 112 and a VM, etc. The processor 118 reads information from the VMCS 124 to determine the execution environment of the VM and to constrain its behavior. In one embodiment, the VMCS is stored in memory 120. In some embodiments, multiple VMCS structures are used to support multiple VMs.


When the VMM 112 receives control following an event such as, for example, an interrupt (e.g., an interrupt occurred during the operation of the VMM 112 or an interrupt occurred during operation of a VM, resulting in a VM exit), the VMM 112 may handle the event itself or decide that the event should be handled by an appropriate VM. If the event should be handled by a VM, it may only be delivered when the VM is ready to receive the event (e.g., if the event is an interrupt, the VM has an open interrupt window). In one embodiment, the VMM 112 includes a pending event module 130 that is responsible for determining whether the VM's relevant event window is open and, if the relevant event window is not open, delaying the delivery of the event to the VM until the relevant event window opens.


In an embodiment, the pending event module 130 determines that the event window has opened upon receiving an indication from the processor 118. In one embodiment, the pending event module 130 uses the indication of the event window status to decide whether to deliver a pending event which requires an open event window, to the VM. In another embodiment, the pending event module 130 uses the indication of the event window status to facilitate functionality other than delivery of pending events which require an open event window. For example, the pending event module 130 may utilize information regarding the status of a VM's event window to make VM scheduling decisions (e.g., the VMM may choose not to switch to another VM at a scheduling point if the current VM has a closed interrupt window). Rather, the pending event module 130 may utilize the pending event indicator to generate a VM entry to the VM that will execute until the VM has an open event window, at which time the VMM 112 may choose to schedule another VM to execute.


In one embodiment, the processor 118 includes event window monitoring logic 122 that provides such an indication to the pending event module 130. In particular, once the pending event module 130 determines that the event window of the VM is closed, it sets a pending event indicator to a delivery value and requests a VM entry to this VM. In one embodiment, the pending event indicator is stored in the VMCS 124. There may be one or more such pending event indicators associated with one or more events. For example, the VMCS 124 may include a pending interrupt indicator and a pending SMI indicator, corresponding to interrupt and SMI events, respectively. Alternatively, the pending event indicator(s) may reside in the processor 118, a combination of the memory 120 and the processor 118, or in any other storage location or locations.


In response to the VM entry request, the event window monitoring logic 122 transitions control to the VM and starts monitoring the VM's relevant event window(s). Upon detecting that the VM's relevant event window is open, the event window monitoring logic 122 transfers control back to the VMM 112. In one embodiment, the event window monitoring logic 122 notifies the VMM 112 (e.g., using a designated reason code to indicate the source of the VM exit) that the VM exit was caused by an open event window. In an embodiment, there may be one such designated reason code for each event type.


In one embodiment, the event window monitoring logic 122 begins monitoring the state of the VM's event window upon executing a VM entry request issued by the VMM 112 and determining that the VM entry request is associated with a request to be informed of an open event window. In one embodiment, the event monitoring logic 122 determines whether the VM entry request is associated with a request to be informed of an open event window based on a current value of the pending event indicator. There may be one or more such pending event indicators, each corresponding to one or more events. For example, in an embodiment, there may be a pending interrupt indicator corresponding to interrupts and a pending SMI indicator corresponding to SMIs.


In one embodiment, the determination of whether the event window is open for interrupts is based on a current value of an interrupt flag that can be updated by guest software when the state of guest software's ability to accept interrupts changes. For example, in the IA-32 ISA, the EFLAGS register contains the IF interrupt flag bit, which, in part, controls whether an interrupt will be delivered to the software (as discussed above, in the IA-32 ISA, other factors that may block interrupts are considered in determining if the interrupt window is open). Alternatively, any other mechanism known in the art can be used to determine whether the interrupt window of the VM is open. Other events may have similar mechanisms for determining the state of the associated event window.


Once the VMM 112 receives an indication that the event window of the VM is open, the VMM 112, in an embodiment, requests the processor 118 to deliver the pending event to the VM. In another embodiment, the VMM 112 may deliver the event to the VM by emulating the delivery of the event in software (e.g., for interrupts, by accessing the VM's interrupt descriptor table, performing access and fault checks, etc.) and performing a VM entry to the guest such that execution begins with the first instruction of the VM's event handler. In yet another embodiment, the VMM 112 makes a scheduling decision based on the indication of an open the event window, as discussed above.



FIG. 2 is a flow diagram of one embodiment of a process 200 for facilitating recognition of an open event window during operation of guest software. The process may be performed by processing logic that may comprise hardware (e.g., circuitry, dedicated logic, programmable logic, microcode, etc.), software (such as that run on a general purpose computer system or a dedicated machine), or a combination of both. In one embodiment, process 200 is performed by event window monitoring logic 122 of FIG. 1.


Referring to FIG. 2, process 200 begins with processing logic receiving a VM entry request from a VMM (processing block 202). In one embodiment, the VM entry request is received via a VM entry instruction executed by the VMM.


Next, processing logic transitions control to the VM (processing block 204) and determines whether the VM entry request is associated with a VMM request to be informed of an open event window (decision box 206). In one embodiment, processing logic determines whether the VM entry request is associated with a VMM request to be informed of an open event window by determining whether a pending event indicator is set to a delivery value.


If the VM entry request is not associated with a VMM request to be informed of an open event window, processing logic allows the VM to execute normally (i.e., to execute until a privileged event causes a VM exit, not shown in FIG. 2) (processing block 208).


If the VM entry request is associated with a VMM request to be informed of an open event window, processing logic performs an event window check to determine whether the VM's event window is open (e.g., for a pending interrupt, whether its interrupt window is open) (decision box 210). In one embodiment, processing logic performs the event window check before the VM executes any instructions. Alternatively, processing logic performs the event window check after the VM executes its first instruction.


If the event window check indicates that the VM's relevant event window is open, processing logic generates a VM exit (processing block 212) and, in one embodiment, informs the VMM (e.g., by providing a relevant reason code) that the VM exit is caused by an open event window.


If the event window check indicates that the VM's relevant event window is closed, processing logic allows the VM to execute an instruction (processing block 214) and returns to decision box 210 to perform the event window check again. This loop is repeated until processing logic determines that the VM's event window is open, or until another VM exit occurs (e.g., due to the VM's access of privileged state).


In some embodiments, the execution of a guest instruction may be interrupted by a fault (e.g., a page fault, a general protection fault, etc.). Some faults may cause a VM exit. For example, if the VMM requires VM exists on page faults to protect and virtualize the physical memory, then a page fault occurring during the execution of an instruction in the VM will result in a VM exit. Hence, a VM exit caused by a fault may occur prior to performing the event window check. In addition, certain conditions (e.g., INIT, SMI, etc.) may be evaluated after the execution of the VM instruction but before performing the event window check if these conditions have higher priority than the event window check. Some of these conditions may also cause a VM exit that will occur before the event window check is performed. When the VMM receives control due to a VM exit caused by an event other than the opening of the event window, the VMM may either check the state of the VM's event window itself or request a VM entry and wait for the processor's indication that the event window is opened, as will be discussed in more detail below.


In one embodiment, pending event functionality has been implemented for interrupts by augmenting logic of a hardware reorder buffer (ROB). FIG. 3 illustrates simplified operation of ROB logic, according to one embodiment of the present invention.


Referring to FIG. 3, ROB logic 300 operates by receiving an interrupt window state signal 302, a VMM/VM interrupt control signal 304 and an interrupt signal 306. The interrupt window state signal 302 indicates whether the interrupt window of a currently operating VM is open. The interrupt signal 306 signals that a hardware interrupt is pending. For example, this signal may be tied directly or indirectly to the processor's hardware interrupt request (INTR) pin. In one embodiment, the interrupt signal 306 is provided by the interrupt controller coupled to the processor. The VMM/VM interrupt control signal 304 indicates whether interrupts are controlled by the VMM or the VM. In one embodiment, the VMM/VM interrupt control signal 304 is maintained by the VMM and stored in the VMCS.


If the VMM/VM control signal 304 indicates that the current interrupt is controlled by the VMM and the interrupt signal 306 signals an interrupt, the ROB logic 300 asserts a signal 310 indicating that a VM exit should occur due to the interrupt. This signal may trigger microcode, dedicated hardware or software to facilitate such a VM exit.


If the VMM/VM control signal 304 indicates that the current interrupt is controlled by the VM, the interrupt signal 306 signals an interrupt, and the interrupt window state signal 302 indicates that the VM's interrupt window is open, then the ROB logic 300 asserts a signal 312 indicating that an interrupt should be delivered to the VM. This signal may trigger microcode, dedicated hardware or software to facilitate the delivery of the interrupt to the VM.


In addition, the augmented ROB logic 300 receives as input a pending interrupt signal 308 that indicates whether there is a pending interrupt that should be delivered to a VM by the VMM. In one embodiment, the pending interrupt signal 308 is maintained by the VMM and stored in the VMCS. If the pending interrupt signal 308 indicates the existence of a pending interrupt and the interrupt window state signal 302 indicates that the VM's window is open, the ROB logic 300 asserts a signal 314 indicating that a VM exit should be generated due to an open interrupt window. This signal may trigger microcode, dedicated hardware or software to facilitate such a VM exit.


Table 1 provided below summarizes the inputs and outputs of ROB logic 300. In the embodiment shown, VM exits due to HW interrupts have priority over VM exits due to an open interrupt window. Both VM exit sources have priority over the delivery of interrupts to the VM. Other embodiments may have a different prioritization of these events. In the table, an “X” indicates a don't-care value (it may be 1 or 0); a 1 in the table indicates that the signal is asserted.










TABLE 1







ROB logic (300) Inputs
ROB logic (300) Outputs













IntCont
HW Int



VM-
Deliver


(signal
(signal

Win.
VM-
exit-
int to


304)
306)
Pend. Int
Open
exit-int
OIW
VM


1 = VMM
1 = Int
(signal
(signal
(signal
(signal
(signal


0 = VM
Asserted
308)
302)
310)
314)
312)





X
0
0
X
0
0
0


0
0
1
0



0
1
1
0



0
1
0
0



1
0
1
0



1
1
X
X
1
0
0


0
0
1
1
0
1
0


0
1
1
1



1
0
1
1



0
1
0
1
0
0
1










FIG. 4 is a flow diagram of one embodiment of a process 400 for determining the status of an event window of a VM. The process may be performed by processing logic that may comprise hardware (e.g., circuitry, dedicated logic, programmable logic, microcode, etc.), software (such as that run on a general purpose computer system or a dedicated machine), or a combination of both. In one embodiment, process 400 is performed by a pending event module 130 of FIG. 1.


Referring to FIG. 4, process 400 begins with processing logic identifying a need to be informed of an opening of a VM event window (processing block 402). As discussed above, such information may be needed to determine when to deliver a pending event to a VM, to make a scheduling decision, or for any other reason.


At processing block 404, processing logic sets a pending event indicator to a delivery value to indicate an intent to receive notification of an opening of a VM event window. In one embodiment, the pending event indicator is contained in the VMCS.


At processing block 406, processing logic requests the processor to transition control to the VM. In an embodiment, the request to transition control is sent to the processor by execution of a VM entry instruction.


Subsequently, processing logic receives control at a VM exit from the VM (processing block 408) and determines (e.g., based on a reason code associated with the VM exit) whether the VM exit was due to the opening of the VM's event window (decision box 410). If so, processing logic resets the pending event indicator to a non-delivery value (processing block 412) and performs an operation requiring an open event window (e.g., delivery of a pending event to the VM) (processing block 414).


If the VM exit was not caused by the opening of the event window, processing logic handles the VM exit according to its cause (processing block 416), and returns to processing block 408 to request a VM entry to the VM.



FIG. 5 is a flow diagram of one embodiment of a process 500 for delivering a pending event to a VM. The process may be performed by processing logic that may comprise hardware (e.g., circuitry, dedicated logic, programmable logic, microcode, etc.), software (such as that run on a general purpose computer system or a dedicated machine), or a combination of both. In one embodiment, process 400 is performed by a pending event module 130 of FIG. 1.


Process 500 begins with processing logic identifying an event that should be delivered to a VM (processing block 502) and determining whether the corresponding event window of this VM is open (processing block 504). For example, if the event that should be delivered to the VM is an interrupt, processing logic checks the state of the VM's interrupt window.


If the event window is open, processing logic, in one embodiment, requests the processor to deliver the event to the VM (processing block 506). This request may be part of a VM entry request initiated by execution of a VM entry instruction. In another embodiment, the VMM may emulate the delivery of the event to the VM using software techniques and perform a VM entry to the VM such that the first instruction to be executed will be the first instruction of the VM's event handler.


If the event window is not open, processing logic sets a pending event indicator to a delivery value for the pending event (processing block 508). For example, if there is a single bit in the VMCS for the pending event indicator, processing logic may set it to an asserted value (e.g., set to 1). Next, processing logic sends a VM entry request to the processor (processing block 510). In an embodiment, the pending event indicator is a bit in the VMCS. In an embodiment, the VM entry request is sent to the processor by execution of a VM entry instruction.


Subsequently, processing logic receives control at a VM exit from the VM (processing block 512) and determines (e.g., based on a reason code associated with the VM exit) whether the VM exit was due to the opening of the VM's event window (decision box 514). If so, processing logic resets the pending event indicator to a non-delivery value (processing block 518) and requests the processor to deliver the pending event to the VM (processing block 516). This request may be part of a VM entry request initiated by execution of a VM entry instruction. In another embodiment, the VMM may emulate the delivery of the pending event to the VM using software techniques. If the VM exit was not caused by the opening of the event window, processing logic handles the VM exit according to its cause (processing block 520), and, in one embodiment, returns to processing block 510 to request a VM entry to the VM. In response to this request, the processor transitions control to the VM and checks whether the VM's event window is open before the first VM instruction executes.


In another embodiment, processing logic determines whether the VM's event window is open after handling the VM exit at processing block 520, and returns to processing block 510 upon determining that the VM's event window is closed. Processing logic may make this determination by examining relevant state of the VM. For example, for a pending interrupt, processing logic may examine the IF bit in the EFLAGS register, as well as other state indicating the state of the interrupt window in the VM. In this embodiment, the processor responds to the VM entry request by transitioning control to the VM, allowing the VM to execute its first instruction and then checking whether the VM's event window is open.


In one embodiment, processing logic performs an additional check to determine whether the VM's event window is open only if the preceding VM exit was caused by an event having a higher priority than the opening of the event window. In other words, processing logic performs an additional event window check only if it is possible that the opening of the event window was unnoticed by the processor due to a higher priority event that caused a VM exit.


As discussed above, in an alternative embodiment, a VMM may utilize the pending event indicator to facilitate functionality other than delivery of pending events which require an open event window. For example, such a VMM may utilize information regarding the status of a VM's event window to make VM scheduling decisions (e.g., the VMM may choose not to switch to another VM at a scheduling point if the current VM has a closed interrupt window). Such a VMM may utilize the pending event indicator to generate a VM entry to the VM that will execute until the VM has an open event window, at which time a VM exit will be generated and control will transition to the VMM. Following this VM exit, the VMM may choose to schedule another VM to execute.


Thus, a method and apparatus for facilitating recognition of an open event window during operation of guest software in a virtual machine environment have been described. It is to be understood that the above description is intended to be illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reading and understanding the above description. The scope of the invention should, therefore, be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.

Claims
  • 1. A method comprising: receiving a request to transition control to a virtual machine (VM) from a virtual machine monitor (VMM);determining that the request to transition control is associated with a request to be informed of an open event window of the VM, based on accessing a pending event indicator maintained by the VMM and determining that the pending event indicator maintained by the VMM is set to a delivery value;transitioning control to the VM;performing an event window check to determine whether the VM has an open event window;if the event window check indicates that the VM has an open event window, transitioning control to the VMM; andif the VM does not have an open event window, repeating the event window check after each instruction executed by the VM until determining that the VM has an open event window.
  • 2. The method of claim 1 wherein transitioning control to the VMM comprises informing the VMM that control is transitioned to the VMM due to an open event window of the VM.
  • 3. The method of claim 1 wherein the event window check is initially performed before the VM executes any instructions.
  • 4. The method of claim 1 wherein the event window check is initially performed after the VM executes a first instruction.
  • 5. The method of claim 1 further comprising: prior to determining that the VM has an open event window, detecting a higher priority event associated with a transition of control to the VMM,transitioning control to the VMM; andinforming the VMM that control is transitioned due to the higher priority event.
  • 6. An apparatus comprising: a data structure controlled by a virtual machine monitor (VMM), the data structure storing a pending event indicator associated with a pending event; andopen window logic, coupled to the data structure controlled by the VMM, toreceive a request to transition control from the VMM to a virtual machine (VM),determine that the request to transition control is associated with a request to be informed of an open event window of the VM, based on accessing a pending event indicator maintained by the VMM and determining that the pending event indicator maintained by the VMM is set to a delivery value,transition control to the VM,determine whether an event window of the VM is open,transition control to the VMM if the event window of the VM is open; andif the VM does not have an open event window, repeat the event window check after each instruction executed by the VM until determining that the VM has the open event window.
  • 7. The apparatus of claim 6 wherein the open window monitoring logic is further to inform the VMM that control is transitioned to the VMM due to an open event window of the VM.
  • 8. The apparatus of claim 6 wherein the determining whether the event window of the VM is open is initially performed before the VM executes any instructions.
  • 9. A system comprising: a memory to store one or more pending event indicators; anda processor, coupled to the memory, to use the one or more pending event indicators to: receive a request to transition control from a virtual machine monitor (VMM) to a virtual machine (VM);determine that the request to transition control is associated with a request to be informed of an open event window of the VM, based on accessing the pending event indicator maintained by the VMM and determining that the pending event indicator maintained by the VMM is set to a delivery value;transition control to the VM in response to the request to transition control to the VM from the VMM;perform an event window check to determine whether an event window of the VM is open;transition control to the VMM if the event window check indicates that the event window of the VM is open; andif the VM does not have an open event window, repeat the event window check after each instruction executed by the VM until determining that the VM has the open event window.
  • 10. The system of claim 9 wherein the processor is further to inform the VMM that control is transitioned to the VMM due to an open event window of the VM.
  • 11. A machine-readable storage medium containing instructions which, when executed by a processing system, cause the processing system to perform a method, the method comprising: receiving a request to transition control to a virtual machine (VM) from a virtual machine monitor (VMM);determining that the request to transition control is associated with a request to be informed of an open event window of the VM, based on accessing a pending event indicator maintained by the VMM and determining that the pending event indicator maintained by the VMM is set to a delivery value;transitioning control to the VM;performing an event window check to determine whether the VM has an open event window;if the event window check indicates that the VM has an open event window, transitioning control to the VMM; andif the VM does not have an open event window, repeating the event window check after each instruction executed by the VM until determining that the VM has an open event window.
  • 12. The machine-readable storage medium of claim 11 wherein transitioning control to the VMM comprises informing the VMM that control is transitioned to the VMM due to an open event window of the VM.
US Referenced Citations (206)
Number Name Date Kind
3699532 Schaffer et al. Oct 1972 A
3996449 Attanasio et al. Dec 1976 A
4037214 Birney et al. Jul 1977 A
4162536 Morley Jul 1979 A
4207609 Luiz et al. Jun 1980 A
4247905 Yoshida et al. Jan 1981 A
4319233 Matsuoka et al. Mar 1982 A
4319323 Ermolovich et al. Mar 1982 A
4347565 Kaneda et al. Aug 1982 A
4366537 Heller et al. Dec 1982 A
4403283 Myntti et al. Sep 1983 A
4419724 Branigin et al. Dec 1983 A
4430709 Schleupen Feb 1984 A
4521852 Guttag Jun 1985 A
4571672 Hatada et al. Feb 1986 A
4621318 Maeda Nov 1986 A
4759064 Chaum Jul 1988 A
4795893 Ugon Jan 1989 A
4802084 Ikegaya et al. Jan 1989 A
4825052 Chemin et al. Apr 1989 A
4907270 Hazard Mar 1990 A
4907272 Hazard Mar 1990 A
4910774 Barakat Mar 1990 A
4975836 Hirosawa et al. Dec 1990 A
5007082 Cummins Apr 1991 A
5022077 Bealkowski et al. Jun 1991 A
5075842 Lai Dec 1991 A
5079737 Hackbarth Jan 1992 A
5187802 Inoue et al. Feb 1993 A
5230069 Brelsford et al. Jul 1993 A
5237616 Abraham et al. Aug 1993 A
5255379 Melo Oct 1993 A
5287363 Wolf et al. Feb 1994 A
5293424 Holtey et al. Mar 1994 A
5295251 Wakui et al. Mar 1994 A
5317705 Gannon et al. May 1994 A
5319760 Mason et al. Jun 1994 A
5361375 Ogi Nov 1994 A
5386552 Garney Jan 1995 A
5421006 Jablon et al. May 1995 A
5434999 Goire et al. Jul 1995 A
5437033 Inoue et al. Jul 1995 A
5442645 Ugon et al. Aug 1995 A
5455909 Blomgren et al. Oct 1995 A
5459867 Adams et al. Oct 1995 A
5459869 Spilo Oct 1995 A
5469557 Salt et al. Nov 1995 A
5473692 Davis Dec 1995 A
5479509 Ugon Dec 1995 A
5504922 Seki et al. Apr 1996 A
5506975 Onodera Apr 1996 A
5511217 Nakajima et al. Apr 1996 A
5522075 Robinson et al. May 1996 A
5528231 Patarin Jun 1996 A
5533126 Hazard Jul 1996 A
5555385 Osisek Sep 1996 A
5555414 Hough et al. Sep 1996 A
5560013 Scalzi et al. Sep 1996 A
5564040 Kubala Oct 1996 A
5566323 Ugon Oct 1996 A
5568552 Davis Oct 1996 A
5574936 Ryba et al. Nov 1996 A
5582717 Di Santo Dec 1996 A
5604805 Brands Feb 1997 A
5606617 Brands Feb 1997 A
5615263 Takahashi Mar 1997 A
5628022 Ueno et al. May 1997 A
5633929 Kaliski, Jr. May 1997 A
5657445 Pearce Aug 1997 A
5668971 Neufeld Sep 1997 A
5684948 Johnson et al. Nov 1997 A
5706469 Kobayashi Jan 1998 A
5717903 Bonola Feb 1998 A
5720609 Pfefferle Feb 1998 A
5721222 Bernstein et al. Feb 1998 A
5729760 Poisner Mar 1998 A
5737604 Miller et al. Apr 1998 A
5737760 Grimmer, Jr. et al. Apr 1998 A
5740178 Jacks et al. Apr 1998 A
5752046 Oprescu et al. May 1998 A
5757919 Herbert et al. May 1998 A
5764969 Kahle et al. Jun 1998 A
5796835 Saada Aug 1998 A
5796845 Serikawa et al. Aug 1998 A
5805712 Davis Sep 1998 A
5809546 Greenstein et al. Sep 1998 A
5825875 Ugon Oct 1998 A
5825880 Sudia et al. Oct 1998 A
5835594 Albrecht et al. Nov 1998 A
5844986 Davis Dec 1998 A
5852717 Bhide et al. Dec 1998 A
5854913 Goetz et al. Dec 1998 A
5867577 Patarin Feb 1999 A
5872994 Akiyama et al. Feb 1999 A
5890189 Nozue et al. Mar 1999 A
5900606 Rigal May 1999 A
5901225 Ireton et al. May 1999 A
5903752 Dingwall et al. May 1999 A
5919257 Trostle Jul 1999 A
5935242 Madany et al. Aug 1999 A
5935247 Pai et al. Aug 1999 A
5937063 Davis Aug 1999 A
5944821 Angelo Aug 1999 A
5953502 Helbig, Sr. Sep 1999 A
5956408 Arnold Sep 1999 A
5970147 Davis et al. Oct 1999 A
5978475 Schneier et al. Nov 1999 A
5978481 Ganesan et al. Nov 1999 A
5987557 Ebrahim Nov 1999 A
6014745 Ashe Jan 2000 A
6035374 Panwar et al. Mar 2000 A
6044478 Green Mar 2000 A
6055637 Hudson et al. Apr 2000 A
6058478 Davis May 2000 A
6061794 Angelo May 2000 A
6075938 Bugnion et al. Jun 2000 A
6085296 Karkhanis et al. Jul 2000 A
6088262 Nasu Jul 2000 A
6092095 Maytal Jul 2000 A
6093213 Favor et al. Jul 2000 A
6101584 Satou et al. Aug 2000 A
6108644 Goldschlag et al. Aug 2000 A
6115816 Davis Sep 2000 A
6125430 Noel et al. Sep 2000 A
6131166 Wong-Insley Oct 2000 A
6148379 Schimmel Nov 2000 A
6158546 Hanson et al. Dec 2000 A
6173417 Merrill Jan 2001 B1
6175924 Arnold Jan 2001 B1
6175925 Nardone et al. Jan 2001 B1
6178509 Nardone et al. Jan 2001 B1
6182089 Ganapathy et al. Jan 2001 B1
6188257 Buer Feb 2001 B1
6192455 Bogin et al. Feb 2001 B1
6199152 Kelly et al. Mar 2001 B1
6205550 Nardone et al. Mar 2001 B1
6212635 Reardon Apr 2001 B1
6222923 Schwenk Apr 2001 B1
6249872 Wildgrube et al. Jun 2001 B1
6252650 Nakaumra Jun 2001 B1
6269392 Cotichini et al. Jul 2001 B1
6272533 Browne Aug 2001 B1
6272637 Little et al. Aug 2001 B1
6275933 Fine et al. Aug 2001 B1
6282650 Davis Aug 2001 B1
6282651 Ashe Aug 2001 B1
6282657 Kaplan et al. Aug 2001 B1
6292874 Barnett Sep 2001 B1
6301646 Hostetter Oct 2001 B1
6308270 Guthery Oct 2001 B1
6314409 Schneck et al. Nov 2001 B2
6321314 Van Dyke Nov 2001 B1
6327652 England et al. Dec 2001 B1
6330670 England et al. Dec 2001 B1
6339815 Feng Jan 2002 B1
6339816 Bausch Jan 2002 B1
6357004 Davis Mar 2002 B1
6363485 Adams Mar 2002 B1
6374286 Gee et al. Apr 2002 B1
6374317 Ajanovic et al. Apr 2002 B1
6378068 Foster Apr 2002 B1
6378072 Collins et al. Apr 2002 B1
6389537 Davis et al. May 2002 B1
6397242 Devine et al. May 2002 B1
6397379 Yates, Jr. et al. May 2002 B1
6412035 Webber Jun 2002 B1
6421702 Gulick Jul 2002 B1
6435416 Slassi Aug 2002 B1
6445797 McGough Sep 2002 B1
6463535 Drews Oct 2002 B1
6463537 Tello Oct 2002 B1
6496587 Bugnion et al. Dec 2002 B1
6499123 McFarland et al. Dec 2002 B1
6505279 Phillips et al. Jan 2003 B1
6507904 Ellison et al. Jan 2003 B1
6529909 Bowman-Amuah Mar 2003 B1
6535988 Poisner Mar 2003 B1
6557104 Vu et al. Apr 2003 B2
6560627 McDonald et al. May 2003 B1
6609199 DeTreville Aug 2003 B1
6615278 Curtis Sep 2003 B1
6633963 Ellison et al. Oct 2003 B1
6633981 Davis Oct 2003 B1
6651171 England et al. Nov 2003 B1
6678825 Ellison et al. Jan 2004 B1
6684326 Cromer et al. Jan 2004 B1
6717589 Grillo et al. Apr 2004 B1
20010021969 Burger et al. Sep 2001 A1
20010027511 Wakabayashi et al. Oct 2001 A1
20010027527 Khidekel et al. Oct 2001 A1
20010037450 Metlitski et al. Nov 2001 A1
20020007456 Peinado et al. Jan 2002 A1
20020023032 Pearson et al. Feb 2002 A1
20020147916 Strongin et al. Oct 2002 A1
20020166061 Falik et al. Nov 2002 A1
20020169717 Challener Nov 2002 A1
20030018892 Tello Jan 2003 A1
20030074548 Cromer et al. Apr 2003 A1
20030115453 Grawrock Jun 2003 A1
20030126442 Glew et al. Jul 2003 A1
20030126453 Glew et al. Jul 2003 A1
20030159056 Cromer et al. Aug 2003 A1
20030188179 Challener et al. Oct 2003 A1
20030196085 Lampson et al. Oct 2003 A1
20040117539 Bennett et al. Jun 2004 A1
20050204357 Garg et al. Sep 2005 A1
Foreign Referenced Citations (39)
Number Date Country
4217444 Dec 1992 DE
0473913 Mar 1992 EP
0600112 Jun 1994 EP
0602867 Jun 1994 EP
0892521 Jan 1999 EP
0930567 Jul 1999 EP
0961193 Dec 1999 EP
0965902 Dec 1999 EP
1030237 Aug 2000 EP
1055989 Nov 2000 EP
1056014 Nov 2000 EP
1085396 Mar 2001 EP
1146715 Oct 2001 EP
1209563 May 2002 EP
1271277 Jan 2003 EP
2000076139 Mar 2000 JP
WO9524696 Sep 1995 WO
WO9729567 Aug 1997 WO
WO9812620 Mar 1998 WO
WO9834365 Aug 1998 WO
WO9844402 Oct 1998 WO
WO9905600 Feb 1999 WO
WO9918511 Apr 1999 WO
WO9957863 Nov 1999 WO
WO9965579 Dec 1999 WO
WO0021238 Apr 2000 WO
WO0062232 Oct 2000 WO
WO0127723 Apr 2001 WO
WO0127821 Apr 2001 WO
WO0163994 Aug 2001 WO
WO0175565 Oct 2001 WO
WO0175595 Oct 2001 WO
WO0201794 Jan 2002 WO
WO9909482 Jan 2002 WO
WO0217555 Feb 2002 WO
WO020160121 Aug 2002 WO
WO0175564 Oct 2002 WO
WO02086684 Oct 2002 WO
WO03058412 Jul 2003 WO
Related Publications (1)
Number Date Country
20050240700 A1 Oct 2005 US