Skip to content

Commit 0a3869e

Browse files
committed
KVM: x86/mmu: Trigger APIC-access page reload iff vendor code cares
Request an APIC-access page reload when the backing page is migrated (or unmapped) if and only if vendor code actually plugs the backing pfn into structures that reside outside of KVM's MMU. This avoids kicking all vCPUs in the (hopefully infrequent) scenario where the backing page is migrated/invalidated. Unlike VMX's APICv, SVM's AVIC doesn't plug the backing pfn directly into the VMCB and so doesn't need a hook to invalidate an out-of-MMU "mapping". Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Link: https://lore.kernel.org/r/20230602011518.787006-4-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 0a8a5f2 commit 0a3869e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/x86/kvm/mmu/mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1600,7 +1600,8 @@ bool kvm_unmap_gfn_range(struct kvm *kvm, struct kvm_gfn_range *range)
16001600
if (tdp_mmu_enabled)
16011601
flush = kvm_tdp_mmu_unmap_gfn_range(kvm, range, flush);
16021602

1603-
if (range->slot->id == APIC_ACCESS_PAGE_PRIVATE_MEMSLOT)
1603+
if (kvm_x86_ops.set_apic_access_page_addr &&
1604+
range->slot->id == APIC_ACCESS_PAGE_PRIVATE_MEMSLOT)
16041605
kvm_make_all_cpus_request(kvm, KVM_REQ_APIC_PAGE_RELOAD);
16051606

16061607
return flush;

0 commit comments

Comments
 (0)