From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [RFC] KVM: Fix simultaneous NMIs
Date: Mon, 19 Sep 2011 12:22:11 -0300 [thread overview]
Message-ID: <20110919152211.GA7411@amt.cnet> (raw)
In-Reply-To: <4E775B33.3030906@redhat.com>
On Mon, Sep 19, 2011 at 06:09:39PM +0300, Avi Kivity wrote:
> On 09/19/2011 05:54 PM, Marcelo Tosatti wrote:
> >On Mon, Sep 19, 2011 at 05:30:27PM +0300, Avi Kivity wrote:
> >> On 09/19/2011 04:54 PM, Marcelo Tosatti wrote:
> >> >> >>
> >> >> >> Yes, due to NMI-blocked-by-STI. A really touchy area.
> >> >> >And we don't need the window exit notification then? I don't understand
> >> >> >what nmi_in_progress is supposed to do here.
> >> >>
> >> >> We need the window notification in both cases. If we're recovering
> >> >> from STI, then we don't need to collapse NMIs. If we're completing
> >> >> an NMI handler, then we do need to collapse NMIs (since the queue
> >> >> length is two, and we just completed one).
> >> >
> >> >I don't understand what is the point with nmi_in_progress, and the above
> >> >hunk, either. Can't inject_nmi do:
> >> >
> >> >if (nmi_injected + atomic_read(nmi_pending)< 2)
> >> > atomic_inc(nmi_pending)
> >> >
> >> >Instead of collapsing somewhere else?
> >>
> >> We could. It's not atomic though - two threads executing in
> >> parallel could raise the value to three. Could do a cmpxchg loop
> >> does an increment bounded to two. I guess this is a lot clearer,
> >> thanks.
> >>
> >> >You'd also have to change
> >> >nmi_injected handling in arch code so its value is not "hidden", in
> >> >complete_interrupts().
> >>
> >> Or maybe make raising nmi_injected not decrement nmi_pending. So:
> >>
> >> nmi_pending: total number of interrupts in queue
> >> nmi_injected: of these, how many are currently being injected
> >>
> >> yes?
> >
> >Yes, at the expense of decrementing on subarch code (which is fine,
> >apparently).
> >
>
> Hm, we have no place to decrement.
Decrement when setting nmi_injected = false, increment when setting
nmi_injected = true, in vmx/svm.c.
> We need to do that when IRET
> executes, but we don't want to request an NMI window exit in the
> common case of nmi_pending = 1.
Do not enable nmi window if nmi_injected = true?
next prev parent reply other threads:[~2011-09-19 15:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-15 14:45 [RFC] KVM: Fix simultaneous NMIs Avi Kivity
2011-09-15 16:01 ` Jan Kiszka
2011-09-15 17:02 ` Avi Kivity
2011-09-15 17:25 ` Jan Kiszka
2011-09-15 17:48 ` Avi Kivity
2011-09-19 13:54 ` Marcelo Tosatti
2011-09-19 14:30 ` Avi Kivity
2011-09-19 14:54 ` Marcelo Tosatti
2011-09-19 15:09 ` Avi Kivity
2011-09-19 15:12 ` Avi Kivity
2011-09-19 15:22 ` Marcelo Tosatti [this message]
2011-09-19 15:37 ` Avi Kivity
2011-09-19 15:57 ` Marcelo Tosatti
2011-09-20 8:40 ` 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=20110919152211.GA7411@amt.cnet \
--to=mtosatti@redhat.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
/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).