KVM: switch irq injection/acking data structures to irq_lock
authorMarcelo Tosatti <mtosatti@redhat.com>
Thu, 4 Jun 2009 18:08:24 +0000 (15:08 -0300)
committerAvi Kivity <avi@redhat.com>
Thu, 10 Sep 2009 05:32:49 +0000 (08:32 +0300)
commitfa40a8214bb9bcae8d49c234c19d8b4a6c1f37ff
tree6449f27072f128a1c39faaaeef1787f754345aaf
parent60eead79ad8750f80384cbe48fc44edcc78a0305
KVM: switch irq injection/acking data structures to irq_lock

Protect irq injection/acking data structures with a separate irq_lock
mutex. This fixes the following deadlock:

CPU A                               CPU B
kvm_vm_ioctl_deassign_dev_irq()
  mutex_lock(&kvm->lock);            worker_thread()
  -> kvm_deassign_irq()                -> kvm_assigned_dev_interrupt_work_handler()
    -> deassign_host_irq()               mutex_lock(&kvm->lock);
      -> cancel_work_sync() [blocked]

[gleb: fix ia64 path]

Reported-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/ia64/kvm/kvm-ia64.c
arch/x86/kvm/i8254.c
arch/x86/kvm/lapic.c
arch/x86/kvm/x86.c
include/linux/kvm_host.h
virt/kvm/eventfd.c
virt/kvm/irq_comm.c
virt/kvm/kvm_main.c