public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.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: Fri, 27 Aug 2010 16:13:38 +0200	[thread overview]
Message-ID: <4C77C812.4040103@siemens.com> (raw)
In-Reply-To: <4C77C49A.9000600@redhat.com>

Avi Kivity wrote:
>   On 08/27/2010 02:06 PM, Jan Kiszka wrote:
>> Avi Kivity wrote:
>>>    On 08/27/2010 11:39 AM, Jan Kiszka wrote:
>>>> AMD does not differentiate between MOV-SS and STI interrupt shadows.
>>>>
>>>> But AMD has its own NMI problems as it does not allow to trap after
>>>> IRET-from-NMI and requires magic dances which are partly broken in KVM.
>>>> I'm leaning towards NMI window emulation via the workaround we use for
>>>> older Intel CPUs without NMI window trapping as well.
>>> Can you elaborate?
>> Basically the issues you found regarding our single-step-based
>> workaround.
> 
> 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.

> 
>> Moreover, we cannot easily prevent that TF set by the NMI
>> code leaks onto the guest's stack.
>>
>> Jörg and I stuck heads together about this during LinuxCon. We came to
>> the conclusion that we either have to emulate the instruction that
>> delays NMIs (ie. _every_ possible instruction for the interrupt shadow
>> case) or fall back to the VMX workaround based on interrupt window
>> trapping and an emergency timeout (much simpler, but not really correct).
> 
> I'd really like to avoid the timer.  But I forgot all the details around 
> this, I'll have to re-learn them so I can actually compare the two options.
> 

Hope the above helps you to get on track, otherwise drop more questions.
Also putting Joerg on CC (in the futile hope that the longer the CC list
is, the lesser the pain becomes for each individual).

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2010-08-27 14:13 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 [this message]
2010-08-27 15:50                 ` Avi Kivity
2010-08-27 16:43                   ` Jan Kiszka
2010-08-29  8:09                     ` Avi Kivity
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=4C77C812.4040103@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=avi@redhat.com \
    --cc=gleb@redhat.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