diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-06-07 12:06:39 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-06-07 12:06:39 -0400 |
commit | b31455e96f0005bd247d70b59428a90413de0c31 (patch) | |
tree | 5a32195b0f4e9a010b54efc1777ef41dacedd55e /virt/kvm/kvm_main.c | |
parent | a280e358465b4ac8982dc1eb2deebcb020443b7f (diff) | |
parent | 85165781c5d900d97052be1d2723f6929d56768d (diff) | |
download | linux-b31455e96f0005bd247d70b59428a90413de0c31.tar.gz linux-b31455e96f0005bd247d70b59428a90413de0c31.tar.bz2 linux-b31455e96f0005bd247d70b59428a90413de0c31.zip |
Merge branch 'kvm-5.20-early-patches' into HEAD
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r-- | virt/kvm/kvm_main.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 44c47670447a..7f79abdbd68d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -724,6 +724,15 @@ static int kvm_mmu_notifier_invalidate_range_start(struct mmu_notifier *mn, kvm->mn_active_invalidate_count++; spin_unlock(&kvm->mn_invalidate_lock); + /* + * Invalidate pfn caches _before_ invalidating the secondary MMUs, i.e. + * before acquiring mmu_lock, to avoid holding mmu_lock while acquiring + * each cache's lock. There are relatively few caches in existence at + * any given time, and the caches themselves can check for hva overlap, + * i.e. don't need to rely on memslot overlap checks for performance. + * Because this runs without holding mmu_lock, the pfn caches must use + * mn_active_invalidate_count (see above) instead of mmu_notifier_count. + */ gfn_to_pfn_cache_invalidate_start(kvm, range->start, range->end, hva_range.may_block); |