From: Takuya Yoshikawa <takuya.yoshikawa@gmail.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: avi@redhat.com, kvm@vger.kernel.org, yoshikawa.takuya@oss.ntt.co.jp
Subject: Re: [RFC PATCH] KVM: Fix missing lock for kvm_io_bus_unregister_dev()
Date: Fri, 10 Dec 2010 02:21:18 +0900 [thread overview]
Message-ID: <20101210022118.e608a136.takuya.yoshikawa@gmail.com> (raw)
In-Reply-To: <20101208191044.GA12294@amt.cnet>
Marcelo Tosatti <mtosatti@redhat.com> wrote:
> > --- a/arch/x86/kvm/i8254.c
> > +++ b/arch/x86/kvm/i8254.c
> > @@ -744,9 +744,11 @@ void kvm_free_pit(struct kvm *kvm)
> > struct hrtimer *timer;
> >
> > if (kvm->arch.vpit) {
> > + mutex_lock(&kvm->slots_lock);
> > kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS, &kvm->arch.vpit->dev);
> > kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS,
> > &kvm->arch.vpit->speaker_dev);
> > + mutex_unlock(&kvm->slots_lock);
> > kvm_unregister_irq_mask_notifier(kvm, 0,
> > &kvm->arch.vpit->mask_notifier);
> > kvm_unregister_irq_ack_notifier(kvm,
>
> This is supposedly safe because this is only called from vm destroy
> context, when dropping the last reference.
>
I see. Drop this from the next version.
>
> It seems the best way to fix is to move irq_lock and slots_lock
> acquision from kvm_set_irq_routing/kvm_ioapic_destroy/kvm_destroy_pic to
> their callers.
>
Then, the lock acquisition for registeration and unregisteration may be
centralized to vm_ioctl.
I'm now checking these to reformat the patch.
Thanks,
Takuya
prev parent reply other threads:[~2010-12-09 18:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-07 16:45 [RFC PATCH] KVM: Fix missing lock for kvm_io_bus_unregister_dev() Takuya Yoshikawa
2010-12-08 5:27 ` Takuya Yoshikawa
2010-12-08 19:10 ` Marcelo Tosatti
2010-12-09 17:21 ` Takuya Yoshikawa [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=20101210022118.e608a136.takuya.yoshikawa@gmail.com \
--to=takuya.yoshikawa@gmail.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/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