public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@web.de>
To: Nadav Har'El <nyh@math.technion.ac.il>
Cc: Gleb Natapov <gleb@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>, kvm <kvm@vger.kernel.org>,
	"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: Re: [PATCH] KVM: nVMX: Reset RFLAGS on VM-exit
Date: Sun, 03 Mar 2013 20:23:26 +0100	[thread overview]
Message-ID: <5133A32E.4010301@web.de> (raw)
In-Reply-To: <20130303191505.GA32596@fermat.math.technion.ac.il>

[-- Attachment #1: Type: text/plain, Size: 1115 bytes --]

On 2013-03-03 20:15, Nadav Har'El wrote:
> On Sun, Mar 03, 2013, Jan Kiszka wrote about "[PATCH] KVM: nVMX: Reset RFLAGS on VM-exit":
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> Ouch, how could this work so well that far? We need to clear RFLAGS to
>> the reset value as specified by the SDM. Particularly, IF must be off
>> after VM-exit!
> 
> nested_vmx_succeed() or nested_vmx_fail*() were already clearing some of
> the fields that I understood was necessary to clear. But they did not clear
> the IF - I never realised (and didn't verify now) that this is part of the
> spec. And since L1 KVM anyways enters L2 with interrupts disabled, nested KVM
> would not see a difference.

But we didn't restore rflags on vmexit either, we reused the guest value
for L1. It was pure luck (and due to KVM's short IRQ-off phase after
vmexit) when things worked. But I bet this should fix some spurious issues.

> 
>> +	vmx_set_rflags(vcpu, 0x02);
> 
> There's a macro X86_EFLAGS_BIT1 which you can use for this 0x02.

Ah, good to know. Checked vmx_vcpu_reset and found this value.

Jan



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

      reply	other threads:[~2013-03-03 19:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03 12:06 [PATCH] KVM: nVMX: Reset RFLAGS on VM-exit Jan Kiszka
2013-03-03 19:15 ` Nadav Har'El
2013-03-03 19:23   ` Jan Kiszka [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=5133A32E.4010301@web.de \
    --to=jan.kiszka@web.de \
    --cc=gleb@redhat.com \
    --cc=jun.nakajima@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=nyh@math.technion.ac.il \
    /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