kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: kvm@vger.kernel.org, Kashyap Chamarthy <kashyap.cv@gmail.com>,
	Alexander Graf <agraf@suse.de>
Subject: Re: [PATCH] KVM: nVMX: fix shadow on EPT
Date: Wed, 09 Oct 2013 18:38:16 +0200	[thread overview]
Message-ID: <52558678.2060801@redhat.com> (raw)
In-Reply-To: <20131009163507.GA15954@redhat.com>

Il 09/10/2013 18:35, Gleb Natapov ha scritto:
> On Wed, Oct 09, 2013 at 06:19:52PM +0200, Paolo Bonzini wrote:
>> Il 09/10/2013 18:13, Gleb Natapov ha scritto:
>>> 72f857950f6f19 broke shadow on EPT. This patch reverts it and fixes PAE
>>> on nEPT (which reverted commit fixed) in other way.
>>>
>>> Shadow on EPT is now broken because while L1 builds shadow page table
>>> for L2 (which is PAE while L2 is in real mode) it never loads L2's
>>> GUEST_PDPTR[0-3].  They do not need to be loaded because without nested
>>> virtualization HW does this during guest entry if EPT is disabled,
>>> but in our case L0 emulates L2's vmentry while EPT is enables, so we
>>> cannot rely on vmcs12->guest_pdptr[0-3] to contain up-to-date values
>>> and need to re-read PDPTEs from L2 memory. This is what kvm_set_cr3()
>>> is doing, but by clearing cache bits during L2 vmentry we drop values
>>> that kvm_set_cr3() read from memory.
>>>
>>> So why the same code does not work for PAE on nEPT? kvm_set_cr3()
>>> reads pdptes into vcpu->arch.walk_mmu->pdptrs[]. walk_mmu points to
>>> vcpu->arch.nested_mmu while nested guest is running, but ept_load_pdptrs()
>>> uses vcpu->arch.mmu which contain incorrect values. Fix that by using
>>> walk_mmu in ept_(load|save)_pdptrs.
>>>
>>> Signed-off-by: Gleb Natapov <gleb@redhat.com>
>>
>> The new fix also looks much more obvious.
>>
>> Applied to queue, thanks.
>>
> The patch that break shadow on EPT is in master IIRC, if it is the case
> consider this for -rc5.

Yes.  I would also like to include the PPC patches that Alex pointed to
us, but I need a Tested-by because the backport isn't trivial.

If it doesn't come soon (i.e. by friday), I'll drop them and include
only your patch.

Paolo

      reply	other threads:[~2013-10-09 16:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-09 16:13 [PATCH] KVM: nVMX: fix shadow on EPT Gleb Natapov
2013-10-09 16:19 ` Paolo Bonzini
2013-10-09 16:35   ` Gleb Natapov
2013-10-09 16:38     ` Paolo Bonzini [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=52558678.2060801@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=agraf@suse.de \
    --cc=gleb@redhat.com \
    --cc=kashyap.cv@gmail.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).