aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/kvm_host.h
diff options
context:
space:
mode:
authorVitaly Kuznetsov <vkuznets@redhat.com>2018-10-08 21:28:08 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-17 00:30:04 +0200
commit14c07ad89f4d728a468caaea6a769c018c2b8dd6 (patch)
treeccb089dc2bd41e92d0f0e7adf3891a34f57a325e /arch/x86/include/asm/kvm_host.h
parentx86/kvm/mmu.c: add kvm_mmu parameter to kvm_mmu_free_roots() (diff)
downloadlinux-dev-14c07ad89f4d728a468caaea6a769c018c2b8dd6.tar.xz
linux-dev-14c07ad89f4d728a468caaea6a769c018c2b8dd6.zip
x86/kvm/mmu: introduce guest_mmu
When EPT is used for nested guest we need to re-init MMU as shadow EPT MMU (nested_ept_init_mmu_context() does that). When we return back from L2 to L1 kvm_mmu_reset_context() in nested_vmx_load_cr3() resets MMU back to normal TDP mode. Add a special 'guest_mmu' so we can use separate root caches; the improved hit rate is not very important for single vCPU performance, but it avoids contention on the mmu_lock for many vCPUs. On the nested CPUID benchmark, with 16 vCPUs, an L2->L1->L2 vmexit goes from 42k to 26k cycles. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/include/asm/kvm_host.h')
-rw-r--r--arch/x86/include/asm/kvm_host.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 586ef144e564..7448d0b744c9 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -548,6 +548,9 @@ struct kvm_vcpu_arch {
/* Non-nested MMU for L1 */
struct kvm_mmu root_mmu;
+ /* L1 MMU when running nested */
+ struct kvm_mmu guest_mmu;
+
/*
* Paging state of an L2 guest (used for nested npt)
*