All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: "Yang, Sheng" <sheng.yang@intel.com>
Cc: Alex Williamson <alex.williamson@hp.com>,
	Avi Kivity <avi@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 1/1] KVM: Fix potentially recursively get kvm lock
Date: Wed, 13 May 2009 10:14:19 -0300	[thread overview]
Message-ID: <20090513131419.GA3976@amt.cnet> (raw)
In-Reply-To: <200905131007.55189.sheng.yang@intel.com>

On Wed, May 13, 2009 at 10:07:54AM +0800, Yang, Sheng wrote:
> > KVM: workaround workqueue / deassign_host_irq deadlock
> >
> > 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]
> >
> > Workaround the issue by dropping kvm->lock for cancel_work_sync().
> >
> > Reported-by: Alex Williamson <alex.williamson@hp.com>
> > From: Sheng Yang <sheng.yang@intel.com>
> > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
> 
> Another calling path(kvm_free_all_assigned_devices()) don't hold kvm->lock... 
> Seems it need the lock for travel assigned dev list?

Sheng,

The task executing the deassign irq ioctl has a reference to the vm
instance. This solution is just temporary though until the locks can be
split and then dropping kvm->lock around cancel_work_sync will not be
necessary anymore.


  reply	other threads:[~2009-05-13 13:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12  9:05 device-assignment deadlock Yang, Sheng
2009-05-12  9:32 ` [PATCH 1/1] KVM: Fix potentially recursively get kvm lock Sheng Yang
2009-05-12 11:55   ` Marcelo Tosatti
2009-05-12 14:13     ` Yang, Sheng
2009-05-12 14:30       ` Marcelo Tosatti
2009-05-12 15:59         ` Marcelo Tosatti
2009-05-12 19:44         ` Marcelo Tosatti
2009-05-12 21:36           ` Alex Williamson
2009-05-12 22:09             ` Marcelo Tosatti
2009-05-12 22:17               ` Alex Williamson
2009-05-22 15:06                 ` Chris Wright
2009-05-22 15:34                   ` Alex Williamson
2009-05-22 15:36                     ` Chris Wright
2009-05-13  2:07               ` Yang, Sheng
2009-05-13 13:14                 ` Marcelo Tosatti [this message]
2009-05-13 11:43         ` Gleb Natapov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090513131419.GA3976@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=alex.williamson@hp.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=sheng.yang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.