]> www.infradead.org Git - linux.git/commitdiff
KVM: x86: Don't re-setup empty IRQ routing when KVM_CAP_SPLIT_IRQCHIP
authorYi Wang <foxywang@tencent.com>
Mon, 6 May 2024 10:17:50 +0000 (18:17 +0800)
committerSean Christopherson <seanjc@google.com>
Tue, 11 Jun 2024 21:18:40 +0000 (14:18 -0700)
Now that KVM sets up empty IRQ routing during VM creation, don't recreate
empty routing during KVM_CAP_SPLIT_IRQCHIP.  Setting IRQ routes during
KVM_CAP_SPLIT_IRQCHIP can result in 20+ milliseconds of delay due to the
synchronize_srcu_expedited() call in kvm_set_irq_routing().

Note, the empty routing is guaranteed to be intact as KVM x86 only allows
changing the IRQ routing after an in-kernel IRQCHIP has been created, and
KVM_CAP_SPLIT_IRQCHIP is disallowed after creating an IRQCHIP.

Signed-off-by: Yi Wang <foxywang@tencent.com>
Link: https://lore.kernel.org/r/20240506101751.3145407-3-foxywang@tencent.com
[sean: massage changelog, remove unused empty_routing array]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/irq.h
arch/x86/kvm/irq_comm.c
arch/x86/kvm/x86.c

index c2d7cfe82d004b1ae4d9518b0a73a0755114bedd..76d46b2f41ddc6a25e4ae4b0696e0a95d3041f42 100644 (file)
@@ -106,7 +106,6 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu);
 int apic_has_pending_timer(struct kvm_vcpu *vcpu);
 
 int kvm_setup_default_irq_routing(struct kvm *kvm);
-int kvm_setup_empty_irq_routing(struct kvm *kvm);
 int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
                             struct kvm_lapic_irq *irq,
                             struct dest_map *dest_map);
index 68f3f6c26046936601cb0e0a9383c8946ccad8ce..8136695f7b96b5142d0c8173a83e4d4eb3aa860b 100644 (file)
@@ -395,13 +395,6 @@ int kvm_setup_default_irq_routing(struct kvm *kvm)
                                   ARRAY_SIZE(default_routing), 0);
 }
 
-static const struct kvm_irq_routing_entry empty_routing[] = {};
-
-int kvm_setup_empty_irq_routing(struct kvm *kvm)
-{
-       return kvm_set_irq_routing(kvm, empty_routing, 0, 0);
-}
-
 void kvm_arch_post_irq_routing_update(struct kvm *kvm)
 {
        if (!irqchip_split(kvm))
index 082ac6d95a3a08160d54ec832d0c075c0bd71489..a5c8caed76b1a74b83b0f4cfd53cbc158f2e9330 100644 (file)
@@ -6552,9 +6552,6 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
                        goto split_irqchip_unlock;
                if (kvm->created_vcpus)
                        goto split_irqchip_unlock;
-               r = kvm_setup_empty_irq_routing(kvm);
-               if (r)
-                       goto split_irqchip_unlock;
                /* Pairs with irqchip_in_kernel. */
                smp_wmb();
                kvm->arch.irqchip_mode = KVM_IRQCHIP_SPLIT;