From: Sheng Yang <sheng@linux.intel.com>
To: kvm@vger.kernel.org
Cc: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH] KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device()
Date: Mon, 14 Dec 2009 15:14:00 +0800 [thread overview]
Message-ID: <200912141514.00291.sheng@linux.intel.com> (raw)
In-Reply-To: <1260176284-4858-1-git-send-email-sheng@linux.intel.com>
On Monday 07 December 2009 16:58:04 Sheng Yang wrote:
> One possible order is:
>
> KVM_CREATE_IRQCHIP ioctl(took kvm->lock) -> kvm_iobus_register_dev() ->
> down_write(kvm->slots_lock).
>
> The other one is in kvm_vm_ioctl_assign_device(), which take
> kvm->slots_lock first, then kvm->lock.
>
> Observe it due to kernel locking debug warnings.
>
> Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Avi? Marcelo?
--
regards
Yang, Sheng
> ---
> virt/kvm/assigned-dev.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
> index fd9c097..f73de63 100644
> --- a/virt/kvm/assigned-dev.c
> +++ b/virt/kvm/assigned-dev.c
> @@ -508,8 +508,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
> struct kvm_assigned_dev_kernel *match;
> struct pci_dev *dev;
>
> - down_read(&kvm->slots_lock);
> mutex_lock(&kvm->lock);
> + down_read(&kvm->slots_lock);
>
> match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
> assigned_dev->assigned_dev_id);
> @@ -573,8 +573,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
> }
>
> out:
> - mutex_unlock(&kvm->lock);
> up_read(&kvm->slots_lock);
> + mutex_unlock(&kvm->lock);
> return r;
> out_list_del:
> list_del(&match->list);
> @@ -585,8 +585,8 @@ out_put:
> pci_dev_put(dev);
> out_free:
> kfree(match);
> - mutex_unlock(&kvm->lock);
> up_read(&kvm->slots_lock);
> + mutex_unlock(&kvm->lock);
> return r;
> }
>
next prev parent reply other threads:[~2009-12-14 7:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-07 8:58 [PATCH] KVM: Fix possible circular locking in kvm_vm_ioctl_assign_device() Sheng Yang
2009-12-14 7:14 ` Sheng Yang [this message]
2009-12-14 9:36 ` Avi Kivity
2009-12-14 19:12 ` Marcelo Tosatti
2009-12-15 2:28 ` Sheng Yang
2009-12-15 9:35 ` Avi Kivity
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=200912141514.00291.sheng@linux.intel.com \
--to=sheng@linux.intel.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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;
as well as URLs for NNTP newsgroup(s).