aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 85ab7db0d366..4286d4766510 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -380,6 +380,22 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn,
380 return young; 380 return young;
381} 381}
382 382
383static int kvm_mmu_notifier_test_young(struct mmu_notifier *mn,
384 struct mm_struct *mm,
385 unsigned long address)
386{
387 struct kvm *kvm = mmu_notifier_to_kvm(mn);
388 int young, idx;
389
390 idx = srcu_read_lock(&kvm->srcu);
391 spin_lock(&kvm->mmu_lock);
392 young = kvm_test_age_hva(kvm, address);
393 spin_unlock(&kvm->mmu_lock);
394 srcu_read_unlock(&kvm->srcu, idx);
395
396 return young;
397}
398
383static void kvm_mmu_notifier_release(struct mmu_notifier *mn, 399static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
384 struct mm_struct *mm) 400 struct mm_struct *mm)
385{ 401{
@@ -396,6 +412,7 @@ static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
396 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start, 412 .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start,
397 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end, 413 .invalidate_range_end = kvm_mmu_notifier_invalidate_range_end,
398 .clear_flush_young = kvm_mmu_notifier_clear_flush_young, 414 .clear_flush_young = kvm_mmu_notifier_clear_flush_young,
415 .test_young = kvm_mmu_notifier_test_young,
399 .change_pte = kvm_mmu_notifier_change_pte, 416 .change_pte = kvm_mmu_notifier_change_pte,
400 .release = kvm_mmu_notifier_release, 417 .release = kvm_mmu_notifier_release,
401}; 418};