diff options
author | Gui Jianfeng <guijianfeng@cn.fujitsu.com> | 2010-05-04 21:09:21 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-08-01 03:35:38 -0400 |
commit | f3b8c964a9a6cfef6d3ca778648d53947b9fd257 (patch) | |
tree | e8a6b81ab63b34535ec8c384c61acc5778144fd7 /arch/x86/kvm/paging_tmpl.h | |
parent | eec4b140c924b4c650e9a89e01d223266490e325 (diff) |
KVM: MMU: mark page table dirty when a pte is actually modified
Sometime cmpxchg_gpte doesn't modify gpte, in such case, don't mark
page table page as dirty.
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/paging_tmpl.h')
-rw-r--r-- | arch/x86/kvm/paging_tmpl.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index c7f27779c998..5c8ac060442f 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -177,10 +177,10 @@ walk: | |||
177 | if (!(pte & PT_ACCESSED_MASK)) { | 177 | if (!(pte & PT_ACCESSED_MASK)) { |
178 | trace_kvm_mmu_set_accessed_bit(table_gfn, index, | 178 | trace_kvm_mmu_set_accessed_bit(table_gfn, index, |
179 | sizeof(pte)); | 179 | sizeof(pte)); |
180 | mark_page_dirty(vcpu->kvm, table_gfn); | ||
181 | if (FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, | 180 | if (FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, |
182 | index, pte, pte|PT_ACCESSED_MASK)) | 181 | index, pte, pte|PT_ACCESSED_MASK)) |
183 | goto walk; | 182 | goto walk; |
183 | mark_page_dirty(vcpu->kvm, table_gfn); | ||
184 | pte |= PT_ACCESSED_MASK; | 184 | pte |= PT_ACCESSED_MASK; |
185 | } | 185 | } |
186 | 186 | ||
@@ -217,11 +217,11 @@ walk: | |||
217 | bool ret; | 217 | bool ret; |
218 | 218 | ||
219 | trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte)); | 219 | trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte)); |
220 | mark_page_dirty(vcpu->kvm, table_gfn); | ||
221 | ret = FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, index, pte, | 220 | ret = FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, index, pte, |
222 | pte|PT_DIRTY_MASK); | 221 | pte|PT_DIRTY_MASK); |
223 | if (ret) | 222 | if (ret) |
224 | goto walk; | 223 | goto walk; |
224 | mark_page_dirty(vcpu->kvm, table_gfn); | ||
225 | pte |= PT_DIRTY_MASK; | 225 | pte |= PT_DIRTY_MASK; |
226 | walker->ptes[walker->level - 1] = pte; | 226 | walker->ptes[walker->level - 1] = pte; |
227 | } | 227 | } |