Skip to content

Commit eeb8727

Browse files
sean-jcbonzini
authored andcommitted
KVM: x86/mmu: Don't rely on page-track mechanism to flush on memslot change
Call kvm_mmu_zap_all_fast() directly when flushing a memslot instead of bouncing through the page-track mechanism. KVM (unfortunately) needs to zap and flush all page tables on memslot DELETE/MOVE irrespective of whether KVM is shadowing guest page tables. This will allow changing KVM to register a page-track notifier on the first shadow root allocation, and will also allow deleting the misguided kvm_page_track_flush_slot() hook itself once KVM-GT also moves to a different method for reacting to memslot changes. No functional change intended. Cc: Yan Zhao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Yan Zhao <[email protected]> Tested-by: Yongwei Ma <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent db0d70e commit eeb8727

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

arch/x86/kvm/mmu/mmu.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6159,13 +6159,6 @@ static bool kvm_has_zapped_obsolete_pages(struct kvm *kvm)
61596159
return unlikely(!list_empty_careful(&kvm->arch.zapped_obsolete_pages));
61606160
}
61616161

6162-
static void kvm_mmu_invalidate_zap_pages_in_memslot(struct kvm *kvm,
6163-
struct kvm_memory_slot *slot,
6164-
struct kvm_page_track_notifier_node *node)
6165-
{
6166-
kvm_mmu_zap_all_fast(kvm);
6167-
}
6168-
61696162
int kvm_mmu_init_vm(struct kvm *kvm)
61706163
{
61716164
struct kvm_page_track_notifier_node *node = &kvm->arch.mmu_sp_tracker;
@@ -6183,7 +6176,6 @@ int kvm_mmu_init_vm(struct kvm *kvm)
61836176
}
61846177

61856178
node->track_write = kvm_mmu_pte_write;
6186-
node->track_flush_slot = kvm_mmu_invalidate_zap_pages_in_memslot;
61876179
kvm_page_track_register_notifier(kvm, node);
61886180

61896181
kvm->arch.split_page_header_cache.kmem_cache = mmu_page_header_cache;
@@ -6711,6 +6703,8 @@ void kvm_arch_flush_shadow_all(struct kvm *kvm)
67116703
void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
67126704
struct kvm_memory_slot *slot)
67136705
{
6706+
kvm_mmu_zap_all_fast(kvm);
6707+
67146708
kvm_page_track_flush_slot(kvm, slot);
67156709
}
67166710

0 commit comments

Comments
 (0)