Skip to content

Commit

Permalink
KVM: MMU: make kvm_mmu_reset_context() flush the guest TLB
Browse files Browse the repository at this point in the history
kvm_set_cr0() and kvm_set_cr4(), and possible other functions,
assume that kvm_mmu_reset_context() flushes the guest TLB.  However,
it does not.

Fix by flushing the tlb (and syncing the new root as well).

Signed-off-by: Avi Kivity <avi@redhat.com>
  • Loading branch information
Avi Kivity committed Jul 12, 2011
1 parent 411c588 commit 45bd07b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arch/x86/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3054,8 +3054,18 @@ static void destroy_kvm_mmu(struct kvm_vcpu *vcpu)

int kvm_mmu_reset_context(struct kvm_vcpu *vcpu)
{
int r;

destroy_kvm_mmu(vcpu);
return init_kvm_mmu(vcpu);
r = init_kvm_mmu(vcpu);

if (r)
goto err;

kvm_mmu_sync_roots(vcpu);
kvm_mmu_flush_tlb(vcpu);
err:
return r;
}
EXPORT_SYMBOL_GPL(kvm_mmu_reset_context);

Expand Down

0 comments on commit 45bd07b

Please sign in to comment.