public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: Re: KVM: VMX: do not overwrite uptodate vcpu->arch.cr3 on KVM_SET_SREGS
Date: Thu, 9 Jun 2011 14:11:23 -0300	[thread overview]
Message-ID: <20110609171123.GA5030@amt.cnet> (raw)
In-Reply-To: <4DEDE051.2090908@redhat.com>

On Tue, Jun 07, 2011 at 11:24:49AM +0300, Avi Kivity wrote:
> On 06/06/2011 08:27 PM, Marcelo Tosatti wrote:
> >Only decache guest CR3 value if vcpu->arch.cr3 is stale.
> >Fixes loadvm with live guest.
> >
> >
> >@@ -2049,7 +2049,9 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0,
> >  					unsigned long cr0,
> >  					struct kvm_vcpu *vcpu)
> >  {
> >-	vmx_decache_cr3(vcpu);
> >+
> >+	if (!test_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail))
> >+		vmx_decache_cr3(vcpu);
> >  	if (!(cr0&  X86_CR0_PG)) {
> >  		/* From paging/starting to nonpaging */
> >  		vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,
> 
> Applied and queued, but I think there is something rotten here.  How
> does arch.cr3 get into GUEST_CR3 after KVM_SET_SREGS?  arch.cr3 is a
> supposed to be write-through cache - it only has a bit in
> regs_avail, not regs_dirty.


KVM_SET_SREGS sets good kvm->arch.cr3. Then vmx_decache_cr3 overwrites
kvm->arch.cr3 from GUEST_CR3, which is stale.



  reply	other threads:[~2011-06-09 17:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 17:27 KVM: VMX: do not overwrite uptodate vcpu->arch.cr3 on KVM_SET_SREGS Marcelo Tosatti
2011-06-07  8:24 ` Avi Kivity
2011-06-09 17:11   ` Marcelo Tosatti [this message]
2011-06-12  8:50     ` 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=20110609171123.GA5030@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=avi@redhat.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