@@ -1710,9 +1710,10 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head,
sptep, *sptep, gfn, level);
need_flush = 1;
+ mmu_spte_clear_track_bits(sptep);
if (pte_write(*ptep)) {
- pte_list_remove(rmap_head, sptep);
+ __pte_list_remove(sptep, rmap_head);
goto restart;
} else {
new_spte = *sptep & ~PT64_BASE_ADDR_MASK;
@@ -1723,7 +1724,6 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head,
new_spte = mark_spte_for_access_track(new_spte);
- mmu_spte_clear_track_bits(sptep);
mmu_spte_set(sptep, new_spte);
}
}
In the loop of kvm_set_pte_rmapp(), both branch of if clause would call mmu_spte_clear_track_bits(). * one indirectly by pte_list_remove in *if* branch * one directly in *else* branch This patch extracts this behavior and call it before if clause. Signed-off-by: Wei Yang <richard.weiyang@gmail.com> --- arch/x86/kvm/mmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)