Skip to content
This repository was archived by the owner on Jan 28, 2023. It is now read-only.

Conversation

@junxiaoc
Copy link
Contributor

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]

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]>
@wcwang wcwang merged commit a5da3c3 into master Oct 31, 2018
@raphaelning
Copy link
Contributor

For the record, this patch had passed our internal review before it was uploaded here.

@raphaelning raphaelning deleted the vm_exit_optimizition branch November 1, 2018 02:51
@raphaelning raphaelning mentioned this pull request Jan 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants