public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jes Sorensen <Jes.Sorensen@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"gleb@redhat.com" <gleb@redhat.com>,
	Joerg Roedel <joerg.roedel@amd.com>
Subject: Re: [PATCH 1/1] Disable GUEST_INTR_STATE_STI flag before injecting NMI to guest on VMX
Date: Sun, 29 Aug 2010 11:09:57 +0300	[thread overview]
Message-ID: <4C7A15D5.6050602@redhat.com> (raw)
In-Reply-To: <4C77EB33.9030407@siemens.com>

  On 08/27/2010 07:43 PM, Jan Kiszka wrote:
> Avi Kivity wrote:
>>    On 08/27/2010 05:13 PM, Jan Kiszka wrote:
>>>> I forgot them already.  What was that, exception during IRET?
>>> Exception during IRET or any instruction under the interrupt shadow will
>>> push the TF we set to step over this issue on the guest stack. We do not
>>> intercept all the possible exceptions, so we can leak TF. Moreover,
>>> multiplexing TF users is currently imperfect on AMD but, before fixing
>>> that, we have to think about the approach in general.
>> Thanks.  I think those are all solvable.  The key IMO is to take a state
>> based approach to host bits - instead of setting or clearing a bit in
>> response to an event, use the event as a trigger for recalculation of
>> the bit's value.  This works for bits which have multiple uses, and for
>> recovery from KVM_SET_*.  For guest bits which are needed by the host we
>> also have a working approach - when the bit is overloaded, trap all
>> instructions that can see it, as in CR0.TS.
>>
>> It may take some work but I think we can achieve 100% accuracy without
>> making the code unmaintainable.
> Besides making TF usage robust against multiple users, including the
> guest itself, my complexity concern is first of all about preventing its
> leakage. We will have to trap _all_ exceptions and properly remove TF
> from the guest state.

Note we already trap all exceptions on Intel when virtualizing real mode 
via vm86.

> And then there is a potential performance price to pay (yes, accuracy
> should come first): If the guest uses NMIs for profiles, thus at a
> significant rate, AMD processors force us to exit twice per NMI return -
> independent of the fact if there is another NMI pending or not.

Doesn't worry me too much.  NMI rate will be limited or 
program-under-test performance will suffer.  10K vs 20K exits/sec is 
substantial, but not worth worrying about for this fairly rare use case.

I'm more concerned that we don't push VMLOAD/VMSAVE to the heavyweight 
exit path, and that we don't use the svm interrupt queue (that could 
reduce 10% of the exits on normal interrupts).


-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2010-08-29  8:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-26 20:06 [PATCH 0/1] Disable GUEST_INTR_STATE_STI flag before injecting NMI to VMX guest Jes.Sorensen
2010-08-26 20:06 ` [PATCH 1/1] Disable GUEST_INTR_STATE_STI flag before injecting NMI to guest on VMX Jes.Sorensen
2010-08-27  8:27   ` Jan Kiszka
2010-08-27  8:31     ` Jes Sorensen
2010-08-27  8:39       ` Jan Kiszka
2010-08-27  9:46         ` Avi Kivity
2010-08-27 11:06           ` Jan Kiszka
2010-08-27 13:58             ` Avi Kivity
2010-08-27 14:13               ` Jan Kiszka
2010-08-27 15:50                 ` Avi Kivity
2010-08-27 16:43                   ` Jan Kiszka
2010-08-29  8:09                     ` Avi Kivity [this message]
2010-08-27  9:44     ` Avi Kivity
2010-08-27 11:06       ` Jan Kiszka
2010-08-27 13:54         ` Avi Kivity
2010-08-27 14:12           ` Jan Kiszka
2010-08-27 11:16       ` Gleb Natapov
2010-08-27 11:23         ` Jan Kiszka
2010-08-27 11:25           ` Gleb Natapov
2010-08-27 11:04     ` Gleb Natapov
2010-08-27 11:09       ` Jan Kiszka
2010-08-27  9:21   ` Avi Kivity
2010-08-27  9:41     ` Jes Sorensen
2010-08-27  9:47       ` Avi Kivity
2010-08-27  9:56         ` Jes Sorensen
2010-08-27  9:59           ` Avi Kivity
2010-08-27 10:01             ` Jes Sorensen

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=4C7A15D5.6050602@redhat.com \
    --to=avi@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=joerg.roedel@amd.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