]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: don't hold kvm->lock in KVM_SET_GSI_ROUTING
authorDavid Hildenbrand <david@redhat.com>
Fri, 28 Apr 2017 15:06:20 +0000 (17:06 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 2 May 2017 12:45:45 +0000 (14:45 +0200)
commitd18a31ca78b8b7901a66dde9e8e71275a558678c
tree12549a0a41cdda2b265bf0107daca828bc52b8c5
parenta6fb8b97e56cc79e2cd104a2a9ddb0a2d2e463df
KVM: x86: don't hold kvm->lock in KVM_SET_GSI_ROUTING

We needed the lock to avoid racing with creation of the irqchip on x86. As
kvm_set_irq_routing() calls srcu_synchronize_expedited(), this lock
might be held for a longer time.

Let's introduce an arch specific callback to check if we can actually
add irq routes. For x86, all we have to do is check if we have an
irqchip in the kernel. We don't need kvm->lock at that point as the
irqchip is marked as inititalized only when actually fully created.

Reported-by: Steve Rutherford <srutherford@google.com>
Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Fixes: d5faa3dffa46 ("KVM: x86: race between KVM_SET_GSI_ROUTING and KVM_CREATE_IRQCHIP")
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/irq.h
arch/x86/kvm/irq_comm.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/irqchip.c
virt/kvm/kvm_main.c