microsoft / openvmm

Home of OpenVMM and OpenHCL.
http://openvmm.dev/
MIT License
1.57k stars 83 forks source link

Optimize register saving code across VP.ENTER in the kernel #408

Open ricardon opened 2 days ago

ricardon commented 2 days ago

Today, we save/restore many registers in what may be more conservative than required. It would be good to see if some registers (like the syscall MSRs) could only be save restored as necessary depending on the state of the guest. KVM has some optimizations around this path that perhaps we could follow. (migrated from https://github.com/microsoft/HvLite/issues/433)

ricardon commented 2 days ago

Items to consider: tenraja29 referred to the new RDMSRLIST/WRMSRLIST instruction for optimization https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

yjiang5 looked into the handling of MSR_LSTAR/MSR_STAR for potential optimization. This work is along the lines of https://lore.kernel.org/all/1253105134-8862-1-git-send-email-avi@redhat.com/. This optimization considers various scenarios for context switch that can make register-saving lazier.