public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Dong, Chuanxiao" <chuanxiao.dong@intel.com>,
	"kwankhede@nvidia.com" <kwankhede@nvidia.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	'Zhenyu Wang' <zhenyuw@linux.intel.com>
Subject: Re: possible recursive locking issue
Date: Fri, 7 Jul 2017 09:50:44 -0600	[thread overview]
Message-ID: <20170707095044.25dd239a@w520.home> (raw)
In-Reply-To: <02294617-08c8-5a32-8fb1-9a8ef95ea2c3@redhat.com>

On Fri, 7 Jul 2017 09:54:13 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 06/07/2017 23:10, Alex Williamson wrote:
> > vfio_unpin_pages() also takes a read-lock on
> > the same.  Why is this a problem?  We should be able to nest
> > read-locks.  
> 
> rwsem is fair in that it blocks out new readers if a writer is waiting.
> In this case nesting causes a deadlock, because the outer read-lock will
> never be released.

Ok, that certainly explains the potential deadlock.  The _nested
variants Chuanxiao suggests only seems to potentially silence lockdep,
they don't change the non-debug versions afaict.  An ideal solution
would be to determine that we don't really need that lock in the unpin
path, otherwise an ugly (but straight forward) solution might be to
make unlocked variants of those call.  More investigation of exactly
what we're locking and why is required.  Thanks,

Alex

      reply	other threads:[~2017-07-07 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  9:39 possible recursive locking issue Dong, Chuanxiao
2017-07-06 21:10 ` Alex Williamson
2017-07-07  2:42   ` Dong, Chuanxiao
2017-07-07  7:54   ` Paolo Bonzini
2017-07-07 15:50     ` Alex Williamson [this message]

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=20170707095044.25dd239a@w520.home \
    --to=alex.williamson@redhat.com \
    --cc=chuanxiao.dong@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwankhede@nvidia.com \
    --cc=pbonzini@redhat.com \
    --cc=zhenyuw@linux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox