Patchwork [V2,6/10] KVM/MMU: Flush tlb directly in the kvm_mmu_slot_gfn_write_protect()

login
register
mail settings
Submitter 蓝天宇
Date Feb. 2, 2019, 1:38 a.m.
Message ID <20190202013825.51261-7-Tianyu.Lan@microsoft.com>
Download mbox | patch
Permalink /patch/716443/
State New
Headers show

Comments

蓝天宇 - Feb. 2, 2019, 1:38 a.m.
From: Lan Tianyu <Tianyu.Lan@microsoft.com>

This patch is to flush tlb directly in the kvm_mmu_slot_gfn_write_protect()
when range flush is available.

Signed-off-by: Lan Tianyu <Tianyu.Lan@microsoft.com>
---
 arch/x86/kvm/mmu.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d57574b49823..6b5e9bed6665 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1718,6 +1718,11 @@  bool kvm_mmu_slot_gfn_write_protect(struct kvm *kvm,
 		write_protected |= __rmap_write_protect(kvm, rmap_head, true);
 	}
 
+	if (write_protected && kvm_available_flush_tlb_with_range()) {
+		kvm_flush_remote_tlbs_with_address(kvm, gfn, 1);
+		write_protected = false;
+	}
+
 	return write_protected;
 }