Skip to content

Commit

Permalink
KVM: x86/mmu: Sync roots after MMU load iff load as successful
Browse files Browse the repository at this point in the history
For clarity, explicitly skip syncing roots if the MMU load failed
instead of relying on the !VALID_PAGE check in kvm_mmu_sync_roots().

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20210305011101.3597423-17-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Sean Christopherson authored and Paolo Bonzini committed Mar 15, 2021
1 parent 61a1773 commit a91f387
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/x86/kvm/mmu/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4836,10 +4836,11 @@ int kvm_mmu_load(struct kvm_vcpu *vcpu)
else
r = mmu_alloc_shadow_roots(vcpu);
write_unlock(&vcpu->kvm->mmu_lock);

kvm_mmu_sync_roots(vcpu);
if (r)
goto out;

kvm_mmu_sync_roots(vcpu);

kvm_mmu_load_pgd(vcpu);
static_call(kvm_x86_tlb_flush_current)(vcpu);
out:
Expand Down

0 comments on commit a91f387

Please sign in to comment.