diff options
-rw-r--r-- | arch/x86/kvm/mmu.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 15850809b55b..aac0499947d8 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -1471,11 +1471,20 @@ static int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn) | |||
1471 | 1471 | ||
1472 | static void mmu_unshadow(struct kvm *kvm, gfn_t gfn) | 1472 | static void mmu_unshadow(struct kvm *kvm, gfn_t gfn) |
1473 | { | 1473 | { |
1474 | unsigned index; | ||
1475 | struct hlist_head *bucket; | ||
1474 | struct kvm_mmu_page *sp; | 1476 | struct kvm_mmu_page *sp; |
1477 | struct hlist_node *node, *nn; | ||
1475 | 1478 | ||
1476 | while ((sp = kvm_mmu_lookup_page(kvm, gfn)) != NULL) { | 1479 | index = kvm_page_table_hashfn(gfn); |
1477 | pgprintk("%s: zap %lx %x\n", __func__, gfn, sp->role.word); | 1480 | bucket = &kvm->arch.mmu_page_hash[index]; |
1478 | kvm_mmu_zap_page(kvm, sp); | 1481 | hlist_for_each_entry_safe(sp, node, nn, bucket, hash_link) { |
1482 | if (sp->gfn == gfn && !sp->role.metaphysical | ||
1483 | && !sp->role.invalid) { | ||
1484 | pgprintk("%s: zap %lx %x\n", | ||
1485 | __func__, gfn, sp->role.word); | ||
1486 | kvm_mmu_zap_page(kvm, sp); | ||
1487 | } | ||
1479 | } | 1488 | } |
1480 | } | 1489 | } |
1481 | 1490 | ||