diff options
author | Eddie Dong <eddie.dong@intel.com> | 2007-12-18 06:08:27 +0800 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-12-18 17:25:57 +0200 |
commit | 89075253714a299236b8debfbfdcb670a3932a1b (patch) | |
tree | 8a59183dba222539e005dd88fc28740af4dbeb23 | |
parent | 04e6202e30ecd89c8e48802b64397ebaa55363e9 (diff) |
KVM: MMU: Coalesce remote tlb flusheskvm-57
Host side TLB flush can be merged together if multiple
spte need to be write-protected.
Signed-off-by: Yaozu (Eddie) Dong <eddie.dong@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | arch/x86/kvm/mmu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 401eb7ce3207..9a57e1a01449 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -513,6 +513,7 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn) { unsigned long *rmapp; u64 *spte; + int write_protected = 0; gfn = unalias_gfn(kvm, gfn); rmapp = gfn_to_rmap(kvm, gfn); @@ -522,11 +523,14 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn) BUG_ON(!spte); BUG_ON(!(*spte & PT_PRESENT_MASK)); rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte); - if (is_writeble_pte(*spte)) + if (is_writeble_pte(*spte)) { set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK); - kvm_flush_remote_tlbs(kvm); + write_protected = 1; + } spte = rmap_next(kvm, rmapp, spte); } + if (write_protected) + kvm_flush_remote_tlbs(kvm); } #ifdef MMU_DEBUG |