mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-01 14:52:32 +00:00
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>
This commit is contained in:
parent
eec4b140c9
commit
f3b8c964a9
@ -177,10 +177,10 @@ walk:
|
|||||||
if (!(pte & PT_ACCESSED_MASK)) {
|
if (!(pte & PT_ACCESSED_MASK)) {
|
||||||
trace_kvm_mmu_set_accessed_bit(table_gfn, index,
|
trace_kvm_mmu_set_accessed_bit(table_gfn, index,
|
||||||
sizeof(pte));
|
sizeof(pte));
|
||||||
mark_page_dirty(vcpu->kvm, table_gfn);
|
|
||||||
if (FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn,
|
if (FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn,
|
||||||
index, pte, pte|PT_ACCESSED_MASK))
|
index, pte, pte|PT_ACCESSED_MASK))
|
||||||
goto walk;
|
goto walk;
|
||||||
|
mark_page_dirty(vcpu->kvm, table_gfn);
|
||||||
pte |= PT_ACCESSED_MASK;
|
pte |= PT_ACCESSED_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,11 +217,11 @@ walk:
|
|||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte));
|
trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte));
|
||||||
mark_page_dirty(vcpu->kvm, table_gfn);
|
|
||||||
ret = FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, index, pte,
|
ret = FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, index, pte,
|
||||||
pte|PT_DIRTY_MASK);
|
pte|PT_DIRTY_MASK);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto walk;
|
goto walk;
|
||||||
|
mark_page_dirty(vcpu->kvm, table_gfn);
|
||||||
pte |= PT_DIRTY_MASK;
|
pte |= PT_DIRTY_MASK;
|
||||||
walker->ptes[walker->level - 1] = pte;
|
walker->ptes[walker->level - 1] = pte;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user