aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2008-07-11 10:59:46 -0400
committerAvi Kivity <avi@qumranet.com>2008-10-15 04:15:12 -0400
commit31aa2b44afd5e73365221b1de66f6081e4616f33 (patch)
treeadac599942727ac54bb4729dbea7742afbd31a06 /arch/x86/kvm/mmu.c
parent867767a365ee74a3adcfaba27075eefb66b14bfd (diff)
KVM: MMU: Separate the code for unlinking a shadow page from its parents
Place into own function, in preparation for further cleanups. Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 3da2508eb22a..81016a3a6fd3 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -991,11 +991,10 @@ static void kvm_mmu_reset_last_pte_updated(struct kvm *kvm)
991 kvm->vcpus[i]->arch.last_pte_updated = NULL; 991 kvm->vcpus[i]->arch.last_pte_updated = NULL;
992} 992}
993 993
994static void kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp) 994static void kvm_mmu_unlink_parents(struct kvm *kvm, struct kvm_mmu_page *sp)
995{ 995{
996 u64 *parent_pte; 996 u64 *parent_pte;
997 997
998 ++kvm->stat.mmu_shadow_zapped;
999 while (sp->multimapped || sp->parent_pte) { 998 while (sp->multimapped || sp->parent_pte) {
1000 if (!sp->multimapped) 999 if (!sp->multimapped)
1001 parent_pte = sp->parent_pte; 1000 parent_pte = sp->parent_pte;
@@ -1010,7 +1009,13 @@ static void kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
1010 kvm_mmu_put_page(sp, parent_pte); 1009 kvm_mmu_put_page(sp, parent_pte);
1011 set_shadow_pte(parent_pte, shadow_trap_nonpresent_pte); 1010 set_shadow_pte(parent_pte, shadow_trap_nonpresent_pte);
1012 } 1011 }
1012}
1013
1014static void kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
1015{
1016 ++kvm->stat.mmu_shadow_zapped;
1013 kvm_mmu_page_unlink_children(kvm, sp); 1017 kvm_mmu_page_unlink_children(kvm, sp);
1018 kvm_mmu_unlink_parents(kvm, sp);
1014 if (!sp->root_count) { 1019 if (!sp->root_count) {
1015 if (!sp->role.metaphysical && !sp->role.invalid) 1020 if (!sp->role.metaphysical && !sp->role.invalid)
1016 unaccount_shadowed(kvm, sp->gfn); 1021 unaccount_shadowed(kvm, sp->gfn);