aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2011-07-11 15:22:01 -0400
committerAvi Kivity <avi@redhat.com>2011-07-24 04:50:24 -0400
commitffb61bb3bca33ff8e68d11d7cb6b27ac0f74a2c0 (patch)
treeb0e220c032bb0d13a0b2ead3de1b2098cafb2702 /arch
parent052331bea38dfc176322ec85642eb98d6803a762 (diff)
KVM: MMU: do not update slot bitmap if spte is nonpresent
Set slot bitmap only if the spte is present Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 03323dc705c2..02c839f40e29 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -743,9 +743,6 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
743 struct kvm_mmu_page *sp; 743 struct kvm_mmu_page *sp;
744 unsigned long *rmapp; 744 unsigned long *rmapp;
745 745
746 if (!is_rmap_spte(*spte))
747 return 0;
748
749 sp = page_header(__pa(spte)); 746 sp = page_header(__pa(spte));
750 kvm_mmu_page_set_gfn(sp, spte - sp->spt, gfn); 747 kvm_mmu_page_set_gfn(sp, spte - sp->spt, gfn);
751 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level); 748 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level);
@@ -2087,11 +2084,13 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
2087 if (!was_rmapped && is_large_pte(*sptep)) 2084 if (!was_rmapped && is_large_pte(*sptep))
2088 ++vcpu->kvm->stat.lpages; 2085 ++vcpu->kvm->stat.lpages;
2089 2086
2090 page_header_update_slot(vcpu->kvm, sptep, gfn); 2087 if (is_shadow_present_pte(*sptep)) {
2091 if (!was_rmapped) { 2088 page_header_update_slot(vcpu->kvm, sptep, gfn);
2092 rmap_count = rmap_add(vcpu, sptep, gfn); 2089 if (!was_rmapped) {
2093 if (rmap_count > RMAP_RECYCLE_THRESHOLD) 2090 rmap_count = rmap_add(vcpu, sptep, gfn);
2094 rmap_recycle(vcpu, sptep, gfn); 2091 if (rmap_count > RMAP_RECYCLE_THRESHOLD)
2092 rmap_recycle(vcpu, sptep, gfn);
2093 }
2095 } 2094 }
2096 kvm_release_pfn_clean(pfn); 2095 kvm_release_pfn_clean(pfn);
2097 if (speculative) { 2096 if (speculative) {