Intel 64 and IA-32 Architectures Software Developers Manual Volume 3B, System Programming Guide Part 2

Table Of Contents
Vol. 3 20-33
VIRTUAL-MACHINE CONTROL STRUCTURES
Before executing VMXON, software should write the VMCS revision identifier (see
Section 20.2) to the VMXON region. It need not initialize the VMXON region in any
other way. Software should use a separate region for each logical processor and
should not access or modify the VMXON region of a logical processor between execu-
tion of VMXON and VMXOFF on that logical processor. Doing otherwise may lead to
unpredictable behavior (including behaviors identified in Section 20.10.1).
20.11 USING VMCLEAR TO INITIALIZE A VMCS REGION
A processor may use the VMCS data portion of a VMCS region to maintain implemen-
tation-specific information about the VMCS. When software first allocates a region of
memory for use as a VMCS region, the data in that region may be interpreted in an
implementation-specific manner. In addition to its other functions, the VMCLEAR
instruction initializes any implementation-specific information in the VMCS region
referenced by its operand. To avoid the uncertainties of implementation-specific
behavior, software should execute VMCLEAR on a VMCS region before making the
corresponding VMCS active with VMPTRLD.
A logical processor uses the VMCS region to maintain the launch state of the corre-
sponding VMCS. The launch state may be clear or launched. The VMCLEAR instruc-
tion puts the VMCS referenced by its operand into the clear state. The VMLAUNCH
instruction requires a VMCS whose launch state is clear and changes its launch state
to launched. The VMRESUME instruction requires a VMCS whose launch state is
launched. There are no other ways to modify the launch state of a VMCS (it cannot be
modified using VMWRITE) and there is no direct way to read it (it cannot be read
using VMREAD). Improper software usage (for example, software writing to the
VMCS data of an active VMCS) may leave the launch state undefined.
The following software usage is consistent with these limitations:
VMCLEAR should be executed for a VMCS before it is used for VM entry.
VMLAUNCH should be used for the first VM entry using a VMCS after VMCLEAR
has been executed for that VMCS.
VMRESUME should be used for any subsequent VM entry using a VMCS (until the
next execution of VMCLEAR for the VMCS).
It is expected that, in general, VMRESUME will have lower latency than VMLAUNCH.
Since “migrating” a VMCS from one logical processor to another requires use of
VMCLEAR (see Section 20.10.1), which sets the launch state of the VMCS to “clear,
such migration requires the next VM entry to be performed using VMLAUNCH. Soft-
ware developers can avoid the performance cost of increased VM-entry latency by
avoiding unnecessary migration of a VMCS from one logical processor to another.