public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* device-assignment deadlock
@ 2009-05-08 22:21 Alex Williamson
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Williamson @ 2009-05-08 22:21 UTC (permalink / raw)
  To: Sheng Yang; +Cc: kvm

Hi Sheng,

I think I'm running into the following deadlock in the kvm kernel module
when trying to use device assignment:

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]

I wonder if we need finer granularity locking to avoid this.
Suggestions?  Thanks,

Alex


^ permalink raw reply	[flat|nested] 2+ messages in thread
* Re: device-assignment deadlock
@ 2009-05-12  9:05 Yang, Sheng
  0 siblings, 0 replies; 2+ messages in thread
From: Yang, Sheng @ 2009-05-12  9:05 UTC (permalink / raw)
  To: Alex Williamson; +Cc: kvm

[I was kicked off from the mailing list by periodic unknown reason last 
Friday... Sorry]

> Hi Sheng,
>
> I think I'm running into the following deadlock in the kvm kernel module
> when trying to use device assignment:
>
> 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]

> I wonder if we need finer granularity locking to avoid this.
> Suggestions?  Thanks,

This part again...

I think simply move kvm_deassign_irq() out of critical region is OK, and I 
also add the lock which seems missing in deassign_guest_irq(). Would post a 
patch soon.

-- 
regards
Yang, Sheng


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-12  9:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-08 22:21 device-assignment deadlock Alex Williamson
  -- strict thread matches above, loose matches on Subject: below --
2009-05-12  9:05 Yang, Sheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox