diff options
| -rw-r--r-- | arch/x86/kvm/mmu.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index e49c4d433c0f..4ba85d95bd29 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
| @@ -892,14 +892,25 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, | |||
| 892 | int *ptwrite, gfn_t gfn, struct page *page) | 892 | int *ptwrite, gfn_t gfn, struct page *page) |
| 893 | { | 893 | { |
| 894 | u64 spte; | 894 | u64 spte; |
| 895 | int was_rmapped = is_rmap_pte(*shadow_pte); | 895 | int was_rmapped = 0; |
| 896 | int was_writeble = is_writeble_pte(*shadow_pte); | 896 | int was_writeble = is_writeble_pte(*shadow_pte); |
| 897 | hfn_t host_pfn = (*shadow_pte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT; | ||
| 897 | 898 | ||
| 898 | pgprintk("%s: spte %llx access %x write_fault %d" | 899 | pgprintk("%s: spte %llx access %x write_fault %d" |
| 899 | " user_fault %d gfn %lx\n", | 900 | " user_fault %d gfn %lx\n", |
| 900 | __FUNCTION__, *shadow_pte, pt_access, | 901 | __FUNCTION__, *shadow_pte, pt_access, |
| 901 | write_fault, user_fault, gfn); | 902 | write_fault, user_fault, gfn); |
| 902 | 903 | ||
| 904 | if (is_rmap_pte(*shadow_pte)) { | ||
| 905 | if (host_pfn != page_to_pfn(page)) { | ||
| 906 | pgprintk("hfn old %lx new %lx\n", | ||
| 907 | host_pfn, page_to_pfn(page)); | ||
| 908 | rmap_remove(vcpu->kvm, shadow_pte); | ||
| 909 | } | ||
| 910 | else | ||
| 911 | was_rmapped = 1; | ||
| 912 | } | ||
| 913 | |||
| 903 | /* | 914 | /* |
| 904 | * We don't set the accessed bit, since we sometimes want to see | 915 | * We don't set the accessed bit, since we sometimes want to see |
| 905 | * whether the guest actually used the pte (in order to detect | 916 | * whether the guest actually used the pte (in order to detect |
