[PATCH 3/7] KVM: X86: Zap the invalid list after remote tlb flushing

From: Lai Jiangshan
Date: Tue Aug 24 2021 - 13:59:45 EST


From: Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>

In mmu_sync_children(), it can zap the invalid list after remote tlb flushing.
Emptifying the invalid list ASAP might help reduce a remote tlb flushing
in some cases.

Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxxxxx>
---
arch/x86/kvm/mmu/mmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 987953a901d2..a165eb8713bc 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -2050,7 +2050,7 @@ static bool mmu_sync_children(struct kvm_vcpu *vcpu,
protected |= rmap_write_protect(vcpu, sp->gfn);

if (protected) {
- kvm_flush_remote_tlbs(vcpu->kvm);
+ kvm_mmu_flush_or_zap(vcpu, &invalid_list, true, flush);
flush = false;
}

--
2.19.1.6.gb485710b