public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: "Yang, Sheng" <sheng.yang@intel.com>, kvm <kvm@vger.kernel.org>,
	"bonenkamp@gmx.de" <bonenkamp@gmx.de>,
	Chris Wright <chrisw@redhat.com>
Subject: Re: [UNTESTED] KVM: do not call kvm_set_irq from irq disabled section
Date: Wed, 21 Apr 2010 21:38:39 +0300	[thread overview]
Message-ID: <20100421183839.GC2455@redhat.com> (raw)
In-Reply-To: <20100421182911.GA28343@amt.cnet>

On Wed, Apr 21, 2010 at 03:29:11PM -0300, Marcelo Tosatti wrote:
> On Wed, Apr 21, 2010 at 08:58:48PM +0300, Gleb Natapov wrote:
> > On Wed, Apr 21, 2010 at 02:37:34PM -0300, Marcelo Tosatti wrote:
> > > On Wed, Apr 21, 2010 at 08:12:27PM +0300, Gleb Natapov wrote:
> > > > On Wed, Apr 21, 2010 at 12:58:41PM -0300, Marcelo Tosatti wrote:
> > > > > > Or could we make kvm_set_irq() atomic? Though the code path is a little long 
> > > > > > for spinlock.
> > > > > 
> > > > > Yes, given the sleep-inside-RCU-protected section bug from
> > > > > kvm_notify_acked_irq, either that or convert IRQ locking to SRCU.
> > > > > 
> > > > > But as you said, the code paths are long and potentially slow, so
> > > > > probably SRCU is a better alternative.
> > > > > 
> > > > > Gleb?
> > > > kvm_set_irq() was converted to rcu from mutex to make msix interrupt
> > > > injection scalable.
> > > 
> > > We meant ioapic lock. See the last report from Ralf on this thread. 
> > Can we solve the problem by calling ack notifier outside rcu read
> > section in kvm_notify_acked_irq()?
> 
> The unregister path does
> 
> - remove_from_list(entry)
> - synchronize_rcu
> - kfree(entry)
> 
> So if kvm_notify_acked_irq sleeps, synchronize_rcu can succeed, and the
> notifier entry can be freed.
What I mean is kvm_notify_acked_irq() will iterate over all ack entries
in rcu read protected section, but instead of calling callback it will
collect them into the array and call them outside rcu read section. At
this point it doesn't matter if entry is unregistered since the copy is
used to actually call the notifier.

--
			Gleb.

  reply	other threads:[~2010-04-21 18:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 15:54 [UNTESTED] KVM: do not call kvm_set_irq from irq disabled section Marcelo Tosatti
2010-04-20 21:49 ` Bonenkamp, Ralf
2010-04-21  7:51   ` Yang, Sheng
2010-04-21  7:48 ` Yang, Sheng
2010-04-21 15:58   ` Marcelo Tosatti
2010-04-21 17:12     ` Gleb Natapov
2010-04-21 17:37       ` Marcelo Tosatti
2010-04-21 17:58         ` Gleb Natapov
2010-04-21 18:29           ` Marcelo Tosatti
2010-04-21 18:38             ` Gleb Natapov [this message]
2010-04-22 16:40               ` Marcelo Tosatti
2010-04-22 18:11                 ` Gleb Natapov
2010-04-22 19:40                   ` Marcelo Tosatti
2010-04-22 19:55                     ` Gleb Natapov
2010-04-23 11:05                       ` Avi Kivity
2010-04-23 13:02                         ` Chris Lalancette
2010-04-23 13:30                           ` Avi Kivity
2010-04-23 17:03                         ` KVM: convert ioapic lock to spinlock Marcelo Tosatti
2010-04-21  8:32 ` [UNTESTED] KVM: do not call kvm_set_irq from irq disabled section Avi Kivity
2010-04-21 16:03   ` Marcelo Tosatti
2010-04-21 16:28     ` 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=20100421183839.GC2455@redhat.com \
    --to=gleb@redhat.com \
    --cc=bonenkamp@gmx.de \
    --cc=chrisw@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox