-
Notifications
You must be signed in to change notification settings - Fork 1
Description
There are a list of things worth some attention that I am uncovering as I implement VM support:
Uniform synchronous/asynchronous transitions
There are two ways to switch between domains, either via a call, or due to an exception/an error.
The first case maintains switch capabilities correctly while the second doesn't.
I currently implemented something for EPT violations and ExternalInterrupts that updates the handles, but in the future I think we should optimize and formalize this. Maybe a CPU capability rather than a transition one is the way to go.
After all, we currently only allow one context per physical core.
Similarly, this would make it way easier to route exceptions along the management chain.
I am not sure about the implementation of the way back to the domain though.
Optimize setting fields in a domain on x86
Right now to set fields that are not general purpose registers we switch the current VMCS (twice).
This is slow. Another approach would reverse engineer (actually I think KVM does it) how fields are laid down in the VMCS and do a memory write directly rather than a switch -> write -> switch back.
This could be wrapped behind the VMCS struct with an abstraction vmcs.write_field().