diff options
author | Ladi Prosek <lprosek@redhat.com> | 2017-04-04 14:18:53 +0200 |
---|---|---|
committer | Sasha Levin <alexander.levin@verizon.com> | 2017-06-13 09:29:19 -0400 |
commit | 0a9f0af48e3fdc0b2213dd7b39b36658ace02c4d (patch) | |
tree | b5c1cde6e7817d6acde25c031e3eab4949285ea3 /arch | |
parent | 4736ccc83dfca59e589eae8c183ecd0d579e75a2 (diff) |
KVM: nVMX: initialize PML fields in vmcs02
[ Upstream commit 1fb883bb827ee8efc1cc9ea0154f953f8a219d38 ]
L2 was running with uninitialized PML fields which led to incomplete
dirty bitmap logging. This manifested as all kinds of subtle erratic
behavior of the nested guest.
Fixes: 843e4330573c ("KVM: VMX: Add PML support in VMX")
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kvm/vmx.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c1534af627fb..99a15e38fa06 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -9345,6 +9345,18 @@ static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) vmx_flush_tlb(vcpu); } + if (enable_pml) { + /* + * Conceptually we want to copy the PML address and index from + * vmcs01 here, and then back to vmcs01 on nested vmexit. But, + * since we always flush the log on each vmexit, this happens + * to be equivalent to simply resetting the fields in vmcs02. + */ + ASSERT(vmx->pml_pg); + vmcs_write64(PML_ADDRESS, page_to_phys(vmx->pml_pg)); + vmcs_write16(GUEST_PML_INDEX, PML_ENTITY_NUM - 1); + } + if (nested_cpu_has_ept(vmcs12)) { kvm_mmu_unload(vcpu); nested_ept_init_mmu_context(vcpu); |