Diving more in Intel Platform after one of my blog post about Virtualization on Intel Platform, I will post today about the VMCS; Virtual Machine Control Data Structure. The operation-root and the transitions between the VMM and the Guest OS are controlled by the data structure called VMCS. As each Virtual Machine runs on different logical processor (Virtual Processor) and for each logical processor, you can have several Virtual Machines on it, so for each Virtual Machine a 64-bits VMCS pointer is assigned. The logical processor associates a part of the memory called VMCS Region where the VMCS Pointer is its reference.
For the logical processor, it might have multiple VMCSs, the VMCS can set a virtual machine to be active or to be inactive. However to executes the required instructions, the VM must be active and current. No more than one Virtual Machine can be active in the same time
For each Virtual Machine running a logical processor, it may have 3 main things defining how it will run on the processor:
- Whether to be active or inactive
- To be current and not current
- To be launched or clear.
Let’s take the first one, after the VMX operation (VMXON) is executed to launch the VM, the active VM is maintained its state on the memory, or the processor or even on both of them. The logical processor can’t handle more than one active VM, the others remain inactive.
The logical processor only executes one VM instruction per time, so for the active processor to simply arrange the turn for the VM to execute its function, the VM must be set to current to be able to execute its function, after that it will move to not current, so others can move to the current VM.
Finally the last thing, (this is part is hard to find on the internet, only the explained part was about the active, inactive part and the current and not current part. The only source available was through Intel developer system manual) the launch and the clear status of the VM, once the VM is moved to the current state, an operation called VMLaunch that simply controls the instructions executed with each VMCS.
I got this image from the Intel Book, it is a very good way to explain the sequence or how the VM works on the logical processor.