This repository was archived by the owner on Jan 28, 2023. It is now read-only.
avoid unnecessary load_vmcs calls in VM exit #117
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
vmexit handler often needs some VMCS information such as guest
rip, physical address which causes vmexit. To read these
fields from VMCS or to write them back to VMCS, it needs to call
VMREAD and VMWRITE instructions. These two instructions require
the entire VMCS region to be loaded into memory, reading or
writing a VMCS field via vmread() and vmwrite() may incur calls
to load_vmcs() and put_vmcs(), which can have a non-negligible
overhead. If the VM exit handler needs to read/write multiple
VMCS fields, it can save time by merging all the load_vmcs()
calls as well as the put_vmcs() calls.
This change is to optimize vmexit handler performance by moving
frequently used VMCS fields vmread/vmwrite to "vmcs loaded"
context. For VMCS fields which have both read and write access,
a dirty flag is added to mark it should be write back or not
during loading guest state.
In addition, removed unused advance_rip_step function.
Signed-off-by: Junxiao Chang [email protected]