Commit e3c89f5d authored by Yi Wang's avatar Yi Wang Committed by Sean Christopherson

KVM: x86: Don't re-setup empty IRQ routing when KVM_CAP_SPLIT_IRQCHIP

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: default avatarYi 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: default avatarSean Christopherson <seanjc@google.com>
parent fbe4a7e8
...@@ -106,7 +106,6 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu); ...@@ -106,7 +106,6 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu);
int apic_has_pending_timer(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_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, int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src,
struct kvm_lapic_irq *irq, struct kvm_lapic_irq *irq,
struct dest_map *dest_map); struct dest_map *dest_map);
......
...@@ -395,13 +395,6 @@ int kvm_setup_default_irq_routing(struct kvm *kvm) ...@@ -395,13 +395,6 @@ int kvm_setup_default_irq_routing(struct kvm *kvm)
ARRAY_SIZE(default_routing), 0); 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) void kvm_arch_post_irq_routing_update(struct kvm *kvm)
{ {
if (!irqchip_split(kvm)) if (!irqchip_split(kvm))
......
...@@ -6552,9 +6552,6 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, ...@@ -6552,9 +6552,6 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm,
goto split_irqchip_unlock; goto split_irqchip_unlock;
if (kvm->created_vcpus) if (kvm->created_vcpus)
goto split_irqchip_unlock; goto split_irqchip_unlock;
r = kvm_setup_empty_irq_routing(kvm);
if (r)
goto split_irqchip_unlock;
/* Pairs with irqchip_in_kernel. */ /* Pairs with irqchip_in_kernel. */
smp_wmb(); smp_wmb();
kvm->arch.irqchip_mode = KVM_IRQCHIP_SPLIT; kvm->arch.irqchip_mode = KVM_IRQCHIP_SPLIT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment