summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Glisse <jglisse@redhat.com>2017-10-23 14:15:13 -0400
committerJérôme Glisse <jglisse@redhat.com>2018-03-23 13:05:36 -0400
commitd8047c8d88310489697c43a0c6ed24c247145464 (patch)
tree07d640891caaf6291b266a7c49b13142664f9182
parent68f7a444b3a14f053553d27ff0439fdf9501bfa1 (diff)
kvm: leverage mmu_notifier context information to avoid useless spt invalidation
Use context informations on why a range is being invalidated to determine if we need to invalidate the secondary page table (spt) or not. Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
-rw-r--r--virt/kvm/kvm_main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 138ec2ea4aba..df54fc55963f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -348,6 +348,13 @@ static void kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn,
struct kvm *kvm = mmu_notifier_to_kvm(mn);
int need_tlb_flush = 0, idx;
+ switch (range->event) {
+ case NOTIFY_CHANGE_NOTIFY:
+ return;
+ default:
+ break;
+ }
+
idx = srcu_read_lock(&kvm->srcu);
spin_lock(&kvm->mmu_lock);
/*
@@ -374,6 +381,13 @@ static void kvm_mmu_notifier_invalidate_range_end(struct mmu_notifier *mn,
{
struct kvm *kvm = mmu_notifier_to_kvm(mn);
+ switch (range->event) {
+ case NOTIFY_CHANGE_NOTIFY:
+ return;
+ default:
+ break;
+ }
+
spin_lock(&kvm->mmu_lock);
/*
* This sequence increase will notify the kvm page fault that