[Patch v2 3/3] KVM: x86: extract mmu_spte_clear_track_bits in the loop of kvm_set_pte_rmapp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 arch/x86/kvm/mmu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 00853b4d6658..26269948bf8c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -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);
 		}
 	}
-- 
2.15.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux