mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
KVM: MMU: Coalesce remote tlb flushes
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>
This commit is contained in:
parent
ec10f4750d
commit
caa5b8a5ed
@ -513,6 +513,7 @@ static void rmap_write_protect(struct kvm *kvm, u64 gfn)
|
|||||||
{
|
{
|
||||||
unsigned long *rmapp;
|
unsigned long *rmapp;
|
||||||
u64 *spte;
|
u64 *spte;
|
||||||
|
int write_protected = 0;
|
||||||
|
|
||||||
gfn = unalias_gfn(kvm, gfn);
|
gfn = unalias_gfn(kvm, gfn);
|
||||||
rmapp = gfn_to_rmap(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);
|
||||||
BUG_ON(!(*spte & PT_PRESENT_MASK));
|
BUG_ON(!(*spte & PT_PRESENT_MASK));
|
||||||
rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
|
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);
|
set_shadow_pte(spte, *spte & ~PT_WRITABLE_MASK);
|
||||||
kvm_flush_remote_tlbs(kvm);
|
write_protected = 1;
|
||||||
|
}
|
||||||
spte = rmap_next(kvm, rmapp, spte);
|
spte = rmap_next(kvm, rmapp, spte);
|
||||||
}
|
}
|
||||||
|
if (write_protected)
|
||||||
|
kvm_flush_remote_tlbs(kvm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MMU_DEBUG
|
#ifdef MMU_DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user