kvm: x86: Add support for fast CR3 switch across different MMU modes
authorJunaid Shahid <junaids@google.com>
Wed, 27 Jun 2018 21:59:09 +0000 (14:59 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 6 Aug 2018 15:58:53 +0000 (17:58 +0200)
commit0aab33e4f9459fc80378bc2a089d5784fe8ccd3b
treeb52ac79111412139dea359863fbc997fd64a8428
parent6e42782f516f05c8030f63308f2457681b1c9919
kvm: x86: Add support for fast CR3 switch across different MMU modes

This generalizes the lockless CR3 switch path to be able to work
across different MMU modes (e.g. nested vs non-nested) by checking
that the expected page role of the new root page matches the page role
of the previously stored root page in addition to checking that the new
CR3 matches the previous CR3. Furthermore, instead of loading the
hardware CR3 in fast_cr3_switch(), it is now done in vcpu_enter_guest(),
as by that time the MMU context would be up-to-date with the VCPU mode.

Signed-off-by: Junaid Shahid <junaids@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.c