aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@cn.fujitsu.com>2010-07-15 23:23:04 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 23:40:57 -0400
commitdaa3db693ce925a14b7e17ab6f306dc0e6a5342c (patch)
tree1511926bdec125fca374320924dacce8b49d84c3 /arch/x86/kvm
parentfa1de2bfc0feb7245328ad25fb3e6d5cd2c903b4 (diff)
KVM: MMU: fix broken page accessed tracking with ept enabled
In current code, if ept is enabled(shadow_accessed_mask = 0), the page accessed tracking is lost. Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/mmu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d2ea9cabc066..9b3b916ebeae 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -687,7 +687,7 @@ static void drop_spte(struct kvm *kvm, u64 *sptep, u64 new_spte)
687 if (!is_rmap_spte(old_spte)) 687 if (!is_rmap_spte(old_spte))
688 return; 688 return;
689 pfn = spte_to_pfn(old_spte); 689 pfn = spte_to_pfn(old_spte);
690 if (old_spte & shadow_accessed_mask) 690 if (!shadow_accessed_mask || old_spte & shadow_accessed_mask)
691 kvm_set_pfn_accessed(pfn); 691 kvm_set_pfn_accessed(pfn);
692 if (is_writable_pte(old_spte)) 692 if (is_writable_pte(old_spte))
693 kvm_set_pfn_dirty(pfn); 693 kvm_set_pfn_dirty(pfn);
@@ -815,7 +815,8 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
815 kvm_set_pfn_dirty(spte_to_pfn(*spte)); 815 kvm_set_pfn_dirty(spte_to_pfn(*spte));
816 old_spte = __xchg_spte(spte, new_spte); 816 old_spte = __xchg_spte(spte, new_spte);
817 if (is_shadow_present_pte(old_spte) 817 if (is_shadow_present_pte(old_spte)
818 && (old_spte & shadow_accessed_mask)) 818 && (!shadow_accessed_mask ||
819 old_spte & shadow_accessed_mask))
819 mark_page_accessed(pfn_to_page(spte_to_pfn(old_spte))); 820 mark_page_accessed(pfn_to_page(spte_to_pfn(old_spte)));
820 spte = rmap_next(kvm, rmapp, spte); 821 spte = rmap_next(kvm, rmapp, spte);
821 } 822 }