diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2020-02-28 14:52:40 -0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-03-16 17:57:37 +0100 |
commit | 0be44352071dc87a4f9bf879642b1d44876971d9 (patch) | |
tree | d42cb4212628f3d3ace456a5446c2e9a18260bd6 /virt/kvm/kvm_main.c | |
parent | 3651c7fc2bf63b62c009b8470aaf096b3b4b01e8 (diff) | |
download | linux-0be44352071dc87a4f9bf879642b1d44876971d9.tar.gz linux-0be44352071dc87a4f9bf879642b1d44876971d9.tar.bz2 linux-0be44352071dc87a4f9bf879642b1d44876971d9.zip |
KVM: x86/mmu: Reuse the current root if possible for fast switch
Reuse the current root when possible instead of grabbing a different
root from the array of cached roots. Doing so avoids unnecessary MMU
switches and also fixes a quirk where KVM can't reuse roots without
creating multiple roots since the cache is a victim cache, i.e. roots
are added to the cache when they're "evicted", not when they are
created. The quirk could be fixed by adding roots to the cache on
creation, but that would reduce the effective size of the cache as one
of its entries would be burned to track the current root.
Reusing the current root is especially helpful for nested virt as the
current root is almost always usable for the "new" MMU on nested
VM-entry/VM-exit.
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
0 files changed, 0 insertions, 0 deletions